Augeas fails to set BONDING_OPTS with return code false

423 views
Skip to first unread message

treydock

unread,
Jun 23, 2012, 5:37:04 PM6/23/12
to puppet...@googlegroups.com
I'm attempting to manage my network interfaces through a homebrew module that takes input from hiera, and then uses augeas to define each ifcfg-*.

Example:
  /* Set manditory parameters */
  augeas { "eth_bond_${name}" :
    context => "/files/etc/sysconfig/network-scripts/ifcfg-${name}",
    changes => [
      "set DEVICE ${name}",
      "set BONDING_OPTS '\"mode=${mode} miimon=${miimon}\"'",
      "set BOOTPROTO none",
      "set USERCTL no",
      "set ONBOOT yes",
      "set MTU ${mtu}",
      "set IPADDR ${ip}",
      "set NETMARK ${netmask}",
    ],  
    notify  => Exec["if-refresh-${name}"],
  }


When I try and set something like BONDING_OPTS="mode=0 miimon=100" I get the following in Puppet

debug: Augeas[eth_bond_bond0](provider=augeas): Opening augeas with root /, lens path , flags 0
debug: Augeas[eth_bond_bond0](provider=augeas): Augeas version 0.9.0 is installed
debug: Augeas[eth_bond_bond0](provider=augeas): sending command 'set' with params ["/files/etc/sysconfig/network-scripts/ifcfg-bond0/DEVICE", "bond0"]
debug: Augeas[eth_bond_bond0](provider=augeas): sending command 'set' with params ["/files/etc/sysconfig/network-scripts/ifcfg-bond0/BONDING_OPTS", "mode=0 miimon=100"]
debug: Augeas[eth_bond_bond0](provider=augeas): sending command 'set' with params ["/files/etc/sysconfig/network-scripts/ifcfg-bond0/BOOTPROTO", "none"]
debug: Augeas[eth_bond_bond0](provider=augeas): sending command 'set' with params ["/files/etc/sysconfig/network-scripts/ifcfg-bond0/USERCTL", "no"]
debug: Augeas[eth_bond_bond0](provider=augeas): sending command 'set' with params ["/files/etc/sysconfig/network-scripts/ifcfg-bond0/ONBOOT", "yes"]
debug: Augeas[eth_bond_bond0](provider=augeas): sending command 'set' with params ["/files/etc/sysconfig/network-scripts/ifcfg-bond0/MTU", "9344"]
debug: Augeas[eth_bond_bond0](provider=augeas): sending command 'set' with params ["/files/etc/sysconfig/network-scripts/ifcfg-bond0/IPADDR", "192.168.1.100"]
debug: Augeas[eth_bond_bond0](provider=augeas): sending command 'set' with params ["/files/etc/sysconfig/network-scripts/ifcfg-bond0/NETMARK", "255.0.0.0"]
debug: Augeas[eth_bond_bond0](provider=augeas): Closed the augeas connection
err: /Stage[main]/Networking/Networking::Bond[bond0]/Augeas[eth_bond_bond0]/returns: change from need_to_run to 0 failed: Save failed with return code false
notice: /Stage[main]/Networking/Networking::Bond[bond0]/Exec[if-refresh-bond0]: Dependency Augeas[eth_bond_bond0] has failures: true
warning: /Stage[main]/Networking/Networking::Bond[bond0]/Exec[if-refresh-bond0]: Skipping because of failed dependencies


I also can't seem to get that value saved using augtool either, here's what I get

# cat ifcfg-bond0 
BOOTPROTO=none
ONBOOT=yes
MTU=4000
IPADDR=192.168.1.100
NETMARK=255.0.0.0
DEVICE=bond0

# augtool 
augtool> set /files/etc/sysconfig/network-scripts/ifcfg-bond0/BONDING_OPTS '\"mode=0 miimon=100\"'
augtool> save
error: Failed to execute command
error: saving failed (run 'print /augeas//error' for details)
augtool> print /augeas//error
/augeas/files/etc/sysconfig/network-scripts/ifcfg-bond0/error = "put_failed"
/augeas/files/etc/sysconfig/network-scripts/ifcfg-bond0/error/path = "/files/etc/sysconfig/network-scripts/ifcfg-bond0"
/augeas/files/etc/sysconfig/network-scripts/ifcfg-bond0/error/lens = "/usr/share/augeas/lenses/dist/shellvars.aug:61.12-.77:"
/augeas/files/etc/sysconfig/network-scripts/ifcfg-bond0/error/message = "Malformed child node 'BONDING_OPTS'"

Any ideas?  The documentation on Puppet Augeas (http://projects.puppetlabs.com/projects/1/wiki/Puppet_Augeas#ifcfg+BONDING_OPTS) has this exact example, so I figured there's something very obvious I'm overlooking that's keeping this from working.

Currently affected host and Puppet master are 2.6.16, CentOS 6.2, augeas-0.9.0.

Thanks
- Trey

Christopher Wood

unread,
Jun 23, 2012, 6:34:53 PM6/23/12
to puppet...@googlegroups.com
netmark?

treydock

unread,
Jun 23, 2012, 6:39:26 PM6/23/12
to puppet...@googlegroups.com
Wow...can we permanency delete this post? Haha, I've been staring at Puppet modules for a week straight, it's always a spelling error.

Thanks!
- Trey

Dominic Cleal

unread,
Jun 28, 2012, 9:41:40 AM6/28/12
to puppet...@googlegroups.com
Hi Trey,

On 23/06/12 23:37, treydock wrote:
> I'm attempting to manage my network interfaces through a homebrew module
> that takes input from hiera, and then uses augeas to define each ifcfg-*.
>
> Example:
...
> "set BONDING_OPTS '\"mode=${mode} miimon=${miimon}\"'",

This looks good to me. The nested quotes in the middle are important,
as they're inside included in the value.

> When I try and set something like BONDING_OPTS="mode=0 miimon=100" I get
> the following in Puppet
>
...
> debug: Augeas[eth_bond_bond0](provider=augeas): sending command 'set'
> with params
> ["/files/etc/sysconfig/network-scripts/ifcfg-bond0/BONDING_OPTS",
> "mode=0 miimon=100"]

The issue looks to be here, as it's missing the second set of quotes.
Are you sure the log output corresponds to the manifest? The manifest
looks correct, while the log output looks broken.

Running your manifest myself in 2.7.x, I see:

debug: Augeas[eth_bond_bond0](provider=augeas): sending command 'set'
with params
["/files/etc/sysconfig/network-scripts/ifcfg-bond0/BONDING_OPTS",
"\"mode=1 miimon=100\""]

Note the extra quotes.

> I also can't seem to get that value saved using augtool either, here's
> what I get
...
> augtool> set
> /files/etc/sysconfig/network-scripts/ifcfg-bond0/BONDING_OPTS '\"mode=0
> miimon=100\"'
> augtool> save
> error: Failed to execute command
> error: saving failed (run 'print /augeas//error' for details)

The issue here is a little different, remove the \ before ". The reason
you need this in Puppet is because you're quoting the entire string in
the Puppet DSL, so need to escape the inner quotes.

augtool> set
/files/etc/sysconfig/network-scripts/ifcfg-bond0/BONDING_OPTS '"mode=0
miimon=100"'
augtool> save
Saved 1 file(s)

Cheers,

--
Dominic Cleal
Red Hat Consulting
m: +44 (0)7817 878113
Reply all
Reply to author
Forward
0 new messages