foreman_envsync 1.0.0 → 1.1.0

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
  SHA256:
3
- metadata.gz: 237034826a5908b26cf6c4c6404ff49cc88a328b7b5c6934d9771197026c4860
4
- data.tar.gz: 59c58d3e01675713f92d53a445ccede11fb56324d431598d494144281a7a5aca
3
+ metadata.gz: 10c8912692f23b8db38590dd4181809b06c671f2f21e2f4415d8d14151c6424f
4
+ data.tar.gz: 6068ff7852fbe9a327b317f4416699716d406add74a89ee652194f9c51ffda28
5
5
  SHA512:
6
- metadata.gz: 9eea85c919db3abb85cebefdfd5a87d0ab7e1ecaf12c1733e0e9bbee9c67e9d053a30c0aaeaaa46c6dcdb7319fb36b494407aa598dccc6cd8ee8aa990fb8d37c
7
- data.tar.gz: c917d93841accedb333ff01dd8011663a819e8e9e3303a822c562a174a949a9bf646ee56b6670b36da26127bdbf66b9371b11c3f0d9f698670b0a6e46379fda0
6
+ metadata.gz: 65114f82d2422bba699dd30c599f4717ce34c8b32eebd60532f1f02039e57ae570628c89abfad2279d74b3e819066a1cc473850a1da376a55782566b81438cb0
7
+ data.tar.gz: 43a63c0187c9ad92ddf5870c3daf553bc1b354a3e299030be7a02491121020f46e101cfc7a2456f3f938261a6bee8fa35990737df3179602e8b07c8a665fa56b
data/exe/foreman_envsync CHANGED
@@ -41,21 +41,21 @@ def key_file(file)
41
41
  OpenSSL::PKey::RSA.new(File.read(file))
42
42
  end
43
43
 
44
- def hammer_cmd(cmd)
44
+ def hammer_cmd(cmd, ignore_exitstatus: false)
45
45
  stdout, stderr, s = Open3.capture3(cmd)
46
46
  unless s.success?
47
47
  puts "command #{cmd} failed"
48
48
  puts stderr
49
- exit s.exitstatus
49
+ exit s.exitstatus unless ignore_exitstatus
50
50
  end
51
51
 
52
52
  stdout
53
53
  end
54
54
 
55
- def hammer_cmd_parse(cmd)
56
- stdout = hammer_cmd(cmd)
55
+ def hammer_cmd_parse(cmd, **opt)
56
+ stdout = hammer_cmd(cmd, opt)
57
57
 
58
- JSON.parse(stdout)
58
+ JSON.parse(stdout) unless stdout.empty?
59
59
  end
60
60
 
61
61
  def collect_one_field(data, field)
@@ -78,7 +78,7 @@ end
78
78
  def foreman_env_delete(name)
79
79
  cmd = "hammer --output=json puppet-environment delete --name #{name}"
80
80
 
81
- hammer_cmd_parse(cmd)
81
+ hammer_cmd_parse(cmd, ignore_exitstatus: true)
82
82
  end
83
83
 
84
84
  def foreman_env_create(name, location_ids, org_ids)
@@ -143,7 +143,7 @@ verbose_list "found %d foreman environment(s) unknown to puppetserver.", extra_e
143
143
  # Remove any foreman envs unknown to puppetserver
144
144
  #
145
145
  report = extra_envs.collect { |x| foreman_env_delete(x) } unless extra_envs.empty?
146
- verbose_list "deleted %d foreman environment(s).", report
146
+ verbose_list "deleted %d foreman environment(s).", report.compact
147
147
 
148
148
  # update foreman envs if anything was deleted
149
149
  f_envs = foreman_env_list unless report.nil?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanEnvsync
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_envsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Hoblitt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-10 00:00:00.000000000 Z
11
+ date: 2021-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hammer_cli