Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix the tests - OHAI data needed to be reloaded. Add a note to the RE…
…ADME saying as much
  • Loading branch information
markolson committed Aug 29, 2013
1 parent 3b55041 commit 7253f81
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Berksfile.lock
Expand Up @@ -11,6 +11,9 @@
},
"chef_handler": {
"locked_version": "1.1.4"
},
"ohai": {
"locked_version": "1.0.2"
}
}
}
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion providers/known_hosts.rb
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion test/cookbooks/ssh_test/metadata.rb
Expand Up @@ -7,4 +7,5 @@
version '0.1.0'


depends 'ssh'
depends 'ssh'
depends 'ohai'
6 changes: 5 additions & 1 deletion test/cookbooks/ssh_test/recipes/default.rb
Expand Up @@ -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
Expand Down

0 comments on commit 7253f81

Please sign in to comment.