FAQ
Hi.

I am having a few problems with augeas and need some help.

What I am trying to use is augeas to update the cron.allow file. I can get augeas to add the required name but I am having problems with getting it to add the name once.

augeas { "check_mk_cron.allow" :
context => "/files/etc/cron.allow",
# changes => "set line[last()+1] $name",
changes => "set 1[last()+1] $name",
# onlyif => "match /files/etc/cron.allow/* include ALL",
onlyif => "match *[.='$name'] not_include $name",
# onlyif => "get 1[.='ALL'] == ALL",
}

The line ' changes => "set 1[last()+1] $name",' works like a charm but I am unable to get any onlyif to work.

If I use the onlyif in augtool I get this output, if this helps.

augtool> match /files/etc/cron.allow/*[.='ALL']
/files/etc/cron.allow/4 = ALL

Cheers
Mark



________________________________
This email has been sent from Gala Coral Group Limited ("GCG") or a subsidiary or associated company. GCG is registered in England with company number 07254686. Registered office address: 71 Queensway, London W2 4QH, United Kingdom; website: www.galacoral.com.

This e-mail message (and any attachments) is confidential and may contain privileged and/or proprietorial information protected by legal rules. It is for use by the intended addressee only. If you believe you are not the intended recipient or that the sender is not authorised to send you the email, please return it to the sender (and please copy it to hq@galacoral.com) and then delete it from your computer. You should not otherwise copy or disclose its contents to anyone.

Except where this email is sent in the usual course of business, the views expressed are those of the sender and not necessarily ours. We reserve the right to monitor all emails sent to and from our businesses, to protect the businesses and to ensure compliance with internal policies.

Emails are not secure and cannot be guaranteed to be error-free, as they can be intercepted, amended, lost or destroyed, and may contain viruses; anyone who communicates with us by email is taken to accept these risks. GCG accepts no liability for any loss or damage which may be caused by software viruses.

--
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.

Search Discussions

  • Dominic Cleal at Aug 29, 2012 at 5:13 pm

    On 29/08/12 15:57, Greenhalgh, Mark wrote:
    I am having a few problems with augeas and need some help.

    What I am trying to use is augeas to update the cron.allow file. I can
    get augeas to add the required name but I am having problems with
    getting it to add the name once.

    augeas { "check_mk_cron.allow" :
    context => "/files/etc/cron.allow",
    # changes => "set line[last()+1] $name",
    changes => "set 1[last()+1] $name",
    # onlyif => "match /files/etc/cron.allow/* include ALL",
    onlyif => "match *[.='$name'] not_include $name",
    # onlyif => "get 1[.='ALL'] == ALL",
    }

    The line ' changes => "set 1[last()+1] $name",' works like a charm but I
    am unable to get any onlyif to work.
    The onlyif line is a bit magical as there's a mini-DSL inside the
    provider. My preferred syntax is this:

    onlyif => "match <expression> size == 0",

    So in your case this will work:

    augeas { "check_mk_cron.allow" :
    context => "/files/etc/cron.allow",
    changes => "set 1[last()+1] $name",
    onlyif => "match *[.='${name}'] size == 0",
    }

    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
postedAug 29, '12 at 3:02p
activeAug 29, '12 at 5:13p
posts2
users2
websitepuppetlabs.com

2 users in discussion

Greenhalgh, Mark: 1 post Dominic Cleal: 1 post

People

Translate

site design / logo © 2022 Grokbase