danarchy_deploy 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc77046b77757e8d847424bced87d9b0a78131a9
4
- data.tar.gz: f07bf23008b48a3dd3f84b35d1bd87cb9e0a379a
3
+ metadata.gz: d27ed8ebe6a52e48face1634ec324df797fc5911
4
+ data.tar.gz: 984a5dd15941c77724f0adab1158f7f06257141c
5
5
  SHA512:
6
- metadata.gz: d017636ab2096321579edeb48973913374dd23680328fafada853012394af638c80e9e107b21cfaad81b10a6bc51e93f937e5c81b2368bcfe0a0b3430a399d9a
7
- data.tar.gz: 91523adf0a963049251406efe47516c91689f89f0a1b423870c71ddb56a65f3fddeefc6541e2da26a62afd0f5b190e1e5a53190bcee332ee2d2b6439473c55e7
6
+ metadata.gz: ec05b6367357474d110db4bf3c74f2af2ec03b1dd75922c6b8d37087c7dc6bd0fdf55302e727afa11748d3caefab6551f903fa46f2d828fa79289875faf179e6
7
+ data.tar.gz: 3fe0235b25830068af8a1de8ef7d2e0b592248c0302ceb1c65a22008bb1f93237b4fabe8988431366b7e7515750a666eb3ef86b2932f2edd09f9eff2b5e48d17
@@ -6,11 +6,10 @@ module DanarchyDeploy
6
6
  abort('Operating System not defined! Exiting!') if !deployment[:os]
7
7
  puts "\n" + self.name
8
8
 
9
- os = deployment[:os]
10
- packages = deployment[:packages]
11
- installer, updater, cleaner, packages = prep_operating_system(os, packages, options)
9
+ installer, updater, cleaner, packages = prep_operating_system(deployment, options)
12
10
  install_result = nil
13
11
  if packages
12
+ packages = deployment[:packages].join(' ')
14
13
  install_result = DanarchyDeploy::Helpers.run_command("#{installer} #{packages}", options)
15
14
  else
16
15
  puts 'No packages to install.'
@@ -30,21 +29,17 @@ module DanarchyDeploy
30
29
  end
31
30
 
32
31
  private
33
- def self.prep_operating_system(os, packages, options)
32
+ def self.prep_operating_system(deployment, options)
34
33
  (installer, updater, cleaner) = nil
34
+ os = deployment[:os]
35
+
35
36
  if os.downcase == 'gentoo'
36
37
  puts "#{os.capitalize} detected! Using emerge."
38
+ installer = 'emerge --usepkg --quiet --noreplace '
39
+ installer += '--pretend ' if options[:pretend]
37
40
 
38
- if packages
39
- installer = 'emerge --usepkg --quiet --noreplace '
40
- installer += '--pretend ' if options[:pretend]
41
-
42
- packages.each do |pkg|
43
- IO.popen("qlist -I #{pkg}") do |o|
44
- packages.delete(pkg) if !o.read.empty?
45
- end
46
- end
47
- end
41
+ # Build packages if template instance
42
+ installer.gsub('usepkg', 'buildpkg') if deployment[:hostname] =~ /^(image|template)/
48
43
 
49
44
  cleaner = 'emerge --depclean --quiet '
50
45
  cleaner += '--pretend ' if options[:pretend]
@@ -66,21 +61,19 @@ module DanarchyDeploy
66
61
  elsif %w[centos redhat].include?(os.downcase)
67
62
  # needs more testing
68
63
  puts "#{os.capitalize} detected! Using yum."
69
- if packages
70
- installer = 'yum install -y '
64
+ installer = 'yum install -y '
71
65
 
72
- packages.each do |pkg|
73
- IO.popen("rpm -q #{pkg}") do |o|
74
- packages.delete(pkg) if !o.read.include?('not installed')
75
- end
76
- end
77
- end
66
+ # packages.each do |pkg|
67
+ # IO.popen("rpm -q #{pkg}") do |o|
68
+ # packages.delete(pkg) if !o.read.include?('not installed')
69
+ # end
70
+ # end
78
71
 
79
72
  updater = nil
80
73
  cleaner = nil
81
74
  end
82
75
 
83
- [installer, updater, cleaner, packages.join(' ')]
76
+ [installer, updater, cleaner]
84
77
  end
85
78
  end
86
79
  end
@@ -7,16 +7,16 @@ module DanarchyDeploy
7
7
  deployment[:services].each do |service, params|
8
8
  puts "Configuring service: #{service}"
9
9
 
10
- if params[:templates] && !params[:templates].empty?
11
- puts " > COnfiguring templates for #{service}"
12
- DanarchyDeploy::Templater.new(params[:templates], options)
13
- end
14
-
15
10
  if params[:archives] && !params[:archives].empty?
16
11
  puts "\n" + self.name
17
12
  puts " > Deploying archives for #{service}"
18
13
  DanarchyDeploy::Archiver.new(params[:archives], options)
19
14
  end
15
+
16
+ if params[:templates] && !params[:templates].empty?
17
+ puts " > COnfiguring templates for #{service}"
18
+ DanarchyDeploy::Templater.new(params[:templates], options)
19
+ end
20
20
  end
21
21
 
22
22
  deployment
@@ -123,7 +123,7 @@ module DanarchyDeploy
123
123
 
124
124
  def self.sudoer(user)
125
125
  sudoer_file = '/etc/sudoers.d/danarchy_deploy-' + user[:username]
126
- File.open(sudoer_file, 'r+') do |f|
126
+ File.open(sudoer_file, 'a+') do |f|
127
127
  if !f.read.include?(user[:sudoer])
128
128
  puts " |+ Added: '#{user[:sudoer]}'"
129
129
  f.puts user[:sudoer]
@@ -1,3 +1,3 @@
1
1
  module DanarchyDeploy
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -27,7 +27,8 @@ module DanarchyDeploy
27
27
 
28
28
  deployment[:last_deploy] = DateTime.now.strftime("%Y/%m/%d %H:%M:%S")
29
29
  puts "\nFinished Local Deployment at #{deployment[:last_deploy]}!"
30
- File.write(options[:deploy_file], deployment.to_json) if options[:deploy_file].end_with?('.json')
30
+ File.write(options[:deploy_file],
31
+ JSON.pretty_generate(deployment) if options[:deploy_file].end_with?('.json')
31
32
  File.write(options[:deploy_file], deployment.to_yaml) if options[:deploy_file].end_with?('.yaml')
32
33
  deployment
33
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danarchy_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan James
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-10 00:00:00.000000000 Z
11
+ date: 2018-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danarchy_couchdb