Jorge, :
the other way you specified does the same as:
File { " /etc/puppet/test":
ensure => "directory",
}
This will also create a directory if it does not exist.
Satish:
There must be some reason for which you are checking presence of directory.
So you can add unless condition with exec resource as specified by Jorge to
execute something if the the directory is present or not
Thanks and Regards,
Sneha More
On Wednesday, August 20, 2014 1:19:55 AM UTC+5:30, Flamarion Jorge wrote:
>
> Ok. I'm sorry. Here other way.
>
> exec { "create dir":
> ....
> command => 'mkdir -p /etc/puppet/test'
> unless => 'test -d /etc/puppet/test'
> ......
> }
>
> Now your directory will be created if it doesn't exist.
>
> Flamarion Jorge
> Sent from my mobile
> Em 19/08/2014 15:02, "Yanis Guenane" <[email protected] <javascript:>>
> escreveu:
>
>> Jorge,
>>
>> This is wrong. unless is not a parameter of the file resource
>>
>> https://docs.puppetlabs.com/references/latest/type.html#file
>>
>> unless applies only to the exec resource.
>>
>> --
>> Yanis Guenane
>>
>> On 08/18/2014 05:21 PM, Flamarion Jorge wrote:
>> > File { " /etc/puppet/test":
>> > ensure => "directory",
>> > unless => 'test -d /etc/puppet/test'
>> > }
>> >
>> > Flamarion Jorge
>> > Sent from my mobile
>> > Em 18/08/2014 09:05, "Satish Katuru" <[email protected] <javascript:>>
>> escreveu:
>> >
>> > Hi ,
>> >
>> > I wanted to find out whether the directory exists or not in the
>> machine.How
>> > can I do it?
>> >
>> > if I do it as below it will create a directory:
>> >
>> > File { " /etc/puppet/test":
>> > ensure => "directory",
>> >
>> > }
>> >
>> >
>> >
>> > --
>> > 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 [email protected] <javascript:>.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/puppet-users/6f8d03fb-8d97-4832-a3b7-70868132c451%40googlegroups.com
>> > <
>> https://groups.google.com/d/msgid/puppet-users/6f8d03fb-8d97-4832-a3b7-70868132c451%40googlegroups.com?utm_medium=email&utm_source=footer
>> >
>> > .
>> > For more options, visit https://groups.google.com/d/optout.
>> >
>>
>> --
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/puppet-users/53F3912C.50504%40gmail.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/fe796814-04d6-496f-adb4-d6bc66691317%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.