Hello everyone,

I am currently trying to add elements to an XML file (a libvirt network 
definition) using Puppet (2.7.23)/Augeas (0.10). The XML looks like this:

<network>
    <name>virbr0</name>
    <uuid>57fdc6e3-cba1-4110-88ef-850f1b71ee39</uuid>
    <forward dev='eth0' mode='nat'/>
    <bridge name='virbr0' stp='on' delay='0' />
    <ip address="172.20.20.1" netmask="255.255.255.0">
        <dhcp>
            <range start="172.20.20.100" end="172.20.20.254" />
            <host mac="52:54:00:54:1e:00" name="host1.domain" 
ip="172.20.20.121" />
        </dhcp>
    </ip>
</network>

Specifically, I would like to add elements to the dhcp element (using the 
name attribute as a uniqueness constraint). So far, I tried this definition:

augeas { "libvirt-dhcp-config-$name":
    lens    => 'Xml.lns',
    incl    => '/etc/libvirt/qemu/networks/virbr0.xml',
    changes => [
        "set 
network/ip/dhcp/host[#attribute/name='$name.domain']/#attribute/ip $ip",
     ],
     notify  => Service['libvirtd'],
}

Unfortunately, this just fails to execute:

debug: Augeas[libvirt-dhcp-config-mysql](provider=augeas): Opening augeas 
with root /, lens path , flags 64
debug: Augeas[libvirt-dhcp-config-mysql](provider=augeas): Augeas version 
0.10.0 is installed
debug: Augeas[libvirt-dhcp-config-mysql](provider=augeas): Will attempt to 
save and only run if files changed
debug: Augeas[libvirt-dhcp-config-mysql](provider=augeas): sending command 
'set' with params 
["/files/etc/libvirt/qemu/networks/virbr0.xml/network/ip/dhcp/host[#attribute/name='host.domain']/#attribute/ip",
 
"172.20.20.120"]
debug: Augeas[libvirt-dhcp-config-mysql](provider=augeas): Closed the 
augeas connection
/usr/lib/ruby/vendor_ruby/puppet/util/errors.rb:60:in `fail'
/usr/lib/ruby/vendor_ruby/puppet/provider/augeas/augeas.rb:313:in 
`need_to_run?'
/usr/lib/ruby/vendor_ruby/puppet/type/augeas.rb:205:in `retrieve'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:720:in `retrieve'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:715:in `each'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:715:in `retrieve'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:728:in `retrieve_resource'
/usr/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:32:in 
`perform_changes'
/usr/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:133:in 
`evaluate'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:49:in `apply'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:84:in `eval_resource'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:104:in `evaluate'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:509:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:508:in `thinmark'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:104:in `evaluate'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:386:in `traverse'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:99:in `evaluate'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:141:in `apply'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:122:in 
`retrieve_and_apply_catalog'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:161:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:121:in 
`retrieve_and_apply_catalog'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:152:in `run'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:229:in `main'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:149:in `run_command'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:309:in `run'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:416:in `hook'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:309:in `run'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:407:in `exit_on_fail'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:309:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:69:in `execute'
/usr/bin/puppet:4
err: 
/Stage[main]//Node[node_name]/Vm[mysql]/Augeas[libvirt-dhcp-config-mysql]: 
Could not evaluate: Save failed with return code false

Any ideas? I tried locating some Xml lens documentation, but so far did not 
find anything useful.

Thanks,
Thilo

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to