hammer_cli_foreman 2.0.0 → 2.1.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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/doc/developer_docs.md +1 -0
  3. data/doc/plugin.md +22 -0
  4. data/doc/release_notes.md +33 -0
  5. data/lib/hammer_cli_foreman.rb +9 -1
  6. data/lib/hammer_cli_foreman/api/connection.rb +1 -18
  7. data/lib/hammer_cli_foreman/api/oauth/authentication_code_grant.rb +7 -4
  8. data/lib/hammer_cli_foreman/api/session_authenticator_wrapper.rb +0 -1
  9. data/lib/hammer_cli_foreman/associating_commands.rb +33 -5
  10. data/lib/hammer_cli_foreman/audit.rb +7 -0
  11. data/lib/hammer_cli_foreman/auth.rb +6 -6
  12. data/lib/hammer_cli_foreman/bookmark.rb +50 -0
  13. data/lib/hammer_cli_foreman/command_extensions.rb +2 -0
  14. data/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb +13 -7
  15. data/lib/hammer_cli_foreman/command_extensions/puppet_environments.rb +13 -7
  16. data/lib/hammer_cli_foreman/command_extensions/subnet.rb +25 -0
  17. data/lib/hammer_cli_foreman/command_extensions/user.rb +17 -0
  18. data/lib/hammer_cli_foreman/commands.rb +20 -11
  19. data/lib/hammer_cli_foreman/compute_resource.rb +15 -0
  20. data/lib/hammer_cli_foreman/compute_resource/ec2.rb +11 -0
  21. data/lib/hammer_cli_foreman/compute_resource/gce.rb +9 -0
  22. data/lib/hammer_cli_foreman/compute_resource/libvirt.rb +11 -0
  23. data/lib/hammer_cli_foreman/compute_resource/openstack.rb +7 -0
  24. data/lib/hammer_cli_foreman/compute_resource/ovirt.rb +21 -9
  25. data/lib/hammer_cli_foreman/compute_resource/vmware.rb +15 -2
  26. data/lib/hammer_cli_foreman/hostgroup.rb +11 -19
  27. data/lib/hammer_cli_foreman/hosts/common_update_options.rb +32 -10
  28. data/lib/hammer_cli_foreman/id_resolver.rb +12 -11
  29. data/lib/hammer_cli_foreman/mail_notification.rb +31 -0
  30. data/lib/hammer_cli_foreman/operating_system.rb +1 -1
  31. data/lib/hammer_cli_foreman/option_builders.rb +70 -48
  32. data/lib/hammer_cli_foreman/option_sources.rb +1 -0
  33. data/lib/hammer_cli_foreman/option_sources/referenced_resource_id_params.rb +47 -0
  34. data/lib/hammer_cli_foreman/sessions.rb +1 -3
  35. data/lib/hammer_cli_foreman/subnet.rb +26 -15
  36. data/lib/hammer_cli_foreman/task_helper.rb +180 -0
  37. data/lib/hammer_cli_foreman/user.rb +7 -17
  38. data/lib/hammer_cli_foreman/user_mail_notification.rb +51 -0
  39. data/lib/hammer_cli_foreman/version.rb +1 -1
  40. data/lib/hammer_cli_foreman/virtual_machine.rb +55 -0
  41. data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  42. data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  43. data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  44. data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  45. data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  46. data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  47. data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  48. data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  49. data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  50. data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  51. data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  52. data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  53. data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  54. data/test/data/2.1/foreman_api.json +1 -0
  55. data/test/functional/associating_commands_test.rb +134 -30
  56. data/test/functional/bookmark_test.rb +193 -0
  57. data/test/functional/host_test.rb +27 -1
  58. data/test/functional/http_proxy_test.rb +1 -4
  59. data/test/functional/mail_notification_test.rb +57 -0
  60. data/test/functional/subnet/create_test.rb +28 -5
  61. data/test/functional/template_test.rb +2 -2
  62. data/test/functional/user_mail_notification_test.rb +89 -0
  63. data/test/functional/virtual_machine_test.rb +129 -0
  64. data/test/reports/TEST-Minitest-Result.xml +4344 -0
  65. data/test/test_helper.rb +1 -1
  66. data/test/unit/audit_test.rb +1 -0
  67. data/test/unit/sessions_test.rb +2 -13
  68. metadata +28 -6
@@ -17,7 +17,7 @@ require "mocha/minitest"
17
17
  require 'hammer_cli'
18
18
  require 'hammer_cli_foreman/testing/api_expectations'
19
19
 
20
- FOREMAN_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '2.0')
20
+ FOREMAN_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '2.1')
21
21
 
22
22
  include HammerCLIForeman::Testing::APIExpectations
23
23
  HammerCLI.context[:api_connection].create('foreman') do
@@ -54,6 +54,7 @@ describe HammerCLIForeman::Audit do
54
54
  it_should_print_column "Audit type"
55
55
  it_should_print_column "Audit record"
56
56
  it_should_print_column "Audited changes"
57
+ it_should_print_column "Request UUID"
57
58
  end
58
59
  end
59
60
  end
@@ -13,7 +13,6 @@ describe HammerCLIForeman do
13
13
  HammerCLIForeman::Sessions.stubs(:storage).returns(dir)
14
14
  session = HammerCLIForeman::Sessions.get('http://example.com')
15
15
  session.id.must_be_nil
16
- session.auth_type.must_be_nil
17
16
  session.user_name.must_be_nil
18
17
  end
19
18
  end
@@ -24,8 +23,7 @@ describe HammerCLIForeman do
24
23
  HammerCLIForeman::Sessions.stubs(:storage).returns(dir)
25
24
  session_content = {
26
25
  :id => '3040b0f04c3a35a499e6837278904d48',
27
- :user_name => 'admin',
28
- :auth_type => 'basic_auth'
26
+ :user_name => 'admin'
29
27
  }
30
28
  session_path = "#{dir}/http_example.com"
31
29
  File.open(session_path,"w") do |f|
@@ -35,7 +33,6 @@ describe HammerCLIForeman do
35
33
 
36
34
  session = HammerCLIForeman::Sessions.get('http://example.com')
37
35
  session.id.must_equal '3040b0f04c3a35a499e6837278904d48'
38
- session.auth_type.must_equal 'basic_auth'
39
36
  session.user_name.must_equal 'admin'
40
37
  end
41
38
  end
@@ -67,8 +64,7 @@ describe HammerCLIForeman do
67
64
  HammerCLIForeman::Sessions.stubs(:storage).returns(dir)
68
65
  session_content = {
69
66
  :id => '3040b0f04c3a35a499e6837278904d48',
70
- :user_name => 'admin',
71
- :auth_type => 'basic_auth'
67
+ :user_name => 'admin'
72
68
  }
73
69
  session_path = "#{dir}/http_example.com"
74
70
  File.open(session_path,"w") do |f|
@@ -124,13 +120,11 @@ describe HammerCLIForeman do
124
120
  Tempfile.create('session') do |f|
125
121
  session = HammerCLIForeman::Session.new(f.path)
126
122
  session.id = '3040b0f04c3a35a499e6837278904d48'
127
- session.auth_type = 'basic_auth'
128
123
  session.user_name = 'admin'
129
124
  session.store
130
125
 
131
126
  session = HammerCLIForeman::Session.new(f.path)
132
127
  session.id.must_equal '3040b0f04c3a35a499e6837278904d48'
133
- session.auth_type.must_equal 'basic_auth'
134
128
  session.user_name.must_equal 'admin'
135
129
  end
136
130
  end
@@ -150,7 +144,6 @@ describe HammerCLIForeman do
150
144
  _, err = capture_io do
151
145
  session = HammerCLIForeman::Session.new(f.path)
152
146
  session.id = nil
153
- session.auth_type = nil
154
147
  session.user_name = nil
155
148
  end
156
149
  err.must_equal("Invalid session data. Resetting the session.\n")
@@ -162,13 +155,11 @@ describe HammerCLIForeman do
162
155
  Tempfile.create('session') do |f|
163
156
  session = HammerCLIForeman::Session.new(f.path)
164
157
  session.id = '3040b0f04c3a35a499e6837278904d48'
165
- session.auth_type = 'basic_auth'
166
158
  session.user_name = 'admin'
167
159
  session.destroy
168
160
 
169
161
  session = HammerCLIForeman::Session.new(f.path)
170
162
  session.id.must_be_nil
171
- session.auth_type.must_equal 'basic_auth'
172
163
  session.user_name.must_equal 'admin'
173
164
  end
174
165
  end
@@ -179,7 +170,6 @@ describe HammerCLIForeman do
179
170
  Tempfile.create('session') do |f|
180
171
  session = HammerCLIForeman::Session.new(f.path)
181
172
  session.id = nil
182
- session.auth_type = 'basic_auth'
183
173
  session.user_name = 'admin'
184
174
  session.valid?.must_equal false
185
175
  end
@@ -189,7 +179,6 @@ describe HammerCLIForeman do
189
179
  Tempfile.create('session') do |f|
190
180
  session = HammerCLIForeman::Session.new(f.path)
191
181
  session.id = '34252624635723572357234'
192
- session.auth_type = 'basic_auth'
193
182
  session.user_name = 'admin'
194
183
  session.valid?.must_equal true
195
184
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomáš Strachota
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-02-12 00:00:00.000000000 Z
12
+ date: 2020-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hammer_cli
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 2.0.0
20
+ version: 2.1.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 2.0.0
27
+ version: 2.1.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: apipie-bindings
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -75,13 +75,14 @@ dependencies:
75
75
  version: 2.2.1
76
76
  description: 'Foreman commands for Hammer CLI
77
77
 
78
- '
78
+ '
79
79
  email: tstracho@redhat.com
80
80
  executables: []
81
81
  extensions: []
82
82
  extra_rdoc_files:
83
83
  - doc/host_create.md
84
84
  - doc/release_notes.md
85
+ - doc/plugin.md
85
86
  - doc/configuration.md
86
87
  - doc/name_id_resolution.md
87
88
  - doc/developer_docs.md
@@ -98,6 +99,7 @@ files:
98
99
  - doc/host_create.md
99
100
  - doc/name_id_resolution.md
100
101
  - doc/option_builder.md
102
+ - doc/plugin.md
101
103
  - doc/release_notes.md
102
104
  - doc/testing.md
103
105
  - doc/using_hammer_cli_foreman_command.md
@@ -118,6 +120,7 @@ files:
118
120
  - lib/hammer_cli_foreman/auth_source_external.rb
119
121
  - lib/hammer_cli_foreman/auth_source_ldap.rb
120
122
  - lib/hammer_cli_foreman/authenticate/login.rb
123
+ - lib/hammer_cli_foreman/bookmark.rb
121
124
  - lib/hammer_cli_foreman/combination.rb
122
125
  - lib/hammer_cli_foreman/command_extensions.rb
123
126
  - lib/hammer_cli_foreman/command_extensions/fields.rb
@@ -130,6 +133,8 @@ files:
130
133
  - lib/hammer_cli_foreman/command_extensions/puppet_environment.rb
131
134
  - lib/hammer_cli_foreman/command_extensions/puppet_environments.rb
132
135
  - lib/hammer_cli_foreman/command_extensions/status.rb
136
+ - lib/hammer_cli_foreman/command_extensions/subnet.rb
137
+ - lib/hammer_cli_foreman/command_extensions/user.rb
133
138
  - lib/hammer_cli_foreman/commands.rb
134
139
  - lib/hammer_cli_foreman/common_parameter.rb
135
140
  - lib/hammer_cli_foreman/compute_attribute.rb
@@ -165,6 +170,7 @@ files:
165
170
  - lib/hammer_cli_foreman/interface.rb
166
171
  - lib/hammer_cli_foreman/location.rb
167
172
  - lib/hammer_cli_foreman/logger.rb
173
+ - lib/hammer_cli_foreman/mail_notification.rb
168
174
  - lib/hammer_cli_foreman/media.rb
169
175
  - lib/hammer_cli_foreman/model.rb
170
176
  - lib/hammer_cli_foreman/openid_connect.rb
@@ -176,6 +182,7 @@ files:
176
182
  - lib/hammer_cli_foreman/option_sources/ids_params.rb
177
183
  - lib/hammer_cli_foreman/option_sources/new_params.rb
178
184
  - lib/hammer_cli_foreman/option_sources/puppet_environment_params.rb
185
+ - lib/hammer_cli_foreman/option_sources/referenced_resource_id_params.rb
179
186
  - lib/hammer_cli_foreman/option_sources/self_param.rb
180
187
  - lib/hammer_cli_foreman/option_sources/user_params.rb
181
188
  - lib/hammer_cli_foreman/organization.rb
@@ -201,12 +208,15 @@ files:
201
208
  - lib/hammer_cli_foreman/ssh_keys.rb
202
209
  - lib/hammer_cli_foreman/status.rb
203
210
  - lib/hammer_cli_foreman/subnet.rb
211
+ - lib/hammer_cli_foreman/task_helper.rb
204
212
  - lib/hammer_cli_foreman/template.rb
205
213
  - lib/hammer_cli_foreman/testing/api_expectations.rb
206
214
  - lib/hammer_cli_foreman/trend.rb
207
215
  - lib/hammer_cli_foreman/user.rb
216
+ - lib/hammer_cli_foreman/user_mail_notification.rb
208
217
  - lib/hammer_cli_foreman/usergroup.rb
209
218
  - lib/hammer_cli_foreman/version.rb
219
+ - lib/hammer_cli_foreman/virtual_machine.rb
210
220
  - locale/ca/LC_MESSAGES/hammer-cli-foreman.mo
211
221
  - locale/de/LC_MESSAGES/hammer-cli-foreman.mo
212
222
  - locale/en/LC_MESSAGES/hammer-cli-foreman.mo
@@ -233,10 +243,12 @@ files:
233
243
  - test/data/1.22/foreman_api.json
234
244
  - test/data/1.24/foreman_api.json
235
245
  - test/data/2.0/foreman_api.json
246
+ - test/data/2.1/foreman_api.json
236
247
  - test/data/README.md
237
248
  - test/functional/associating_commands_test.rb
238
249
  - test/functional/audit_test.rb
239
250
  - test/functional/auth_source_test.rb
251
+ - test/functional/bookmark_test.rb
240
252
  - test/functional/commands/list_test.rb
241
253
  - test/functional/compute_attribute_test.rb
242
254
  - test/functional/compute_profile_test.rb
@@ -247,6 +259,7 @@ files:
247
259
  - test/functional/hostgroup/update_test.rb
248
260
  - test/functional/http_proxy_test.rb
249
261
  - test/functional/location_test.rb
262
+ - test/functional/mail_notification_test.rb
250
263
  - test/functional/organization_test.rb
251
264
  - test/functional/personal_access_token_test.rb
252
265
  - test/functional/ping_test.rb
@@ -262,7 +275,10 @@ files:
262
275
  - test/functional/template_test.rb
263
276
  - test/functional/test_helper.rb
264
277
  - test/functional/trend_test.rb
278
+ - test/functional/user_mail_notification_test.rb
265
279
  - test/functional/user_test.rb
280
+ - test/functional/virtual_machine_test.rb
281
+ - test/reports/TEST-Minitest-Result.xml
266
282
  - test/test_helper.rb
267
283
  - test/unit/api/interactive_basic_auth_test.rb
268
284
  - test/unit/api/oauth/oauth_authentication_code_grant_test.rb
@@ -340,7 +356,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
340
356
  - !ruby/object:Gem::Version
341
357
  version: '0'
342
358
  requirements: []
343
- rubygems_version: 3.0.3
359
+ rubygems_version: 3.0.8
344
360
  signing_key:
345
361
  specification_version: 4
346
362
  summary: Foreman commands for Hammer
@@ -402,6 +418,7 @@ test_files:
402
418
  - test/unit/commands_test.rb
403
419
  - test/unit/common_parameter_test.rb
404
420
  - test/unit/subnet_test.rb
421
+ - test/data/2.1/foreman_api.json
405
422
  - test/data/2.0/foreman_api.json
406
423
  - test/data/1.24/foreman_api.json
407
424
  - test/data/1.18/foreman_api.json
@@ -418,10 +435,12 @@ test_files:
418
435
  - test/data/1.16/foreman_api.json
419
436
  - test/functional/http_proxy_test.rb
420
437
  - test/functional/commands/list_test.rb
438
+ - test/functional/user_mail_notification_test.rb
421
439
  - test/functional/user_test.rb
422
440
  - test/functional/personal_access_token_test.rb
423
441
  - test/functional/audit_test.rb
424
442
  - test/functional/test_helper.rb
443
+ - test/functional/mail_notification_test.rb
425
444
  - test/functional/ping_test.rb
426
445
  - test/functional/smart_class_parameter_test.rb
427
446
  - test/functional/role_test.rb
@@ -445,4 +464,7 @@ test_files:
445
464
  - test/functional/status_test.rb
446
465
  - test/functional/associating_commands_test.rb
447
466
  - test/functional/auth_source_test.rb
467
+ - test/functional/virtual_machine_test.rb
468
+ - test/functional/bookmark_test.rb
448
469
  - test/test_helper.rb
470
+ - test/reports/TEST-Minitest-Result.xml