Browse files

Fix the tests - OHAI data needed to be reloaded. Add a note to the RE…

…ADME saying as much
  • Loading branch information...
1 parent 3b55041 commit 7253f81cdb1c2ea81a43d65cf35920d70eebc78f @markolson committed Aug 29, 2013
Showing with 18 additions and 4 deletions.
  1. +3 −0 Berksfile.lock
  2. +7 −1 README.md
  3. +1 −1 providers/known_hosts.rb
  4. +2 −1 test/cookbooks/ssh_test/metadata.rb
  5. +5 −1 test/cookbooks/ssh_test/recipes/default.rb
View
3 Berksfile.lock
@@ -11,6 +11,9 @@
},
"chef_handler": {
"locked_version": "1.1.4"
+ },
+ "ohai": {
+ "locked_version": "1.0.2"
}
}
}
View
8 README.md
@@ -6,7 +6,13 @@ Provides 2 LWRPs to manage system-wide and per-user `ssh_config` and `known_host
## Usage
-When using SSH with Chef deployments, it's crucial to not get any prompts for input. Adding entries to `known_hosts` files and better managing your per-connection configuration can help with this.
+When using SSH with Chef deployments, it's crucial to not get any prompts for input. Adding entries to `known_hosts` files and better managing your per-connection configuration can help with this.
+
+An important thing to note is that if you create a user during a chef run, be sure to reload OHAI data so that the new user will be in the node data. For instance:
+
+ ohai "reload_passwd" do
+ plugin "passwd"
+ end
## Resources and Providers
View
2 providers/known_hosts.rb
@@ -18,7 +18,7 @@
user ssh_user
end
- log "An entry for #{new_resource.host} already exists in #{known_hosts_path}." do
+ Chef::Log.debug "An entry for #{new_resource.host} already exists in #{known_hosts_path}." do
only_if "ssh-keygen -H -F #{Shellwords.escape(new_resource.host)} -f #{known_hosts_path} | grep 'Host #{new_resource.host} found'"
end
end
View
3 test/cookbooks/ssh_test/metadata.rb
@@ -7,4 +7,5 @@
version '0.1.0'
-depends 'ssh'
+depends 'ssh'
+depends 'ohai'
View
6 test/cookbooks/ssh_test/recipes/default.rb
@@ -20,15 +20,19 @@
user 'vagrant'
end
+ohai "reload_passwd" do
+ action :nothing
+ plugin "passwd"
+end
user "faked" do
comment "Not A Real Person"
uid 1000
- gid "users"
system true
home "/tmp/bitty"
shell "/bin/zsh"
password "weeeeeeeeeeeee"
+ notifies :reload, "ohai[reload_passwd]", :immediately
end
ssh_known_hosts "github.com" do

0 comments on commit 7253f81

Please sign in to comment.