- From: Bryan McLellan <
>
- To:
- Subject: [chef] Re: Reloading ohai during compilation?
- Date: Mon, 16 Sep 2013 23:31:10 -0400
The error you included doesn't seem to match the example resource you
provided, but I think I can gather what you're trying to do. There's a
number of tricks required here.
1) Tell Ruby to close the passwd file so ohai can pick up your changes
2) Reload the ohai etc plugin after the creation of the user
3) Use the delayed attribute evaluation (lazy) so we don't evaluate
the attribute before it exists (CHEF-3731)
Note if you're dealing with LDAP or modifying nsswitch.conf for
anything, you've got another problem, and it's name is glibc
(CHEF-3780).
user "btm-test" do
supports :manage_home => true
home "/home/btm-test"
end
ruby_block "close the passwd file in Ruby" do
block do
Etc.endpwent
end
end
ohai "reload passwd plugin" do
action :reload
plugin "passwd"
end
file "foo-btm" do
path lazy { "#{node['etc']['passwd']['btm-test']['dir']}/foo" }
content "words words words"
end
--
Bryan McLellan | opscode | technical program manager, open source
(c) 206.607.7108 | (t) @btmspox | (b)
http://blog.loftninjas.org
Archive powered by MHonArc 2.6.16.