- From: Motiejus Jakštys <
>
- To:
- Subject: [chef] Re: Re: cookbook sequentiality and variables
- Date: Thu, 12 Apr 2012 09:10:15 +0300
On Wed, Apr 11, 2012 at 06:16:18PM -0400, Jay Feldblum wrote:
>
Motiejus,
>
>
Resources that you create during the compilation phase to be executed by
>
the system later during the convergence phase are *unique* by their types
>
and names.
>
>
You created a resource of type execute with name "delete password". The
>
next time you call execute "delete password", it doesn't make a new
>
resource. Instead, it finds the resource with that type and name, and
>
reopens it so you can change resource attributes and add only-if/not-if
>
blocks and add actions. In the end, there is only one resource of type
>
execute with name "delete password".
I looked for a way to execute a query without creating a resource, but didn't
find one. I looked at apt and chef-client cookbooks for an example and tried
to
google for it. All "executions" are handled when creating an "execute" named
block.
OK, clearer, thanks. So once string is evaluated in the resource, it will stay
like this.
This is what I came up with:
execute "delete password for " + u['id'] do
command "passwd -d #{u['id']}"
only_if "test $(passwd -S #{u['id']} | awk '{print $2}') = L"
end
I don't like it. Is there a better way to do it, or is it the way to do it?
Jay, thanks for your explanations. :) A tutorial or higher-level documentation
would be useful here, so I wouldn't ask those kind of basic questions. We'll
see what I can do about it when I learn chef.
Motiejus
Archive powered by MHonArc 2.6.16.