augeas onlyif match for service name

asked 2015-11-19 06:12:00 -0600

Chutki gravatar image


I am testing below manifests in different environments but I want to sort it out by service name "onlyif => "match service-name[servicename'] size == 0"rather than using "onlyif => "match service-name[port = '$port'] size == 0"

augeas {'test':
      lens    => 'services.lns',
      incl    => '/etc/services',
      changes => ["insert service-name after service-name[last()]",
                "set service-name[last()] testenv",
                "set service-name[.='testenv']/port $port",
                "set service-name[.='testenv']/protocol tcp",
                "set service-name[.='testenv']/#comment 'port'"],
      onlyif  => "match service-name[port = '$port'] size == 0"

Because the service name varies in each environment and is it possible in puppet.

edit retag flag offensive close merge delete