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 +4 -4
- data/exe/foreman_envsync +7 -7
- data/lib/foreman_envsync/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10c8912692f23b8db38590dd4181809b06c671f2f21e2f4415d8d14151c6424f
|
4
|
+
data.tar.gz: 6068ff7852fbe9a327b317f4416699716d406add74a89ee652194f9c51ffda28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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?
|
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.
|
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-
|
11
|
+
date: 2021-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hammer_cli
|