dust-deploy 0.12.2 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/dust +192 -66
- data/changelog.md +37 -0
- data/lib/dust.rb +1 -0
- data/lib/dust/messaging.rb +140 -0
- data/lib/dust/recipe.rb +4 -1
- data/lib/dust/recipes/aliases.rb +5 -5
- data/lib/dust/recipes/apt.rb +4 -4
- data/lib/dust/recipes/cjdroute.rb +32 -35
- data/lib/dust/recipes/cups_client.rb +5 -5
- data/lib/dust/recipes/debsecan.rb +4 -4
- data/lib/dust/recipes/duplicity.rb +13 -15
- data/lib/dust/recipes/etc_hosts.rb +3 -3
- data/lib/dust/recipes/hash_check.rb +5 -6
- data/lib/dust/recipes/iptables.rb +12 -17
- data/lib/dust/recipes/limits.rb +19 -11
- data/lib/dust/recipes/locale.rb +14 -14
- data/lib/dust/recipes/logrotate.rb +3 -3
- data/lib/dust/recipes/make.rb +29 -0
- data/lib/dust/recipes/motd.rb +3 -3
- data/lib/dust/recipes/mysql.rb +5 -5
- data/lib/dust/recipes/newrelic.rb +6 -6
- data/lib/dust/recipes/nginx.rb +10 -10
- data/lib/dust/recipes/ntpd.rb +2 -6
- data/lib/dust/recipes/pacemaker.rb +3 -3
- data/lib/dust/recipes/postgres.rb +22 -22
- data/lib/dust/recipes/rc_local.rb +8 -8
- data/lib/dust/recipes/redis.rb +3 -25
- data/lib/dust/recipes/repositories.rb +28 -30
- data/lib/dust/recipes/resolv_conf.rb +16 -16
- data/lib/dust/recipes/ruby_rvm.rb +17 -18
- data/lib/dust/recipes/skel.rb +1 -2
- data/lib/dust/recipes/ssh_authorized_keys.rb +4 -5
- data/lib/dust/recipes/sshd.rb +1 -1
- data/lib/dust/recipes/sudoers.rb +2 -2
- data/lib/dust/recipes/sysctl.rb +12 -8
- data/lib/dust/recipes/zabbix_agent.rb +28 -28
- data/lib/dust/server.rb +114 -115
- data/lib/dust/version.rb +1 -1
- metadata +4 -2
data/lib/dust/recipes/limits.rb
CHANGED
@@ -9,47 +9,55 @@ class Limits < Recipe
|
|
9
9
|
'sigpending', 'msgqueue', 'nice', 'rtprio', 'chroot' ]
|
10
10
|
|
11
11
|
unless @node.dir_exists? '/etc/security/limits.d'
|
12
|
-
return
|
12
|
+
return @node.messages.add('your system does not support /etc/security/limits.d').failed
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
|
+
clean
|
15
16
|
|
16
17
|
@config.each do |name, rules|
|
17
18
|
limits_conf = ''
|
18
|
-
|
19
|
+
@node.messages.add("assembling system limits according to rule '#{name}'\n")
|
19
20
|
rules.to_array.each do |rule|
|
20
21
|
|
21
22
|
# check if entry is valid
|
22
23
|
unless rule['domain']
|
23
|
-
|
24
|
+
@node.messages.add("domain cannot be empty, skipping", :indent => 2).failed
|
24
25
|
next
|
25
26
|
end
|
26
27
|
|
27
28
|
unless rule['value']
|
28
|
-
|
29
|
+
@node.messages.add("value cannot be empty, skipping", :indent => 2).failed
|
29
30
|
next
|
30
31
|
end
|
31
32
|
|
32
33
|
unless items.include? rule['item']
|
33
|
-
|
34
|
+
@node.messages.add("'#{rule['item']}' is not a valid item, skipping. valid items: #{items.join(',')}", :indent => 2).failed
|
34
35
|
next
|
35
36
|
end
|
36
37
|
|
37
38
|
unless types.include? rule['type']
|
38
|
-
|
39
|
+
@node.messages.add("'#{rule['type']}' is not a valid type, skipping. valid types: #{types.join(',')}", :indent => 2).failed
|
39
40
|
next
|
40
41
|
end
|
41
42
|
|
42
43
|
# assemble rule
|
43
44
|
line = "#{rule['domain']}\t#{rule['type']}\t#{rule['item']}\t#{rule['value']}\n"
|
44
|
-
|
45
|
+
@node.messages.add("adding '#{line.chomp}'", :indent => 2).ok
|
45
46
|
limits_conf << line
|
46
47
|
end
|
47
48
|
|
48
49
|
# deploy rule file
|
49
|
-
|
50
|
-
|
51
|
-
puts
|
50
|
+
msg = @node.messages.add("deploying limits to /etc/security/limits.d/#{name}")
|
51
|
+
msg.parse_result(@node.write("/etc/security/limits.d/#{name}", limits_conf, :quiet => true))
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
# removes all files in /etc/security/limits.d
|
59
|
+
def clean
|
60
|
+
msg = @node.messages.add('cleaning all files from /etc/security/limits.d')
|
61
|
+
msg.parse_result(@node.rm('/etc/security/limits.d/*', :quiet => true))
|
62
|
+
end
|
55
63
|
end
|
data/lib/dust/recipes/locale.rb
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
class Locale < Recipe
|
2
2
|
desc 'locale:deploy', 'configures system locale'
|
3
|
-
def deploy
|
3
|
+
def deploy
|
4
4
|
# ubuntu needs a proper language pack
|
5
5
|
language = @config.split('_').first
|
6
6
|
@node.install_package "language-pack-#{language}-base" if @node.is_ubuntu?
|
7
|
-
|
7
|
+
|
8
8
|
if @node.uses_apt?
|
9
|
-
|
9
|
+
msg = @node.messages.add("setting locale to '#{@config}'")
|
10
10
|
@node.write '/etc/default/locale', "LANGUAGE=#{@config}\nLANG=#{@config}\nLC_ALL=#{@config}\nLC_CTYPE=#{@config}\n", :quiet => true
|
11
|
-
|
11
|
+
msg.ok
|
12
12
|
elsif @node.uses_rpm?
|
13
|
-
|
13
|
+
msg = @node.messages.add("setting locale to '#{@config}'")
|
14
14
|
@node.write '/etc/sysconfig/i18n', "LANG=\"#{@config}\"\nLC_ALL=\"#{@config}\"\nSYSFONT=\"latarcyrheb-sun16\"\n", :quiet => true
|
15
|
-
|
15
|
+
msg.ok
|
16
16
|
else
|
17
|
-
|
17
|
+
@node.message.add('os not supported').failed
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
desc 'locale:status', 'shows current locale'
|
22
22
|
def status
|
23
|
-
|
23
|
+
msg = @node.messages.add('getting current locale')
|
24
24
|
|
25
25
|
if @node.uses_apt?
|
26
26
|
ret = @node.exec 'cat /etc/default/locale'
|
27
27
|
elsif @node.uses_rpm?
|
28
28
|
ret = @node.exec 'cat /etc/sysconfig/i18n'
|
29
29
|
else
|
30
|
-
return
|
30
|
+
return msg.failed
|
31
31
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
32
|
+
|
33
|
+
msg.parse_result(ret[:exit_code])
|
34
|
+
msg.print_output(ret)
|
35
|
+
end
|
36
36
|
end
|
@@ -4,10 +4,10 @@ class Logrotate < Recipe
|
|
4
4
|
return unless @node.install_package 'logrotate'
|
5
5
|
|
6
6
|
@config.each do |name, rule|
|
7
|
-
|
7
|
+
@node.messages.add("deploying logrotate entry for '#{name}'\n")
|
8
8
|
|
9
9
|
unless rule['path']
|
10
|
-
|
10
|
+
@node.messages.add('path not specified', :indent => 2).failed
|
11
11
|
next
|
12
12
|
end
|
13
13
|
|
@@ -30,7 +30,7 @@ class Logrotate < Recipe
|
|
30
30
|
|
31
31
|
desc 'logrotate:status', 'displays filenames of installed logrotate rules'
|
32
32
|
def status
|
33
|
-
|
33
|
+
@node.messages.add.print_output(@node.exec('ls /etc/logrotate.d/*'))
|
34
34
|
end
|
35
35
|
|
36
36
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Make < Recipe
|
2
|
+
desc 'make:deploy', 'configure, make, make install'
|
3
|
+
def deploy
|
4
|
+
# install dependencies (defaults, build-essential | make, gcc)
|
5
|
+
@node.install_package 'build-essential'
|
6
|
+
|
7
|
+
# create temporary directory
|
8
|
+
ret = @node.exec 'mktemp -d --tmpdir dust_make.XXXXXXXXX'
|
9
|
+
return ::Dust.print_failed 'error creating temporary directory' if ret[:exit_code] != 0
|
10
|
+
tempdir = ret[:stdout].chomp
|
11
|
+
|
12
|
+
url = 'http://www.securixlive.com/download/barnyard2/barnyard2-1.9.tar.gz'
|
13
|
+
|
14
|
+
if url =~ /\.(tar.gz|tgz)$/
|
15
|
+
elsif url.end_with? '.tar.bz2'
|
16
|
+
elsif url.end_with? '.zip'
|
17
|
+
else
|
18
|
+
end
|
19
|
+
|
20
|
+
# if @config['svn']
|
21
|
+
# if @config['git']
|
22
|
+
|
23
|
+
# get url, svn, git repository
|
24
|
+
# unpack bz2, tgz, zip
|
25
|
+
|
26
|
+
# run commands (default [ './configure --prefix=/usr/local/', 'make', 'make install' ]
|
27
|
+
# symlink
|
28
|
+
end
|
29
|
+
end
|
data/lib/dust/recipes/motd.rb
CHANGED
@@ -6,9 +6,9 @@ class Motd < Recipe
|
|
6
6
|
|
7
7
|
desc 'motd:status', 'shows current message of the day'
|
8
8
|
def status
|
9
|
-
|
9
|
+
msg = @node.messages.add('getting /etc/motd')
|
10
10
|
ret = @node.exec 'cat /etc/motd'
|
11
|
-
|
12
|
-
|
11
|
+
msg.parse_result(ret[:exit_code])
|
12
|
+
msg.print_output(ret)
|
13
13
|
end
|
14
14
|
end
|
data/lib/dust/recipes/mysql.rb
CHANGED
@@ -6,11 +6,11 @@ class Mysql < Recipe
|
|
6
6
|
|
7
7
|
@config = default_config.deep_merge @config
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
@node.messages.add("configuring mysql\n")
|
10
|
+
@node.messages.add("listen on #{@config['mysqld']['bind-address']}:#{@config['mysqld']['port']}", :indent => 2).ok
|
11
11
|
|
12
12
|
@config['mysqld']['innodb_buffer_pool_size'] ||= get_innodb_buffer_pool_size
|
13
|
-
|
13
|
+
@node.messages.add("set innodb buffer pool to '#{@config['mysqld']['innodb_buffer_pool_size']}'", :indent => 2).ok
|
14
14
|
|
15
15
|
@node.write '/etc/mysql/my.cnf', generate_my_cnf
|
16
16
|
|
@@ -78,7 +78,7 @@ class Mysql < Recipe
|
|
78
78
|
# allocate 70% of the available ram to mysql
|
79
79
|
# but leave max 1gb to system
|
80
80
|
unless @config['mysqld']['innodb_buffer_pool_size']
|
81
|
-
|
81
|
+
msg = @node.messages.add('autoconfiguring innodb buffer size', :indent => 2)
|
82
82
|
@node.collect_facts :quiet => true
|
83
83
|
|
84
84
|
# get system memory (in kb)
|
@@ -87,7 +87,7 @@ class Mysql < Recipe
|
|
87
87
|
# allocate 80% of the available ram to mysql
|
88
88
|
buffer_pool = (system_mem * 0.7).to_i
|
89
89
|
|
90
|
-
|
90
|
+
msg.ok
|
91
91
|
"#{buffer_pool / 1024}M"
|
92
92
|
end
|
93
93
|
end
|
@@ -1,21 +1,21 @@
|
|
1
1
|
class Newrelic < Recipe
|
2
2
|
desc 'newrelic:deploy', 'installs and configures newrelic system monitoring'
|
3
|
-
def deploy
|
3
|
+
def deploy
|
4
4
|
return Dust.print_failed 'no key specified' unless @config
|
5
5
|
return unless @node.uses_apt? :quiet=>false
|
6
6
|
|
7
7
|
if @options.restart? or @options.reload?
|
8
|
-
|
9
|
-
|
8
|
+
msg = @node.messages.add('updating repositories')
|
9
|
+
msg.parse_result(@node.exec('aptitude update')[:exit_code])
|
10
10
|
end
|
11
11
|
|
12
12
|
unless @node.install_package 'newrelic-sysmond'
|
13
|
-
|
13
|
+
@node.messages.add('installing newrelic monitoring daemon failed, did you setup the newrelic repositories?').failed
|
14
14
|
return
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
return unless
|
17
|
+
msg = @node.messages.add('configuring new relic server monitoring tool')
|
18
|
+
return unless msg.parse_result(@node.exec("nrsysmond-config --set ssl=true license_key=#{@config}")[:exit_code])
|
19
19
|
|
20
20
|
@node.restart_service 'newrelic-sysmond' if options.restart?
|
21
21
|
end
|
data/lib/dust/recipes/nginx.rb
CHANGED
@@ -7,35 +7,35 @@ class Nginx < Recipe
|
|
7
7
|
@node.deploy_file "#{@template_path}/nginx.conf", '/etc/nginx/nginx.conf'
|
8
8
|
|
9
9
|
# remove old sites that may be present
|
10
|
-
|
10
|
+
msg = @node.messages.add('deleting old sites in /etc/nginx/sites-*')
|
11
11
|
@node.rm '/etc/nginx/sites-*/*', :quiet => true
|
12
|
-
|
12
|
+
msg.ok
|
13
13
|
|
14
14
|
@config.each do |state, sites|
|
15
15
|
sites.to_array.each do |site|
|
16
16
|
@node.deploy_file "#{@template_path}/sites/#{site}", "/etc/nginx/sites-available/#{site}", :binding => binding
|
17
|
-
|
17
|
+
|
18
18
|
# symlink to sites-enabled if this is listed as an enabled site
|
19
19
|
if state == 'sites-enabled'
|
20
|
-
|
21
|
-
|
20
|
+
msg = @node.messages.add("enabling #{site}", :indent => 2)
|
21
|
+
msg.parse_result(@node.exec("cd /etc/nginx/sites-enabled && ln -s ../sites-available/#{site} #{site}")[:exit_code])
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
# check configuration and restart nginx
|
27
|
-
|
27
|
+
msg = @node.messages.add('checking nginx configuration')
|
28
28
|
if @node.exec('/etc/init.d/nginx configtest')[:exit_code] == 0
|
29
|
-
|
29
|
+
msg.ok
|
30
30
|
@node.restart_service('nginx') if options.restart?
|
31
31
|
else
|
32
|
-
|
32
|
+
msg.failed
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
desc 'nginx:status', 'displays nginx status'
|
37
37
|
def status
|
38
38
|
return unless @node.package_installed? 'nginx'
|
39
39
|
@node.print_service_status 'nginx'
|
40
|
-
end
|
40
|
+
end
|
41
41
|
end
|
data/lib/dust/recipes/ntpd.rb
CHANGED
@@ -4,20 +4,16 @@ class Ntpd < Recipe
|
|
4
4
|
# warn if other ntp package is installed
|
5
5
|
[ 'openntpd', 'chrony' ].each do |package|
|
6
6
|
if @node.package_installed? package, :quiet => true
|
7
|
-
|
7
|
+
@node.messages.add("#{package} installed, might conflict with ntpd, might be deleted").warning
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
@node.install_package 'ntp'
|
12
|
-
|
12
|
+
|
13
13
|
service = @node.uses_apt? ? 'ntp' : 'ntpd'
|
14
14
|
|
15
15
|
@node.autostart_service service
|
16
16
|
@node.restart_service service if options.restart?
|
17
17
|
end
|
18
|
-
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
18
|
end
|
23
19
|
|
@@ -35,9 +35,9 @@ class Pacemaker < Recipe
|
|
35
35
|
|
36
36
|
desc 'pacemaker:status', 'shows status of pacemaker/corosync cluster'
|
37
37
|
def status
|
38
|
-
|
38
|
+
msg = @node.messages.add('running crm_mon')
|
39
39
|
ret = @node.exec 'crm_mon -1'
|
40
|
-
|
41
|
-
|
40
|
+
msg.parse_result(ret[:exit_code])
|
41
|
+
msg.print_output(ret)
|
42
42
|
end
|
43
43
|
end
|
@@ -6,7 +6,7 @@ class Postgres < Recipe
|
|
6
6
|
# profile: [ dedicated|standard, zabbix, pacemaker ]
|
7
7
|
# service_name: "service name for init scripts"
|
8
8
|
|
9
|
-
return
|
9
|
+
return @node.messages.add('please specify version in your config file, e.g. "version: 9.1"').failed unless @config['version']
|
10
10
|
return unless install_postgres
|
11
11
|
|
12
12
|
# default cluster on debian-like systems is 'main'
|
@@ -52,7 +52,7 @@ class Postgres < Recipe
|
|
52
52
|
elsif @node.uses_emerge?
|
53
53
|
package = 'postgresql-server'
|
54
54
|
else
|
55
|
-
return
|
55
|
+
return @node.messages.add('os not supported, please specify "package: <package name>" in your config').failed
|
56
56
|
end
|
57
57
|
|
58
58
|
@node.install_package package
|
@@ -75,7 +75,7 @@ class Postgres < Recipe
|
|
75
75
|
@config['service_name'] ||= "postgresql-#{@config['version']}"
|
76
76
|
else
|
77
77
|
# on non-debian and non-emerge systems, print a warning since I'm not sure if service name is correct.
|
78
|
-
|
78
|
+
@node.messages.add('service_name not specified in config, defaulting to "postgresql"').warning unless @node.uses_apt?
|
79
79
|
@config['service_name'] ||= 'postgresql'
|
80
80
|
end
|
81
81
|
|
@@ -164,31 +164,31 @@ class Postgres < Recipe
|
|
164
164
|
@node.collect_facts :quiet => true
|
165
165
|
system_mem = ::Dust.convert_size(@node['memorysize']).to_f
|
166
166
|
|
167
|
-
|
167
|
+
msg = @node.messages.add("calculating recommended settings for a dedicated databse server with #{kb2mb system_mem} ram\n")
|
168
168
|
|
169
169
|
# every connection uses up to work_mem memory, so make sure that even if
|
170
170
|
# max_connections is reached, there's still a bit left.
|
171
171
|
# total available memory / (2 * max_connections)
|
172
172
|
@config['postgresql.conf']['work_mem'] ||= kb2mb(system_mem * 0.9 / @config['postgresql.conf']['max_connections'])
|
173
|
-
|
173
|
+
@node.messages.add("work_mem: #{@config['postgresql.conf']['work_mem']}", :indent => 2).ok
|
174
174
|
|
175
175
|
# shared_buffers should be 0.2 - 0.3 of system ram
|
176
176
|
# unless ram is lower than 1gb, then less (32mb maybe)
|
177
177
|
@config['postgresql.conf']['shared_buffers'] ||= kb2mb(system_mem * 0.25)
|
178
|
-
|
178
|
+
@node.messages.add("shared_buffers: #{@config['postgresql.conf']['shared_buffers']}", :indent => 2).ok
|
179
179
|
|
180
180
|
# maintenance_work_mem, should be a lot higher than work_mem
|
181
181
|
# recommended value: 50mb for each 1gb of system ram
|
182
182
|
@config['postgresql.conf']['maintenance_work_mem'] ||= kb2mb(system_mem / 1024 * 50)
|
183
|
-
|
183
|
+
@node.messages.add("maintenance_work_mem: #{@config['postgresql.conf']['maintenance_work_mem']}", :indent => 2).ok
|
184
184
|
|
185
185
|
# effective_cache_size between 0.6 and 0.8 of system ram
|
186
186
|
@config['postgresql.conf']['effective_cache_size'] ||= kb2mb(system_mem * 0.75)
|
187
|
-
|
187
|
+
@node.messages.add("effective_cache_size: #{@config['postgresql.conf']['effective_cache_size']}", :indent => 2).ok
|
188
188
|
|
189
189
|
# wal_buffers should be between 2-16mb
|
190
190
|
@config['postgresql.conf']['wal_buffers'] ||= '12MB'
|
191
|
-
|
191
|
+
@node.messages.add("wal_buffers: #{@config['postgresql.conf']['wal_buffers']}", :indent => 2).ok
|
192
192
|
end
|
193
193
|
|
194
194
|
# converts plain kb value to "1234MB"
|
@@ -221,35 +221,35 @@ class Postgres < Recipe
|
|
221
221
|
# adds zabbix user to postgres group
|
222
222
|
# creates zabbix user in postgres and grant access to postgres database
|
223
223
|
def configure_for_zabbix
|
224
|
-
|
225
|
-
|
226
|
-
|
224
|
+
@node.messages.add("configuring postgres for zabbix monitoring\n")
|
225
|
+
msg = @node.messages.add('adding zabbix user to postgres group', :indent => 2)
|
226
|
+
msg.parse_result(@node.exec('usermod -a -G postgres zabbix')[:exit_code])
|
227
227
|
|
228
228
|
if is_master? :indent => 2
|
229
|
-
|
230
|
-
ret =
|
229
|
+
msg = @node.messages.add('checking if zabbix user exists in postgres', :indent => 3)
|
230
|
+
ret = msg.parse_result(@node.exec('psql -U postgres -c ' +
|
231
231
|
' "SELECT usename FROM pg_user WHERE usename = \'zabbix\'"' +
|
232
|
-
' postgres |grep -q zabbix')[:exit_code]
|
232
|
+
' postgres |grep -q zabbix')[:exit_code])
|
233
233
|
|
234
234
|
# if user was not found, create him
|
235
235
|
unless ret
|
236
|
-
|
237
|
-
|
236
|
+
msg = @node.messages.add('create zabbix user in postgres', :indent => 4)
|
237
|
+
msg.parse_result(@node.exec('createuser -U postgres zabbix -RSD')[:exit_code])
|
238
238
|
end
|
239
239
|
|
240
|
-
|
241
|
-
|
240
|
+
msg = @node.messages.add('GRANT zabbix user access to postgres database', :indent => 3)
|
241
|
+
msg.parse_result(@node.exec('psql -U postgres -c "GRANT SELECT ON pg_stat_database TO zabbix" postgres')[:exit_code])
|
242
242
|
end
|
243
243
|
end
|
244
244
|
|
245
245
|
# checks if this server is a postgres master
|
246
246
|
def is_master? options = {}
|
247
|
-
|
247
|
+
msg = @node.messages.add('checking if this host is the postgres master: ', options)
|
248
248
|
if @node.file_exists? "#{@config['postgresql.conf']['data_directory']}/recovery.done", :quiet => true
|
249
|
-
|
249
|
+
msg.ok('yes')
|
250
250
|
return true
|
251
251
|
else
|
252
|
-
|
252
|
+
msg.ok('no')
|
253
253
|
return false
|
254
254
|
end
|
255
255
|
end
|
@@ -3,13 +3,13 @@ class RcLocal < Recipe
|
|
3
3
|
def deploy
|
4
4
|
|
5
5
|
if @node.uses_apt?
|
6
|
-
|
6
|
+
@node.messages.add("configuring custom startup script\n")
|
7
7
|
|
8
8
|
rc = ''
|
9
9
|
@config.to_array.each do |cmd|
|
10
|
-
|
10
|
+
msg = @node.messages.add("adding command: #{cmd}", :indent => 2)
|
11
11
|
rc << "#{cmd}\n"
|
12
|
-
|
12
|
+
msg.ok
|
13
13
|
end
|
14
14
|
rc << "\nexit 0\n"
|
15
15
|
|
@@ -17,15 +17,15 @@ class RcLocal < Recipe
|
|
17
17
|
@node.chown 'root:root', '/etc/rc.local'
|
18
18
|
@node.chmod '755', '/etc/rc.local'
|
19
19
|
else
|
20
|
-
|
20
|
+
@node.messages.add('os not supported').failed
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
desc 'rc_local:status', 'shows current /etc/rc.local'
|
25
25
|
def status
|
26
|
-
|
26
|
+
msg = @node.messages.add('getting /etc/rc.local')
|
27
27
|
ret = @node.exec 'cat /etc/rc.local'
|
28
|
-
|
29
|
-
|
28
|
+
msg.parse_result(ret[:exit_code])
|
29
|
+
msg.print_output(ret)
|
30
30
|
end
|
31
31
|
end
|