From 0cbe4bfd8e9d66915558673de7f7c72436baeb0c Mon Sep 17 00:00:00 2001 From: Andrey Nikitin Date: Mon, 21 Mar 2016 11:20:27 +0300 Subject: [PATCH] Order of the classes parameters is refactored Order and intendation of those parameters are changed to follow Puppet Style Guide recommendation [0]. Moreover, it will allow to an user to find much faster a variable in a list of variables. [0]. https://docs.puppetlabs.com/guides/style_guide.html Change-Id: Icbf7252eae21f413290fcc80384ed3b71086bffa --- manifests/init.pp | 34 ++++++++++++++-------------- manifests/lb.pp | 56 +++++++++++++++++++++++------------------------ manifests/ssh.pp | 14 ++++++------ 3 files changed, 52 insertions(+), 52 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index e530bda..fd5d6b4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -15,24 +15,24 @@ # Class: cgit # class cgit( - $vhost_name = $::fqdn, - $serveradmin = "webmaster@${::fqdn}", - $serveraliases = undef, - $cgitdir = '/var/www/cgit', - $staticfiles = '/var/www/cgit/static', - $ssl_cert_file = undef, - $ssl_key_file = undef, - $ssl_chain_file = undef, - $ssl_cert_file_contents = undef, # If left undefined puppet will not create file. - $ssl_key_file_contents = undef, # If left undefined puppet will not create file. + $behind_proxy = false, + $cgit_timeout = false, + $cgitdir = '/var/www/cgit', + $cgitrc_settings = {}, + $manage_cgitrc = false, + $mpm_settings = {}, # override the mpm worker settings + $prefork_settings = {}, # override the prefork worker settings + $selinux_mode = 'enforcing', + $serveradmin = "webmaster@${::fqdn}", + $serveraliases = undef, + $ssl_cert_file = undef, + $ssl_cert_file_contents = undef, # If left undefined puppet will not create file. + $ssl_chain_file = undef, $ssl_chain_file_contents = undef, # If left undefined puppet will not create file. - $behind_proxy = false, - $cgit_timeout = false, - $manage_cgitrc = false, - $prefork_settings = {}, # override the prefork worker settings - $mpm_settings = {}, # override the mpm worker settings - $cgitrc_settings = {}, - $selinux_mode = 'enforcing' + $ssl_key_file = undef, + $ssl_key_file_contents = undef, # If left undefined puppet will not create file. + $staticfiles = '/var/www/cgit/static', + $vhost_name = $::fqdn, ) { validate_hash($prefork_settings) validate_hash($mpm_settings) diff --git a/manifests/lb.pp b/manifests/lb.pp index 80f42be..59ea806 100644 --- a/manifests/lb.pp +++ b/manifests/lb.pp @@ -15,22 +15,12 @@ # Class: cgit::lb # class cgit::lb ( - $balancer_member_names = [], - $balancer_member_ips = [], - $balancer_member_http_ports = ['8080',], + $balancer_member_git_ports = ['29418',], + $balancer_member_http_ports = ['8080',], $balancer_member_https_ports = ['4443',], - $balancer_member_git_ports = ['29418',], - $global_options = { - 'log' => '127.0.0.1 local0', - 'chroot' => '/var/lib/haproxy', - 'pidfile' => '/var/run/haproxy.pid', - 'maxconn' => '4000', - 'user' => 'haproxy', - 'group' => 'haproxy', - 'daemon' => '', - 'stats' => 'socket /var/lib/haproxy/stats user root group root mode 0600 level admin' - }, - $defaults_options = { + $balancer_member_ips = [], + $balancer_member_names = [], + $defaults_options = { 'log' => 'global', 'stats' => 'enable', 'option' => 'redispatch', @@ -45,19 +35,7 @@ class cgit::lb ( ], 'maxconn' => '8000', }, - $http_options = { - 'balance' => 'leastconn', - 'option' => [ - 'tcplog', - ], - }, - $https_options = { - 'balance' => 'leastconn', - 'option' => [ - 'tcplog', - ], - }, - $git_options = { + $git_options = { 'maxconn' => '256', 'backlog' => '256', 'balance' => 'leastconn', @@ -65,6 +43,28 @@ class cgit::lb ( 'tcplog', ], }, + $global_options = { + 'log' => '127.0.0.1 local0', + 'chroot' => '/var/lib/haproxy', + 'pidfile' => '/var/run/haproxy.pid', + 'maxconn' => '4000', + 'user' => 'haproxy', + 'group' => 'haproxy', + 'daemon' => '', + 'stats' => 'socket /var/lib/haproxy/stats user root group root mode 0600 level admin' + }, + $http_options = { + 'balance' => 'leastconn', + 'option' => [ + 'tcplog', + ], + }, + $https_options = { + 'balance' => 'leastconn', + 'option' => [ + 'tcplog', + ], + }, ) { package { 'socat': diff --git a/manifests/ssh.pp b/manifests/ssh.pp index 4946f61..6b88708 100644 --- a/manifests/ssh.pp +++ b/manifests/ssh.pp @@ -35,14 +35,14 @@ # Array with the list of keys that will be used for authorizing git # clones over ssh class cgit::ssh ( - $user = 'git', - $group = 'git', - $manage_group = true, - $home = '/var/lib/git', - $manage_home = true, - $target = undef, - $target_name = 'repo', $authorized_keys = [], + $group = 'git', + $home = '/var/lib/git', + $manage_group = true, + $manage_home = true, + $target = undef, + $target_name = 'repo', + $user = 'git', ) { if $manage_home {