Skip to content

Commit

Permalink
Fix case in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
chr4 committed Aug 18, 2014
1 parent bb440b5 commit 0274e0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
12 changes: 6 additions & 6 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

# the package to install
# The package to install
default['sshd']['package'] = case platform
when 'archlinux'
'openssh'
else
'openssh-server'
end

# path to 'sshd_config' configuration file
# Path to 'sshd_config' configuration file
default['sshd']['config_file'] = case platform_family
when 'mac_os_x'
'/etc/sshd_config'
else
'/etc/ssh/sshd_config'
end

# sshd service name
# OpenSSH service name
default['sshd']['service_name'] = case platform_family
when 'debian'
'ssh'
else
'sshd'
end

# define sshd_config attributes
# Define sshd_config attributes
default['sshd']['sshd_config'] = {
'Port' => 22,
'Protocol' => 2,
Expand All @@ -59,7 +59,7 @@
'GSSAPIAuthentication' => 'no'
}

# initialize sftp subsystem
# Initialize sftp subsystem
default['sshd']['sshd_config']['Subsystem'] = case platform_family
when 'debian'
'sftp /usr/lib/openssh/sftp-server'
Expand All @@ -71,7 +71,7 @@

case platform_family
when 'debian'
# on debian-like systems, pam takes care of the motd
# On debian-like systems, pam takes care of the motd
default['sshd']['sshd_config']['PrintMotd'] = 'no'

when 'rhel', 'fedora'
Expand Down
13 changes: 6 additions & 7 deletions libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ def generate_sshd_config(config)
sshd_config = ''
conditional_blocks = ''

# generate the configuration file
# sort the hash, so chef doesn't restart if nothing changed but the order
# Generate the configuration file.
# Sort the hash, so Chef doesn't restart if nothing changed but the order
config.sort.each do |e|
key, value = e[0], e[1]

# hashes are conditional blocks
# which have to be placed at the end of the file
# Hashes are conditional blocks, which have to be placed at the end of the file
if value.is_a? Hash
value.sort.each do |se|
k, v = se[0], se[1]
Expand All @@ -40,19 +39,19 @@ def generate_sshd_config(config)

else
Array(value).each do |v|
# if HostKey is not present, don't set it
# If HostKey is not present, don't set it
next unless File.exist?(v) if key == 'HostKey'

sshd_config << "#{key} #{v}\n"
end
end
end

# append conditional blocks
# Append conditional blocks
sshd_config << conditional_blocks
end

# merge d (defaults) with new hash (n)
# Merge d (defaults) with new hash (n)
def merge_settings(d, n)
r = d.to_hash
n.each { |k, v| r[k.to_s] = v }
Expand Down

0 comments on commit 0274e0c

Please sign in to comment.