FAQ
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

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/uI3T5XevDgsJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Christopher Wood at Jun 23, 2012 at 10:34 pm
    netmark?
    On Sat, Jun 23, 2012 at 02:37:04PM -0700, treydock wrote:

    "set NETMARK ${netmask}",
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Treydock at Jun 23, 2012 at 10:39 pm
    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
    On Saturday, June 23, 2012 5:34:53 PM UTC-5, Christopher Wood wrote:

    netmark?
    On Sat, Jun 23, 2012 at 02:37:04PM -0700, treydock wrote:

    "set NETMARK ${netmask}",
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/XFL2rqUwCNAJ.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Dominic Cleal at Jun 28, 2012 at 4:18 pm
    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

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To post to this group, send email to puppet-users@googlegroups.com.
    To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJun 23, '12 at 9:37p
activeJun 28, '12 at 4:18p
posts4
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase