On Friday 26 Feb 2010 09:37:28 Alan Barrett wrote:
> On Thu, 25 Feb 2010, Marcello de Sousa wrote:
> > "IF homedir exists => deploy .ssh/authorized_keys , else do nothing"
>
> If you don't mind errors when you attempt to apply the manifest and the
> homedir does not exist, then you could make the authorized_keys file
> depend on something that fails if the homedir does not exist.
>
> Here's an untested example:
>
> # If the directory exists, then the "unless" clause in the exec
> # is satisfied, so the "command" does not run; but the overall
> # exec resource behaves as if it was successful, and anything that
> # requires this exec is happy.
> #
> # If the directory does not exist, then the "unless" fails, so the
> # "command" runs; but the command is "/bin/false", so the command
> # reports a failure, the overall exec resource fails, and anything
> # that requires this exec will have a failed dependency and will
> # therefore not be evaluated.
> #
> exec { "fail if $homedir does not exist":
> command => "/bin/false",
> unless => "/usr/bin/test -d $homedir",
> }
>
> file { "$homedir/.ssh/authorized_keys":
> source => "puppet:///wherever",
> require => Exec["fail if $homedir does not exist"],
> }
>
> --apb (Alan Barrett)
>
That's what I'm doing now. Generally it is sufficient to declare a file
resource
for ${home}/.ssh and depend on it. It will fail if ${home} doesn't exist.
Still, it would be nice to have something better, or at least be able to tell
puppet to ignore errors from this resource/scope.
--
Michael Gliwinski
Henderson Group Information Services
9-11 Hightown Avenue, Newtownabby, BT36 4RT
Phone: 028 9034 3319
**********************************************************************************************
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee and access to the email by anyone else
is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or
any action taken or omitted to be taken in reliance on it, is prohibited and
may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail
are subject to the terms and conditions expressed in the governing client
engagement leter or contract.
If you have received this email in error please notify
[email protected]
John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland,
BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*********************************************************************************
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.