moose-inventory 1.0.7 → 1.0.9

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.
Files changed (81) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +35 -0
  3. data/.gitignore +1 -1
  4. data/BACKLOG.md +184 -0
  5. data/Gemfile.lock +60 -0
  6. data/README.md +23 -5
  7. data/bin/moose-inventory +1 -1
  8. data/docs/release/publishing.md +113 -0
  9. data/docs/release/release-readiness.md +41 -0
  10. data/docs/security-audit-2026-05-21.md +71 -0
  11. data/lib/moose_inventory/cli/formatter.rb +16 -17
  12. data/lib/moose_inventory/cli/group.rb +1 -1
  13. data/lib/moose_inventory/cli/group_add.rb +19 -21
  14. data/lib/moose_inventory/cli/group_addchild.rb +36 -40
  15. data/lib/moose_inventory/cli/group_addhost.rb +14 -18
  16. data/lib/moose_inventory/cli/group_addvar.rb +37 -37
  17. data/lib/moose_inventory/cli/group_get.rb +23 -26
  18. data/lib/moose_inventory/cli/group_list.rb +12 -15
  19. data/lib/moose_inventory/cli/group_listvars.rb +12 -14
  20. data/lib/moose_inventory/cli/group_rm.rb +36 -21
  21. data/lib/moose_inventory/cli/group_rmchild.rb +5 -6
  22. data/lib/moose_inventory/cli/group_rmhost.rb +12 -16
  23. data/lib/moose_inventory/cli/group_rmvar.rb +5 -5
  24. data/lib/moose_inventory/cli/host.rb +1 -1
  25. data/lib/moose_inventory/cli/host_add.rb +18 -18
  26. data/lib/moose_inventory/cli/host_addgroup.rb +9 -9
  27. data/lib/moose_inventory/cli/host_addvar.rb +6 -6
  28. data/lib/moose_inventory/cli/host_get.rb +15 -18
  29. data/lib/moose_inventory/cli/host_list.rb +3 -3
  30. data/lib/moose_inventory/cli/host_listvars.rb +21 -23
  31. data/lib/moose_inventory/cli/host_rm.rb +9 -9
  32. data/lib/moose_inventory/cli/host_rmgroup.rb +5 -5
  33. data/lib/moose_inventory/cli/host_rmvar.rb +3 -3
  34. data/lib/moose_inventory/config/config.rb +43 -40
  35. data/lib/moose_inventory/db/db.rb +70 -50
  36. data/lib/moose_inventory/db/models.rb +11 -12
  37. data/lib/moose_inventory/version.rb +1 -1
  38. data/moose-inventory.gemspec +35 -20
  39. data/scripts/check.sh +8 -0
  40. data/scripts/ci/check_permissions.sh +32 -0
  41. data/scripts/ci/check_security.sh +50 -0
  42. data/scripts/ci/package_sanity.sh +46 -0
  43. data/scripts/files.rb +1 -4
  44. data/scripts/install_dependencies.sh +17 -0
  45. data/scripts/reports.sh +2 -2
  46. data/spec/lib/moose_inventory/cli/cli_spec.rb +13 -14
  47. data/spec/lib/moose_inventory/cli/group_add_spec.rb +118 -119
  48. data/spec/lib/moose_inventory/cli/group_addchild_spec.rb +49 -51
  49. data/spec/lib/moose_inventory/cli/group_addhost_spec.rb +80 -83
  50. data/spec/lib/moose_inventory/cli/group_addvar_spec.rb +91 -91
  51. data/spec/lib/moose_inventory/cli/group_get_spec.rb +22 -23
  52. data/spec/lib/moose_inventory/cli/group_list_spec.rb +19 -20
  53. data/spec/lib/moose_inventory/cli/group_listvar_spec.rb +35 -36
  54. data/spec/lib/moose_inventory/cli/group_rm_spec.rb +103 -49
  55. data/spec/lib/moose_inventory/cli/group_rmchild_spec.rb +41 -45
  56. data/spec/lib/moose_inventory/cli/group_rmhost_spec.rb +43 -46
  57. data/spec/lib/moose_inventory/cli/group_rmvar_spec.rb +131 -131
  58. data/spec/lib/moose_inventory/cli/group_spec.rb +9 -9
  59. data/spec/lib/moose_inventory/cli/host_add_spec.rb +103 -43
  60. data/spec/lib/moose_inventory/cli/host_addgroup_spec.rb +78 -80
  61. data/spec/lib/moose_inventory/cli/host_addvar_spec.rb +122 -122
  62. data/spec/lib/moose_inventory/cli/host_get_spec.rb +16 -16
  63. data/spec/lib/moose_inventory/cli/host_list_spec.rb +8 -8
  64. data/spec/lib/moose_inventory/cli/host_listvar_spec.rb +50 -52
  65. data/spec/lib/moose_inventory/cli/host_rm_spec.rb +12 -12
  66. data/spec/lib/moose_inventory/cli/host_rmgroup_spec.rb +48 -51
  67. data/spec/lib/moose_inventory/cli/host_rmvar_spec.rb +136 -136
  68. data/spec/lib/moose_inventory/config/config_spec.rb +16 -3
  69. data/spec/lib/moose_inventory/db/db_spec.rb +224 -2
  70. data/spec/lib/moose_inventory/db/models_spec.rb +10 -11
  71. data/spec/shared/shared_config_setup.rb +2 -2
  72. data/spec/spec_helper.rb +7 -8
  73. metadata +99 -136
  74. data/.coveralls.yml +0 -0
  75. data/.rubocop.yml +0 -793
  76. data/Guardfile +0 -38
  77. data/config/dotfiles/coveralls.yml +0 -0
  78. data/config/dotfiles/gitignore +0 -20
  79. data/config/dotfiles/rubocop.yml +0 -793
  80. data/scripts/guard_quality.sh +0 -3
  81. data/scripts/guard_test.sh +0 -2
@@ -0,0 +1,46 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ pkg_dir="tmp/pkg"
5
+ extract_dir="tmp/package-sanity"
6
+ rm -rf "$pkg_dir" "$extract_dir"
7
+ mkdir -p "$pkg_dir" "$extract_dir"
8
+
9
+ gem_path="$pkg_dir/moose-inventory.gem"
10
+ gem build moose-inventory.gemspec --output "$gem_path"
11
+
12
+ gem specification "$gem_path" name --yaml > "$pkg_dir/name.yml"
13
+ gem specification "$gem_path" version --yaml > "$pkg_dir/version.yml"
14
+ gem specification "$gem_path" executables --yaml > "$pkg_dir/executables.yml"
15
+ gem specification "$gem_path" require_paths --yaml > "$pkg_dir/require_paths.yml"
16
+ gem specification "$gem_path" files --yaml > "$pkg_dir/files.yml"
17
+
18
+ tar -xf "$gem_path" -C "$extract_dir"
19
+ tar -xzf "$extract_dir/data.tar.gz" -C "$extract_dir"
20
+
21
+ required_files=(
22
+ "bin/moose-inventory"
23
+ "lib/moose_inventory.rb"
24
+ "lib/moose_inventory/version.rb"
25
+ "README.md"
26
+ "LICENSE.txt"
27
+ )
28
+
29
+ for path in "${required_files[@]}"; do
30
+ if [[ ! -f "$extract_dir/$path" ]]; then
31
+ echo "Packaged gem is missing required file: $path" >&2
32
+ exit 1
33
+ fi
34
+ done
35
+
36
+ if ! grep -q "^- moose-inventory$" "$pkg_dir/executables.yml"; then
37
+ echo "Packaged gem metadata does not expose the moose-inventory executable." >&2
38
+ exit 1
39
+ fi
40
+
41
+ if ! bundle exec ruby -Ilib bin/moose-inventory --config spec/config/config.yml version | grep -q '^Version '; then
42
+ echo "CLI version smoke failed." >&2
43
+ exit 1
44
+ fi
45
+
46
+ printf 'Package sanity passed: %s\n' "$gem_path"
data/scripts/files.rb CHANGED
@@ -12,7 +12,4 @@ out['Executables'.to_sym] = executables
12
12
  out['Test_Files'.to_sym] = test_files
13
13
  out['Require_Paths'.to_sym] = require_paths
14
14
 
15
- puts "#{out.to_yaml}"
16
-
17
-
18
-
15
+ puts out.to_yaml.to_s
@@ -0,0 +1,17 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ sudo dnf groupinstall -y "C Development Tools and Libraries" "Development Tools"
5
+ sudo dnf install -y \
6
+ ansible \
7
+ ruby \
8
+ ruby-devel \
9
+ rubygem-bundler \
10
+ sqlite \
11
+ sqlite-libs \
12
+ sqlite-devel \
13
+ mariadb-connector-c-devel \
14
+ libpq-devel \
15
+ libffi \
16
+ libffi-devel \
17
+ rpm-build
data/scripts/reports.sh CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/bin/bash
2
+ set -euo pipefail
2
3
 
3
- firefox spec/reports/quality/rubocop.html spec/reports/coverage/index.html spec/reports/test/rspec.html
4
-
4
+ firefox spec/reports/coverage/index.html
@@ -1,26 +1,25 @@
1
- require 'spec_helper'
1
+ require 'spec_helper'
2
2
 
3
- RSpec.describe Moose::Inventory::Cli::Application do
3
+ RSpec.describe Moose::Inventory::Cli::Application do
4
4
  before do
5
5
  @app = Moose::Inventory::Cli::Application
6
6
  end
7
7
 
8
- describe ".version" do
8
+ describe '.version' do
9
9
  # --------------------
10
10
  it 'method should be responsive' do
11
11
  result = @app.instance_methods(false).include?(:version)
12
12
  expect(result).to eq(true)
13
13
  end
14
-
14
+
15
15
  # --------------------
16
- # it 'should output version information' do
17
- # actual = runner { @app.version }
18
- #
19
- # desired = {}
20
- # desired[:STDERR] = "Version #{Moose::Inventory::VERSION}"
21
- #
22
- # expected(actual, desired)
23
- # end
24
-
16
+ # it 'should output version information' do
17
+ # actual = runner { @app.version }
18
+ #
19
+ # desired = {}
20
+ # desired[:STDERR] = "Version #{Moose::Inventory::VERSION}"
21
+ #
22
+ # expected(actual, desired)
23
+ # end
25
24
  end
26
- end
25
+ end
@@ -12,20 +12,20 @@ RSpec.describe Moose::Inventory::Cli::Group do
12
12
  env: 'test',
13
13
  }
14
14
 
15
- @mockargs = []
15
+ @mockargs = []
16
16
  @mockarg_parts.each do |key, val|
17
17
  @mockargs << "--#{key}"
18
18
  @mockargs << val
19
19
  end
20
20
  @mockargs << '--trace' # extra info for debugging
21
-
21
+
22
22
  @console = Moose::Inventory::Cli::Formatter
23
23
 
24
24
  @config = Moose::Inventory::Config
25
25
  @config.init(@mockargs)
26
-
26
+
27
27
  @db = Moose::Inventory::DB
28
- @db.init if @db.db.nil?
28
+ @db.init if @db.db.nil?
29
29
 
30
30
  @host = Moose::Inventory::Cli::Host
31
31
  @group = Moose::Inventory::Cli::Group
@@ -48,29 +48,29 @@ RSpec.describe Moose::Inventory::Cli::Group do
48
48
  it '<no arguments> ... should bail with an error' do
49
49
  actual = runner { @app.start(%w(group add)) }
50
50
 
51
- desired = {aborted: true}
51
+ desired = { aborted: true }
52
52
  desired[:STDERR] = "ERROR: Wrong number of arguments, 0 for 1 or more.\n"
53
53
  expected(actual, desired)
54
54
  end
55
55
 
56
56
  # --------------------
57
57
  it 'ungrouped ... should abort with an error' do
58
- actual = runner { @app.start(%W(group add ungrouped)) }
58
+ actual = runner { @app.start(%w(group add ungrouped)) }
59
59
 
60
60
  # Check output
61
- desired = {aborted: true}
61
+ desired = { aborted: true }
62
62
  desired[:STDERR] =
63
63
  "ERROR: Cannot manually manipulate the automatic group 'ungrouped'\n"
64
64
  expected(actual, desired)
65
- end
65
+ end
66
66
 
67
67
  # --------------------
68
68
  it 'GROUP ... should add a group to the db' do
69
69
  name = 'test'
70
70
  actual = runner { @app.start(%W(group add #{name})) }
71
71
 
72
- #@console.out(actual)
73
-
72
+ # @console.out(actual)
73
+
74
74
  # Check output
75
75
  desired = {}
76
76
  desired[:STDOUT] =
@@ -94,8 +94,8 @@ RSpec.describe Moose::Inventory::Cli::Group do
94
94
 
95
95
  actual = runner { @app.start(%W(group add #{name})) }
96
96
 
97
- #@console.out(actual)
98
-
97
+ # @console.out(actual)
98
+
99
99
  # Check output
100
100
  desired = {}
101
101
  desired[:STDOUT] =
@@ -105,12 +105,11 @@ RSpec.describe Moose::Inventory::Cli::Group do
105
105
  " - OK\n"\
106
106
  " - all OK\n"\
107
107
  "Succeeded, with warnings.\n"
108
- desired[:STDERR] =
108
+ desired[:STDERR] =
109
109
  "WARNING: Group '#{name}' already exists, skipping creation.\n"
110
110
 
111
111
  expected(actual, desired)
112
112
 
113
-
114
113
  expected(actual, desired)
115
114
  end
116
115
 
@@ -120,16 +119,16 @@ RSpec.describe Moose::Inventory::Cli::Group do
120
119
 
121
120
  actual = runner { @app.start(%w(group add) + names) }
122
121
 
123
- #@console.out(actual)
124
-
122
+ # @console.out(actual)
123
+
125
124
  # Check output
126
- desired = {STDOUT: ''}
125
+ desired = { STDOUT: '' }
127
126
  names.each do |name|
128
- desired[:STDOUT] = desired[:STDOUT] +
129
- "Add group '#{name}':\n"\
130
- " - create group...\n"\
131
- " - OK\n"\
132
- " - all OK\n"\
127
+ desired[:STDOUT] = desired[:STDOUT] +
128
+ "Add group '#{name}':\n"\
129
+ " - create group...\n"\
130
+ " - OK\n"\
131
+ " - all OK\n"\
133
132
  end
134
133
  desired[:STDOUT] = desired[:STDOUT] + "Succeeded\n"
135
134
 
@@ -145,7 +144,7 @@ RSpec.describe Moose::Inventory::Cli::Group do
145
144
  # --------------------
146
145
  it 'GROUP1 --hosts HOST1 ... should add the '\
147
146
  'group and associate it with existing hosts' do
148
-
147
+
149
148
  host_name = 'test-host'
150
149
  @db.models[:host].create(name: host_name)
151
150
 
@@ -154,8 +153,8 @@ RSpec.describe Moose::Inventory::Cli::Group do
154
153
  @app.start(%W(group add #{group_name} --hosts #{host_name}))
155
154
  end
156
155
 
157
- #@console.out(actual)
158
-
156
+ # @console.out(actual)
157
+
159
158
  # Check output
160
159
  desired = {}
161
160
  desired[:STDOUT] =
@@ -179,57 +178,57 @@ RSpec.describe Moose::Inventory::Cli::Group do
179
178
 
180
179
  # --------------------
181
180
  it 'GROUP1 --hosts HOST ... should create HOST if necessary, and warn' do
182
- host_name = 'test-host'
183
-
184
- # DON'T CREATE THE HOST! That's the point!
185
-
186
- group_name = 'test-group'
187
- actual = runner do
188
- @app.start(%W(group add #{group_name} --hosts #{host_name}))
189
- end
190
-
191
- #@console.out(actual)
192
-
193
- # Check output
194
- desired = {}
195
- desired[:STDOUT] =
196
- "Add group '#{group_name}':\n"\
197
- " - create group...\n"\
198
- " - OK\n"\
199
- " - add association {group:#{group_name} <-> host:#{host_name}}...\n"\
200
- " - host doesn't exist, creating now...\n"\
201
- " - OK\n"\
202
- " - OK\n"\
203
- " - all OK\n"\
204
- "Succeeded, with warnings.\n"
205
- desired[:STDERR] =
206
- "WARNING: Host '#{host_name}' doesn't exist, but will be created.\n"
207
-
208
- expected(actual, desired)
209
-
210
- # Check db
211
- group = @db.models[:group].find(name: group_name)
212
- hosts = group.hosts_dataset
213
- expect(hosts).not_to be_nil
214
- expect(hosts.count).to eq(1)
215
- expect(hosts[name: host_name]).not_to be_nil
181
+ host_name = 'test-host'
182
+
183
+ # DON'T CREATE THE HOST! That's the point!
184
+
185
+ group_name = 'test-group'
186
+ actual = runner do
187
+ @app.start(%W(group add #{group_name} --hosts #{host_name}))
188
+ end
189
+
190
+ # @console.out(actual)
191
+
192
+ # Check output
193
+ desired = {}
194
+ desired[:STDOUT] =
195
+ "Add group '#{group_name}':\n"\
196
+ " - create group...\n"\
197
+ " - OK\n"\
198
+ " - add association {group:#{group_name} <-> host:#{host_name}}...\n"\
199
+ " - host doesn't exist, creating now...\n"\
200
+ " - OK\n"\
201
+ " - OK\n"\
202
+ " - all OK\n"\
203
+ "Succeeded, with warnings.\n"
204
+ desired[:STDERR] =
205
+ "WARNING: Host '#{host_name}' doesn't exist, but will be created.\n"
206
+
207
+ expected(actual, desired)
208
+
209
+ # Check db
210
+ group = @db.models[:group].find(name: group_name)
211
+ hosts = group.hosts_dataset
212
+ expect(hosts).not_to be_nil
213
+ expect(hosts.count).to eq(1)
214
+ expect(hosts[name: host_name]).not_to be_nil
216
215
  end
217
216
 
218
217
  # --------------------
219
218
  it 'GROUP1 --hosts HOST ... should skip if association already exists, and warn' do
220
219
  host_name = 'test-host'
221
220
  group_name = 'test-group'
222
-
221
+
223
222
  # Create group and association
224
223
  runner { @app.start(%W(group add #{group_name} --hosts #{host_name})) }
225
-
224
+
226
225
  # Do it again, to prove that we skip
227
226
  actual = runner do
228
227
  @app.start(%W(group add #{group_name} --hosts #{host_name}))
229
228
  end
230
-
231
- #@console.out(actual, 'y')
232
-
229
+
230
+ # @console.out(actual, 'y')
231
+
233
232
  # Check output
234
233
  desired = {}
235
234
  desired[:STDOUT] =
@@ -242,12 +241,12 @@ RSpec.describe Moose::Inventory::Cli::Group do
242
241
  " - OK\n"\
243
242
  " - all OK\n"\
244
243
  "Succeeded, with warnings.\n"
245
- desired[:STDERR] =
244
+ desired[:STDERR] =
246
245
  "WARNING: Group '#{group_name}' already exists, skipping creation.\n"\
247
246
  "WARNING: Association {group:#{group_name} <-> host:#{host_name}} already exists, skipping creation.\n"
248
-
247
+
249
248
  expected(actual, desired)
250
-
249
+
251
250
  # Check db
252
251
  group = @db.models[:group].find(name: group_name)
253
252
  hosts = group.hosts_dataset
@@ -255,35 +254,35 @@ RSpec.describe Moose::Inventory::Cli::Group do
255
254
  expect(hosts.count).to eq(1)
256
255
  expect(hosts[name: host_name]).not_to be_nil
257
256
  end
258
-
257
+
259
258
  # --------------------
260
259
  it 'GROUP --hosts HOST1,HOST2 ... should add the group and '\
261
260
  'associate it with multiple hosts' do
262
-
261
+
263
262
  # The group should be added
264
263
  # Each host should be associated with the group
265
264
  # Each host should be removed from the automatic 'ungrouped' group
266
-
265
+
267
266
  group_name = 'test-group'
268
267
  host_names = %w(host1 host2 host3)
269
-
268
+
270
269
  # Add just the first host. This ensure that we cover paths for both
271
270
  # and existing host (with an 'ungrouped' association) and for none
272
- # existing groups.
271
+ # existing groups.
273
272
  tmp = runner { @app.start(%W(host add #{host_names[0]})) }
274
-
275
- #@console.out(tmp, 'y')
276
-
277
- # Now run the actual group addition
273
+
274
+ # @console.out(tmp, 'y')
275
+
276
+ # Now run the actual group addition
278
277
  actual = runner do
279
278
  @app.start(%W(group add #{group_name} --hosts #{host_names.join(',')}))
280
279
  end
281
-
282
- #@console.out(actual,'y')
283
-
280
+
281
+ # @console.out(actual,'y')
282
+
284
283
  # Check output
285
284
  desired = { aborted: false, STDERR: '', STDOUT: '' }
286
- desired[:STDOUT] =
285
+ desired[:STDOUT] =
287
286
  "Add group '#{group_name}':\n"\
288
287
  " - create group...\n"\
289
288
  " - OK\n"\
@@ -291,22 +290,22 @@ RSpec.describe Moose::Inventory::Cli::Group do
291
290
  " - OK\n"\
292
291
  " - remove automatic association {group:ungrouped <-> host:#{host_names[0]}}...\n"\
293
292
  " - OK\n"
294
-
295
- host_names.slice(1, host_names.length - 1 ).each do |host_name|
296
- desired[:STDOUT] = desired[:STDOUT] +
297
- " - add association {group:#{group_name} <-> host:#{host_name}}...\n"\
298
- " - host doesn't exist, creating now...\n"\
299
- " - OK\n"\
300
- " - OK\n"
301
- desired[:STDERR] = desired[:STDERR] +
302
- "WARNING: Host '#{host_name}' doesn't exist, but will be created.\n"
293
+
294
+ host_names.slice(1, host_names.length - 1).each do |host_name|
295
+ desired[:STDOUT] = desired[:STDOUT] +
296
+ " - add association {group:#{group_name} <-> host:#{host_name}}...\n"\
297
+ " - host doesn't exist, creating now...\n"\
298
+ " - OK\n"\
299
+ " - OK\n"
300
+ desired[:STDERR] = desired[:STDERR] +
301
+ "WARNING: Host '#{host_name}' doesn't exist, but will be created.\n"
303
302
  end
304
- desired[:STDOUT] = desired[:STDOUT] +
305
- " - all OK\n"\
306
- "Succeeded, with warnings.\n"
307
-
303
+ desired[:STDOUT] = desired[:STDOUT] +
304
+ " - all OK\n"\
305
+ "Succeeded, with warnings.\n"
306
+
308
307
  expected(actual, desired)
309
-
308
+
310
309
  # Check db
311
310
  group = @db.models[:group].find(name: group_name)
312
311
  hosts = group.hosts_dataset
@@ -323,16 +322,16 @@ RSpec.describe Moose::Inventory::Cli::Group do
323
322
  'with an error' do
324
323
  name = 'testhost'
325
324
  group_names = %w(group1 ungrouped)
326
-
325
+
327
326
  actual = runner do
328
327
  @app.start(%W(host add #{name} --groups #{group_names.join(',')}))
329
328
  end
330
-
329
+
331
330
  # Check output
332
331
  desired = { aborted: true, STDERR: '', STDOUT: '' }
333
332
  desired[:STDERR] =
334
- "ERROR: Cannot manually manipulate the automatic group 'ungrouped'.\n"
335
-
333
+ "ERROR: Cannot manually manipulate the automatic group 'ungrouped'.\n"
334
+
336
335
  expected(actual, desired)
337
336
  end
338
337
 
@@ -347,38 +346,38 @@ RSpec.describe Moose::Inventory::Cli::Group do
347
346
  actual = runner do
348
347
  @app.start(%w(group add) + group_names + %W(--hosts #{host_names.join(',')}))
349
348
  end
350
-
351
- #@console.out(actual,'y')
352
-
349
+
350
+ # @console.out(actual,'y')
351
+
353
352
  # Check output
354
353
  desired = { aborted: false, STDERR: '', STDOUT: '' }
355
354
  first_pass = true
356
355
  group_names.each do |group|
357
- desired[:STDOUT] = desired[:STDOUT] +
358
- "Add group '#{group}':\n"\
359
- " - create group...\n"\
360
- " - OK\n"
361
-
356
+ desired[:STDOUT] = desired[:STDOUT] +
357
+ "Add group '#{group}':\n"\
358
+ " - create group...\n"\
359
+ " - OK\n"
360
+
362
361
  host_names.each do |host|
363
- desired[:STDOUT] = desired[:STDOUT] +
364
- " - add association {group:#{group} <-> host:#{host}}...\n"
362
+ desired[:STDOUT] = desired[:STDOUT] +
363
+ " - add association {group:#{group} <-> host:#{host}}...\n"
365
364
  if first_pass
366
- desired[:STDOUT] = desired[:STDOUT] +
367
- " - host doesn't exist, creating now...\n"\
368
- " - OK\n"
365
+ desired[:STDOUT] = desired[:STDOUT] +
366
+ " - host doesn't exist, creating now...\n"\
367
+ " - OK\n"
369
368
  end
370
- desired[:STDOUT] = desired[:STDOUT] +
371
- " - OK\n"
369
+ desired[:STDOUT] = desired[:STDOUT] +
370
+ " - OK\n"
372
371
  end
373
- desired[:STDOUT] = desired[:STDOUT] +
374
- " - all OK\n"
372
+ desired[:STDOUT] = desired[:STDOUT] +
373
+ " - all OK\n"
375
374
  first_pass = false
376
- end
377
-
375
+ end
376
+
378
377
  desired[:STDOUT] = desired[:STDOUT] + "Succeeded, with warnings.\n"
379
378
  host_names.each do |host|
380
- desired[:STDERR] = desired[:STDERR] +
381
- "WARNING: Host '#{host}' doesn't exist, but will be created.\n"
379
+ desired[:STDERR] = desired[:STDERR] +
380
+ "WARNING: Host '#{host}' doesn't exist, but will be created.\n"
382
381
  end
383
382
  expected(actual, desired)
384
383