moose-inventory 1.0.1 → 1.0.2
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f7a05c05e173698bcbc3b5bcce29ea2c0c7c3bd
|
4
|
+
data.tar.gz: ea46d916c9a5776ce8e3119821ef009fea2e7d4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3437c73ddf392819163040737720441e436a86714d4a682f0d5013e7799668ab19533bd1610d9f25b1d5a8c01dd0b8df77b49d4a9accd13b227e4312602848a3
|
7
|
+
data.tar.gz: f405d9fbc5c6f7415abf9cc0f96762a96c50d0439971be527faee5918d89cce9bc099fc0173c7c7fcae8f83a5e587203353b63e687f3cf1ec35062c83cf3b68b
|
@@ -32,7 +32,7 @@ module Moose
|
|
32
32
|
|
33
33
|
# Convenience
|
34
34
|
db = Moose::Inventory::DB
|
35
|
-
fmt = Moose::Inventory::Cli::Formatter
|
35
|
+
fmt = Moose::Inventory::Cli::Formatter
|
36
36
|
|
37
37
|
# Arguments
|
38
38
|
names = argv.uniq.map(&:downcase)
|
@@ -51,8 +51,20 @@ module Moose
|
|
51
51
|
results[hv[:name].to_sym] = hv[:value]
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
# Add the Ansible 1.3 '_meta' tag
|
56
|
+
# see http://docs.ansible.com/ansible/developing_inventory.html#tuning-the-external-inventory-script
|
57
|
+
results['_meta'.to_sym] = {}
|
58
|
+
results['_meta'.to_sym]['hostvars'.to_sym] = {}
|
59
|
+
db.models[:host].each do |host|
|
60
|
+
results['_meta'.to_sym]['hostvars'.to_sym][host.name().to_sym] = {}
|
61
|
+
host.hostvars_dataset.each do |hv|
|
62
|
+
results['_meta'.to_sym]['hostvars'.to_sym][host.name().to_sym][hv[:name].to_sym] = hv[:value]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
54
66
|
else
|
55
|
-
# This our more flexible implementation, which is not
|
67
|
+
# This our more flexible implementation, which is not compatible
|
56
68
|
# with the Ansible specs
|
57
69
|
names.each do |name|
|
58
70
|
host = db.models[:host].find(name: name)
|
@@ -18,7 +18,7 @@ RSpec.describe Moose::Inventory::Cli::Host do
|
|
18
18
|
@mockargs << val
|
19
19
|
end
|
20
20
|
|
21
|
-
@config = Moose::Inventory::Config
|
21
|
+
@config = Moose::Inventory::Config
|
22
22
|
@config.init(@mockargs)
|
23
23
|
|
24
24
|
@db = Moose::Inventory::DB
|
@@ -64,7 +64,7 @@ RSpec.describe Moose::Inventory::Cli::Host do
|
|
64
64
|
actual = runner{ @cli.start(args) }
|
65
65
|
|
66
66
|
# Check output
|
67
|
-
desired = { aborted: true}
|
67
|
+
desired = { aborted: true}
|
68
68
|
desired[:STDERR] = "ERROR: Wrong number of arguments for Ansible mode, 0 for 1.\n"
|
69
69
|
expected(actual, desired)
|
70
70
|
end
|
@@ -111,12 +111,18 @@ RSpec.describe Moose::Inventory::Cli::Host do
|
|
111
111
|
#@console.out(actual, 'y')
|
112
112
|
|
113
113
|
# Check output
|
114
|
+
meta = {}
|
115
|
+
meta['hostvars'.to_sym] = {}
|
116
|
+
meta['hostvars'.to_sym][host_name.to_sym] = {}
|
117
|
+
|
114
118
|
mock = {}
|
115
119
|
host_vars.each do |hv|
|
116
120
|
hv_array = hv.split('=')
|
117
|
-
mock[hv_array[0].to_sym] = hv_array[1]
|
121
|
+
mock[hv_array[0].to_sym] = hv_array[1]
|
122
|
+
meta['hostvars'.to_sym][host_name.to_sym][hv_array[0].to_sym] = hv_array[1]
|
118
123
|
end
|
119
|
-
|
124
|
+
mock['_meta'.to_sym] = meta
|
125
|
+
|
120
126
|
desired = {}
|
121
127
|
desired[:STDOUT] = mock.to_json + "\n"
|
122
128
|
expected(actual, desired)
|
@@ -137,11 +143,17 @@ RSpec.describe Moose::Inventory::Cli::Host do
|
|
137
143
|
#@console.out(actual, 'y')
|
138
144
|
|
139
145
|
# Check output
|
146
|
+
meta = {}
|
147
|
+
meta['hostvars'.to_sym] = {}
|
148
|
+
meta['hostvars'.to_sym][host_name.to_sym] = {}
|
149
|
+
|
140
150
|
mock = {}
|
141
151
|
host_vars.each do |hv|
|
142
152
|
hv_array = hv.split('=')
|
143
153
|
mock[hv_array[0].to_sym] = hv_array[1]
|
154
|
+
meta['hostvars'.to_sym][host_name.to_sym][hv_array[0].to_sym] = hv_array[1]
|
144
155
|
end
|
156
|
+
mock['_meta'.to_sym] = meta
|
145
157
|
|
146
158
|
desired = {}
|
147
159
|
desired[:STDOUT] = mock.to_json + "\n"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moose-inventory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Russell Davies
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: indentation
|