From 3547fdcd8bc04560cca57ed01c35a0831b03abf5 Mon Sep 17 00:00:00 2001 From: Marco Wessel Date: Sun, 2 Mar 2014 01:35:22 +0100 Subject: [PATCH 1/3] make package 'ensure' variable, with 'present' as default --- manifests/client.pp | 3 ++- manifests/client/install.pp | 6 ++++-- manifests/server.pp | 3 ++- manifests/server/install.pp | 6 ++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 1a18d1bd2..dab88b46a 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -1,5 +1,6 @@ class ssh::client( - $options = {} + $options = {}, + $ensure = present, ) inherits ssh::params { $merged_options = merge($ssh::params::ssh_default_options, $options) diff --git a/manifests/client/install.pp b/manifests/client/install.pp index 008a040b0..6429f1563 100644 --- a/manifests/client/install.pp +++ b/manifests/client/install.pp @@ -1,7 +1,9 @@ -class ssh::client::install { +class ssh::client::install ( + $ensure = present +) { if !defined(Package[$ssh::params::client_package_name]) { package { $ssh::params::client_package_name: - ensure => present, + ensure => $ensure, } } } diff --git a/manifests/server.pp b/manifests/server.pp index 65ca278a7..37d87cd66 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -1,5 +1,6 @@ class ssh::server( - $options = {} + $options = {}, + $ensure = present ) inherits ssh::params { $merged_options = merge($ssh::params::sshd_default_options, $options) diff --git a/manifests/server/install.pp b/manifests/server/install.pp index e2d6669e2..a4c725e75 100644 --- a/manifests/server/install.pp +++ b/manifests/server/install.pp @@ -1,8 +1,10 @@ -class ssh::server::install { +class ssh::server::install ( + $ensure = present +) { include ssh::params if !defined(Package[$ssh::params::server_package_name]) { package { $ssh::params::server_package_name: - ensure => present, + ensure => $ensure, } } } From 883f15be7e08bbec2f6cbef1b1d517181b5f1f9c Mon Sep 17 00:00:00 2001 From: Marco Wessel Date: Sun, 2 Mar 2014 03:10:46 +0100 Subject: [PATCH 2/3] sort hashes to prevent shuffling and restarting ssh unnecessarily --- templates/ssh_config.erb | 4 ++-- templates/sshd_config.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/ssh_config.erb b/templates/ssh_config.erb index cf4703bc0..9bb8bc69a 100644 --- a/templates/ssh_config.erb +++ b/templates/ssh_config.erb @@ -1,9 +1,9 @@ # File managed by Puppet -<%- scope.lookupvar('ssh::client::merged_options').each do |k, v| -%> +<%- scope.lookupvar('ssh::client::merged_options').sort.each do |k, v| -%> <%- if v.is_a?(Hash) -%> <%= k %> -<%- v.each do |key, value| -%> +<%- v.sort.each do |key, value| -%> <%- if value.is_a?(Array) -%> <%- value.each do |a| -%> <%= key %> <%= a %> diff --git a/templates/sshd_config.erb b/templates/sshd_config.erb index 1fcd20944..b1adfbee6 100644 --- a/templates/sshd_config.erb +++ b/templates/sshd_config.erb @@ -1,9 +1,9 @@ # File is managed by Puppet -<%- scope.lookupvar('ssh::server::merged_options').each do |k, v| -%> +<%- scope.lookupvar('ssh::server::merged_options').sort.each do |k, v| -%> <%- if v.is_a?(Hash) -%> <%= k %> -<%- v.each do |key, value| -%> +<%- v.sort.each do |key, value| -%> <%- if value.is_a?(Array) -%> <%- value.each do |a| -%> <%= key %> <%= a %> From b224323f7135e862c36ec6663e6af122bff016d8 Mon Sep 17 00:00:00 2001 From: Marco Wessel Date: Sun, 2 Mar 2014 14:57:58 +0100 Subject: [PATCH 3/3] change parameter order --- manifests/client.pp | 2 +- manifests/server.pp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index dab88b46a..7cd2458f3 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -1,6 +1,6 @@ class ssh::client( - $options = {}, $ensure = present, + $options = {} ) inherits ssh::params { $merged_options = merge($ssh::params::ssh_default_options, $options) diff --git a/manifests/server.pp b/manifests/server.pp index 37d87cd66..30da5101a 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -1,6 +1,6 @@ class ssh::server( - $options = {}, - $ensure = present + $ensure = present, + $options = {} ) inherits ssh::params { $merged_options = merge($ssh::params::sshd_default_options, $options)