dust-deploy 0.10.2 → 0.10.3
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/changelog.md +7 -0
- data/lib/dust/recipes/hash_check.rb +1 -1
- data/lib/dust/recipes/sshd.rb +10 -3
- data/lib/dust/recipes/sysctl.rb +4 -2
- data/lib/dust/server.rb +30 -0
- data/lib/dust/version.rb +1 -1
- metadata +3 -3
data/changelog.md
CHANGED
@@ -22,7 +22,7 @@ class HashCheck < Recipe
|
|
22
22
|
# python was imho the best solution to generate /etc/shadow hashes.
|
23
23
|
# mkpasswd doesn't work on centos-like machines :/
|
24
24
|
# and python is more likely installed than ruby
|
25
|
-
ret = @node.exec("python -c \"import crypt; print
|
25
|
+
ret = @node.exec("python -c \"import crypt; print(crypt.crypt('#{password}', '\\$#{method}\\$#{salt}\\$'));\"")
|
26
26
|
|
27
27
|
unless ret[:exit_code] == 0
|
28
28
|
::Dust.print_failed 'error during hash creation (is python installed?)'
|
data/lib/dust/recipes/sshd.rb
CHANGED
@@ -2,7 +2,11 @@ class Sshd < Recipe
|
|
2
2
|
|
3
3
|
desc 'sshd:deploy', 'installs and configures the ssh server'
|
4
4
|
def deploy
|
5
|
-
|
5
|
+
if @node.uses_pacman?
|
6
|
+
return unless @node.install_package 'openssh'
|
7
|
+
else
|
8
|
+
return unless @node.install_package 'openssh-server'
|
9
|
+
end
|
6
10
|
|
7
11
|
generate_default_config
|
8
12
|
@config.values_to_array!
|
@@ -69,8 +73,11 @@ class Sshd < Recipe
|
|
69
73
|
end
|
70
74
|
|
71
75
|
def restart_daemon
|
72
|
-
|
73
|
-
|
76
|
+
if @node.uses_apt?
|
77
|
+
daemon = 'ssh'
|
78
|
+
else
|
79
|
+
daemon = 'sshd'
|
80
|
+
end
|
74
81
|
|
75
82
|
@node.restart_service daemon if @options.restart
|
76
83
|
@node.reload_service daemon if @options.reload
|
data/lib/dust/recipes/sysctl.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
class Sysctl < Recipe
|
2
2
|
desc 'sysctl:deploy', 'configures sysctl'
|
3
3
|
def deploy
|
4
|
-
#
|
5
|
-
|
4
|
+
# we need support for /etc/sysctl.d/
|
5
|
+
unless @node.dir_exists? '/etc/sysctl.d/'
|
6
|
+
return ::Dust.print_warning 'sysctl configuration not supported for your linux distribution'
|
7
|
+
end
|
6
8
|
|
7
9
|
# seperate templates from sysctls
|
8
10
|
sysctls = @config.clone
|
data/lib/dust/server.rb
CHANGED
@@ -281,6 +281,8 @@ module Dust
|
|
281
281
|
return Dust.print_ok '', options unless exec("qlist -I #{package}")[:stdout].empty?
|
282
282
|
elsif uses_rpm?
|
283
283
|
return Dust.print_ok '', options if exec("rpm -q #{package}")[:exit_code] == 0
|
284
|
+
elsif uses_pacman?
|
285
|
+
return Dust.print_ok '', options if exec("pacman -Q #{package}")[:exit_code] == 0
|
284
286
|
end
|
285
287
|
end
|
286
288
|
|
@@ -303,6 +305,8 @@ module Dust
|
|
303
305
|
exec "#{options[:env]} emerge #{package}"
|
304
306
|
elsif uses_rpm?
|
305
307
|
exec "yum install -y #{package}"
|
308
|
+
elsif uses_pacman?
|
309
|
+
exec "echo y |pacman -S #{package}"
|
306
310
|
else
|
307
311
|
puts
|
308
312
|
return Dust.print_failed "install_package only supports apt, emerge and yum systems at the moment",
|
@@ -327,6 +331,8 @@ module Dust
|
|
327
331
|
Dust.print_result exec("emerge --unmerge #{package}")[:exit_code], options
|
328
332
|
elsif uses_rpm?
|
329
333
|
Dust.print_result exec("yum erase -y #{package}")[:exit_code], options
|
334
|
+
elsif uses_pacman?
|
335
|
+
Dust.print_result exec("echo y |pacman -R #{package}")[:exit_code], options
|
330
336
|
else
|
331
337
|
Dust.print_failed '', options
|
332
338
|
end
|
@@ -348,6 +354,8 @@ module Dust
|
|
348
354
|
# yum returns != 0 if packages that need to be updated are found
|
349
355
|
# we don't want that this is producing an error
|
350
356
|
ret[:exit_code] = 0 if ret[:exit_code] == 100
|
357
|
+
elsif uses_pacman?
|
358
|
+
ret = exec 'pacman -Sy', options
|
351
359
|
else
|
352
360
|
return Dust.print_failed '', options
|
353
361
|
end
|
@@ -375,6 +383,9 @@ module Dust
|
|
375
383
|
ret = exec 'emerge -uND @world', options
|
376
384
|
elsif uses_rpm?
|
377
385
|
ret = exec 'yum upgrade -y', options
|
386
|
+
elsif uses_pacman?
|
387
|
+
# pacman has no --yes option that i know of, so echoing y
|
388
|
+
ret = exec 'echo y |pacman -Su', options
|
378
389
|
else
|
379
390
|
Dust.print_failed 'system not (yet) supported', options
|
380
391
|
return false
|
@@ -414,6 +425,14 @@ module Dust
|
|
414
425
|
Dust.print_msg 'determining whether node uses emerge', options
|
415
426
|
@uses_emerge = Dust.print_result exec('test -e /etc/gentoo-release')[:exit_code], options
|
416
427
|
end
|
428
|
+
|
429
|
+
def uses_pacman? options = {}
|
430
|
+
options = default_options(:quiet => true).merge options
|
431
|
+
|
432
|
+
return @uses_pacman if defined? @uses_pacman
|
433
|
+
Dust.print_msg 'determining whether node uses pacman', options
|
434
|
+
@uses_pacman = Dust.print_result exec('test -e /etc/arch-release')[:exit_code], options
|
435
|
+
end
|
417
436
|
|
418
437
|
def is_os? os_list, options = {}
|
419
438
|
options = default_options(:quiet => true).merge options
|
@@ -472,6 +491,13 @@ module Dust
|
|
472
491
|
return false unless uses_rpm?
|
473
492
|
is_os? ['fedora'], options
|
474
493
|
end
|
494
|
+
|
495
|
+
def is_arch? options = {}
|
496
|
+
options = default_options(:quiet => true).merge options
|
497
|
+
|
498
|
+
return false unless uses_pacman?
|
499
|
+
is_os? ['archlinux'], options
|
500
|
+
end
|
475
501
|
|
476
502
|
def is_executable? file, options = {}
|
477
503
|
options = default_options.merge options
|
@@ -533,6 +559,10 @@ module Dust
|
|
533
559
|
Dust.print_msg "#{command}ing #{service} (via sysvconfig)", options
|
534
560
|
ret = exec("service #{service} #{command}")
|
535
561
|
|
562
|
+
elsif file_exists? '/usr/sbin/rc.d', :quiet => true
|
563
|
+
Dust.print_msg "#{command}ing #{service} (via rc.d)", options
|
564
|
+
ret = exec("rc.d #{command} #{service}")
|
565
|
+
|
536
566
|
else
|
537
567
|
Dust.print_msg "#{command}ing #{service} (via initscript)", options
|
538
568
|
ret = exec("/etc/init.d/#{service} #{command}")
|
data/lib/dust/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 10
|
8
|
-
-
|
9
|
-
version: 0.10.
|
8
|
+
- 3
|
9
|
+
version: 0.10.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- kris kechagia
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-04-
|
17
|
+
date: 2012-04-14 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|