Hi,
for the last two days I've been trying to get the debian version of ncftool
(I think not much changes since I put it up at
http://people.canonical.com/~serge/netcf - I should put up a source tree, I
know) to actually write out a new /etc/network/interfaces files when doing
ncftool define br.xml. It claims success, but /etc/network/interfaces never
gets written, even though aug_save() gets called.
I've instrumented augeas's aug_set() and tree_store_value() to verify that
the following are being set:
aug_set: setting /files/etc/network/interfaces/auto[3]/1 to br0
aug_set: setting /files/etc/network/interfaces/iface[3] to br0
aug_set: setting /files/etc/network/interfaces/iface[3]/family to inet
aug_set: setting /files/etc/network/interfaces/iface[3]/method to dhcp
aug_set: setting /files/etc/network/interfaces/iface[3]/mtu to 1500
aug_set: setting /files/etc/network/interfaces/iface[3]/bridge_ports to eth0
aug_set: setting /files/etc/network/interfaces/iface[3]/bridge_stp to off
aug_set: setting /files/etc/network/interfaces/iface[3]/bridge_fd to 0.01
tree_store_value() now looks as follows, in case you're wondering:
void tree_store_value(struct tree *tree, char **value) {
#if 0
if (streqv(tree->value, *value)) {
free(*value);
*value = NULL;
return;
}
#endif
if (tree->value != NULL) {
free(tree->value);
tree->value = NULL;
}
if (*value != NULL) {
tree->value = *value;
*value = NULL;
}
{
FILE *f = fopen("/tmp/log4", "a");
if (f) {
fprintf(f, "tree_set_value: setting %s to %s\n",
tree->label, tree->value);
fclose(f);
}
}
tree_mark_dirty(tree);
}
and log4 does get populated with entries for each of the above (showing
only the last part of the path of course). So it seems there should be
no doubt that the values are, in fact being set.
But when I do
{
FILE *f = fopen("/tmp/log7", "a");
aug_print(aug, f, NULL);
fclose(f);
}
either before or after the aug_save in drv_define, the new rules are not
there! (no 'bridge_ports' to be found at all in the output, for instance)
So the rules are disappearing before we get to aug_save(0).
Any ideas?
-serge
PS - I've used augtool by hand to verify that doing
set /files/etc/network/interfaces/auto[3]/1 br0
set /files/etc/network/interfaces/iface[3] br0
set /files/etc/network/interfaces/iface[3]/family inet
set /files/etc/network/interfaces/iface[3]/method dhcp
set /files/etc/network/interfaces/iface[3]/mtu 1500
set /files/etc/network/interfaces/iface[3]/bridge_ports eth0
set /files/etc/network/interfaces/iface[3]/bridge_stp off
set /files/etc/network/interfaces/iface[3]/bridge_fd 0.01
save
creates the right new /etc/network/interfaces file.
PPS - here is the br.xml I'm using:
<interface type="bridge" name="br0">
<start mode="onboot"/>
<mtu size="1500"/>
<protocol family="ipv4">
<dhcp/>
</protocol>
<bridge stp="off" delay="0.01">
<interface type="ethernet" name="eth0">
<!-- <mac address="ab:bb:cc:dd:ee:ff"/>-->
</interface>
</bridge>
</interface>