Hi,

you probably already tested this already, but how about:

onlyif => "match *[spec = \"${fs_dev}\"] size == 0"

Regards,

k
**
**


On Tue, Jul 30, 2013 at 3:54 PM, Sneha More <snehamore...@gmail.com> wrote:

> Hi,
>  The solution which i have given you is nothing but the another form of
> what you have done.
>  So i think in your case this will not work either.
>  The problem is not with your logic of onlyif condition, its syntactical
> problem.
>  I found following things while solving your problem:
> If i use the condition
> 1. onlyif => "match */spec[. = proc] size == 0"
>  It will insert the line with spec = proc every time in puppet run.
> 2. if i use the condition:
> onlyif => "match */spec[. = 'proc'] size == 0"
> It will insert only once.
>
> So answer to your query is --> your varible must be in '' (single inverted
> comma)
> Now try this:
> *onlyif => "match */spec[. = '$fs_dev'] size == 0"
> *
> This will definitely work.
> Sorry for creating confusion in previous reply.
>
> Regards,
> Sneha More,
> NTT DATA GTS,
> Pune. (OSS Center)
>
>
> On Tue, Jul 30, 2013 at 6:28 PM, Sneha More <snehamore...@gmail.com>wrote:
>
>> On Tuesday, July 30, 2013 2:56:59 AM UTC+5:30, haral...@gmail.com wrote:
>>>
>>> Hi,
>>>
>>> I am trying to define a new type that will insert a new filesystem line
>>> into /etc/fstab.
>>>
>>> However, no matter what I tried, it will insert a new line each time.
>>>
>>> Something like this doesn't work
>>>
>>> augeas { $title:
>>>                 context => '/files/etc/fstab',
>>>                 changes => [
>>>                         "set 01/spec     $fs_dev",
>>>                         "set 01/file     $fs_mount",
>>>                         "set 01/vfstype  $fs_type",
>>>                         "set 01/opt      $fs_opts",
>>>                         "set 01/dump     $fs_dump",
>>>                         "set 01/passno   $fs_fsck",
>>>                         "set 01/#comment $fs_comment",
>>>                 ],
>>>                 onlyif => "match */spec[. = $fs_dev] size == 0"    #
>>> also tried "match *[spec] not_include $fs_dev"
>>> }
>>>
>>> The "not_include" option doesn't seem to work either ... or maybe I
>>> din't know how to use it (very few examples around to say the least)
>>>
>>> unless is not available with augeas (I believe)
>>>
>>> Any suggestions ?
>>>
>>> (I already know about the available fstab module but I want to
>>> understand what is going on here)
>>>
>>> Many thanks.
>>>
>>> Cheers.
>>>
>>
>> Hi,
>>   Here your onlyif condition is the cause of  inserting a new line each
>> time.
>>   you can try this:
>>
>>   *onlyif => "match*[spec=$fs_dev] size == 0"*
>>
>>  This will match your $fs_dev and will not insert it second time.
>>
>> Regards,
>> Sneha More,
>> NTT DATA GTS,
>> Pune. (OSS Center)
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Puppet Users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/puppet-users/m9LZ-gKvLZ8/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> puppet-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to puppet-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/puppet-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to