[augeas-devel] XML Lens and Special Characters

Brian Elwood belwood at marinc.com
Fri Jul 18 21:10:09 UTC 2014


Hello...

I'm trying to edit the fencedevice 'passwd' attribute in my /etc/cluster/cluster.conf using the XML lens.  The problem is, my password has to have a special character in it, and I'm having trouble escaping it.  

This is what the line needs to look like:
<fencedevice agent="fence_ipmilan" ipaddr="x.x.x.x" name="fence_ora1" login="fenceme" passwd="abc12\!def"/>

So, here's what I'm trying to do:

setm /files/tmp/cluster.conf/cluster/fencedevices//fencedevice/#attribute passwd "abc12\\!def"  (the backslash has to be there for fence_ipmilan)

This 'appears' to work, as this is what I get when I dump the xml:

augtool> dump-xml /files/tmp/cluster.conf/cluster/fencedevices//fencedevice/#attribute/passwd
<augeas match="/files/tmp/cluster.conf/cluster/fencedevices//fencedevice/#attribute/passwd">
  <node label="passwd" path="/files/tmp/cluster.conf/cluster/fencedevices/fencedevice[1]/#attribute/passwd">
    <value>abc12\!def</value>
  </node>
  <node label="passwd" path="/files/tmp/cluster.conf/cluster/fencedevices/fencedevice[2]/#attribute/passwd">
    <value>abc12\!def</value>
  </node>
  <node label="passwd" path="/files/tmp/cluster.conf/cluster/fencedevices/fencedevice[3]/#attribute/passwd">
    <value>abc12\!def</value>
  </node>
</augeas>

But, when I try to save, I get 

augtool> print /augeas//error
/augeas/files/tmp/cluster.conf/error = "put_failed"
/augeas/files/tmp/cluster.conf/error/path = "/files/tmp/cluster.conf/cluster/fencedevices/fencedevice/#attribute"
/augeas/files/tmp/cluster.conf/error/lens = "/usr/share/augeas/lenses/dist/xml.aug:109.4-.51:"
/augeas/files/tmp/cluster.conf/error/message = "Failed to match \n    ({ /[:A-Z_a-z][.0-:A-Z_a-z-]*/ = /([^\\001-\\004']*\"[^\\001-\\004']*)/ } | { /[:A-Z_a-z][.0-:A-Z_a-z-]*/ = /([^\\001-\\004\"]*'[^\\001-\\004\"]*)/ } | { /[:A-Z_a-z][.0-:A-Z_a-z-]*/ = /([^\\001-\\004\"'\\\\]*)/ })({ /[:A-Z_a-z][.0-:A-Z_a-z-]*/ = /([^\\001-\\004']*\"[^\\001-\\004']*)/ } | { /[:A-Z_a-z][.0-:A-Z_a-z-]*/ = /([^\\001-\\004\"]*'[^\\001-\\004\"]*)/ } | { /[:A-Z_a-z][.0-:A-Z_a-z-]*/ = /([^\\001-\\004\"'\\\\]*)/ })*\n  with tree\n    { \"agent\" = \"fence_ipmilan\" } { \"ipaddr\" = \"x.x.x.x\" } { \"name\" = \"fence_ora1\" } { \"login\" = \"fenceme\" } { \"passwd\" = \"abc12\\!def\" }"

I've tried every combination of quotes and backslashes that I can think of, and I'm out of ideas.  
Any help anyone can offer will be greatly appreciated!

Thanks,
Brian




More information about the augeas-devel mailing list