- From: Motiejus Jakštys <
>
- To:
- Subject: [chef] :delayed command invocation
- Date: Tue, 10 Apr 2012 17:55:16 +0300
Hi List,
this was asked in IRC, nothing there, trying here now.
Consider the following extract from the recipe:
search(:users, 'groups:sysadmin') do |u|
execute "delete password" do
command "passwd -d #{u['id']}"
only_if { "test $(passwd -S #{u['id']} | awk '{print $2}') = L" }
end
user u['id'] do
uid u['uid']
...
notifies :run, "execute[delete password]", :delayed
end
end
I want to run "passwd -d username" *after* the user is created.
However, this is what happens:
[Tue, 10 Apr 2012 14:55:39 +0100] INFO: Processing execute[delete password]
action run (users::sysadmins line 41)
[Tue, 10 Apr 2012 14:55:39 +0100] INFO: execute[delete password] sh(passwd -d
motiejus)
passwd: password expiry information changed.
[Tue, 10 Apr 2012 14:55:39 +0100] INFO: execute[delete password] ran
successfully
[Tue, 10 Apr 2012 14:55:39 +0100] INFO: Processing user[motiejus] action
create
(users::sysadmins line 47)
I suspect this happens because user do end block is added to :delayed
execution
queue once it's finished.. [delete password] is added before that. Any way to
work this around? Or should I write the recipe entirely differently? I am very
open to suggestions.
Thanks,
Motiejus
- [chef] :delayed command invocation, Motiejus Jakštys, 04/10/2012
Archive powered by MHonArc 2.6.16.