Skip to content

Commit

Permalink
Strings in preference to symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
nickola committed Feb 20, 2015
1 parent 03e92d1 commit bef87d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
default[:ssh_keys_keep_existing] = true
default[:ssh_keys_skip_missing_home] = false
default[:ssh_keys_create_missing_home] = false
default[:ssh_keys_use_encrypted_data_bag] = false
default['ssh_keys_keep_existing'] = true
default['ssh_keys_skip_missing_home'] = false
default['ssh_keys_create_missing_home'] = false
default['ssh_keys_use_encrypted_data_bag'] = false
12 changes: 6 additions & 6 deletions recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if node[:ssh_keys]
node[:ssh_keys].each do |node_user, bag_users|
if node['ssh_keys']
node['ssh_keys'].each do |node_user, bag_users|
next unless node_user
next unless bag_users

Expand All @@ -23,7 +23,7 @@
end

Array(bag_users_list).each do |bag_user|
data = node[:ssh_keys_use_encrypted_data_bag] ?
data = node['ssh_keys_use_encrypted_data_bag'] ?
Chef::EncryptedDataBagItem.load('users', bag_user) :
data_bag_item('users', bag_user)

Expand All @@ -44,13 +44,13 @@
if ssh_keys.length > 0
home_dir = user['dir']

if node[:ssh_keys_skip_missing_home] and not File.exists?(home_dir)
if node['ssh_keys_skip_missing_home'] and not File.exists?(home_dir)
next
end

authorized_keys_file = "#{home_dir}/.ssh/authorized_keys"

if node[:ssh_keys_keep_existing] && File.exist?(authorized_keys_file)
if node['ssh_keys_keep_existing'] && File.exist?(authorized_keys_file)
Chef::Log.info("Keep authorized keys from: #{authorized_keys_file}")

# Loading existing keys
Expand All @@ -63,7 +63,7 @@
ssh_keys.uniq!
else
# Creating ".ssh" directory
if node[:ssh_keys_create_missing_home]
if node['ssh_keys_create_missing_home']
directory "#{home_dir}/.ssh" do
owner user['uid']
group user['gid'] || user['uid']
Expand Down

0 comments on commit bef87d0

Please sign in to comment.