mcollective_additions/plugins/v2.2/agent/ssh_agent.rb in dtk-node-agent-0.7.0 vs mcollective_additions/plugins/v2.2/agent/ssh_agent.rb in dtk-node-agent-0.7.1

- old
+ new

@@ -77,10 +77,14 @@ def does_user_exist?(system_user) !File.open('/etc/passwd').grep(/^#{system_user}:/).empty? end def key_added?(system_user, pub_key) - results = `more /home/#{system_user}/.ssh/#{SSH_AUTH_KEYS_FILE_NAME} | grep #{pub_key}` + if system_user == "root" + results = `more /#{system_user}/.ssh/#{SSH_AUTH_KEYS_FILE_NAME} | grep #{pub_key}` + else + results = `more /home/#{system_user}/.ssh/#{SSH_AUTH_KEYS_FILE_NAME} | grep #{pub_key}` + end !results.empty? end def normalize_rsa_pub_key(rsa_pub_key) rsa_pub_key.strip!()