Skip to content

Instantly share code, notes, and snippets.

@theozaurus
Created May 16, 2011 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theozaurus/974256 to your computer and use it in GitHub Desktop.
Save theozaurus/974256 to your computer and use it in GitHub Desktop.
define :ssh_key, :key => nil, :sort => "private", :user => "root" do
unless node[:etc][:passwd].has_key?(params[:user])
# Need to reload ohai if we can't find the user
ruby_block "reload_ohai" do
block do
o = Ohai::System.new
o.all_plugins
node.automatic_attrs.merge! o.data
end
end
end
# Fails here because the user does not exist, because the user resource has not been executed
user_home = node[:etc][:passwd][params[:user]][:dir]
user_group = node[:etc][:passwd][params[:user]][:gid]
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment