[Ovirt-devel] [PATCH node] Updated the configuration processing to remove the need for scripts.
Jim Meyering
jim at meyering.net
Tue Oct 14 07:05:55 UTC 2008
Hi Darryl,
Ha! I wondered why you didn't do this. Now I know ;-)
I've just noticed that I never sent this message from last week:
"Darryl L. Pierce" <dpierce at redhat.com> wrote:
...
> +networking=$(awk '/ifcfg=/ {
> + match($0, "ifcfg=(.*)", data)
> + split(data[1], ifcfg, "|")
> +
> + mac = ifcfg[1]
> + iface = ifcfg[2]
> +
Please factor this out:
ifcfg_dir = sprintf "/files/etc/sysconfig/network-scripts/ifcfg-" iface
> + printf("rm /files/etc/sysconfig/network-scripts/ifcfg-%s\n", iface)
> + printf("set /files/etc/sysconfig/network-scripts/ifcfg-%s/DEVICE %s\n", iface, iface)
printf("rm %s\n", ifcfg_dir)
printf("set %s/DEVICE %s\n", ifcfg_dir, iface)
> +
> + for (line in ifcfg) {
> + if(line > 2) {
> + match(ifcfg[line], "(^[^=]+)=(.*)", values)
> + field=values[1]
> + value=values[2]
> +
> + printf("set /files/etc/sysconfig/network-scripts/ifcfg-%s/%s %s\n", iface, field, value)
printf("set %s/%s %s\n", ifcfg_dir field, value)
> + }
> + }
> +
> +
> + printf("save\n")
> +
> +}' $CONFIG)
> +
> +echo "$networking" > $OVIRT_CONFIG_OUTPUT_FILE
More information about the ovirt-devel
mailing list