hammer_cli_foreman 0.12.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/doc/host_create.md +1 -2
  4. data/doc/release_notes.md +14 -3
  5. data/lib/hammer_cli_foreman.rb +5 -0
  6. data/lib/hammer_cli_foreman/audit.rb +72 -0
  7. data/lib/hammer_cli_foreman/auth_source.rb +15 -1
  8. data/lib/hammer_cli_foreman/host.rb +14 -0
  9. data/lib/hammer_cli_foreman/hosts/common_update_options.rb +2 -3
  10. data/lib/hammer_cli_foreman/id_resolver.rb +1 -0
  11. data/lib/hammer_cli_foreman/image.rb +5 -11
  12. data/lib/hammer_cli_foreman/logger.rb +5 -0
  13. data/lib/hammer_cli_foreman/personal_access_token.rb +45 -0
  14. data/lib/hammer_cli_foreman/smart_proxy.rb +29 -3
  15. data/lib/hammer_cli_foreman/user.rb +3 -0
  16. data/lib/hammer_cli_foreman/version.rb +1 -1
  17. data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  18. data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  19. data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  20. data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  21. data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  22. data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  23. data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  24. data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  25. data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  26. data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  27. data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  28. data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  29. data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  30. data/test/data/1.17/foreman_api.json +1 -0
  31. data/test/data/1.18/foreman_api.json +1 -0
  32. data/test/functional/audit_test.rb +126 -0
  33. data/test/functional/auth_source_test.rb +54 -0
  34. data/test/functional/host_test.rb +52 -0
  35. data/test/functional/hostgroup/create_test.rb +18 -12
  36. data/test/functional/hostgroup/update_test.rb +12 -12
  37. data/test/functional/personal_access_token_test.rb +123 -0
  38. data/test/functional/proxy_test.rb +86 -0
  39. data/test/test_helper.rb +1 -1
  40. data/test/unit/audit_test.rb +60 -0
  41. data/test/unit/helpers/command.rb +8 -1
  42. data/test/unit/host_test.rb +4 -3
  43. metadata +22 -5
@@ -23,7 +23,14 @@ class IdResolverTestProxy
23
23
  @original_resolver.api.resources.each do |resource|
24
24
  method_name = "#{resource.singular_name}_id"
25
25
  self.class.send(:define_method, method_name) do |options|
26
- 1
26
+ value = options[HammerCLI.option_accessor_name("id")]
27
+ value ||= HammerCLI::NilValue if searchables(resource).any? do |s|
28
+ options[HammerCLI.option_accessor_name(s.name)] == HammerCLI::NilValue
29
+ end
30
+ value ||= 1 if searchables(resource).any? do |s|
31
+ !options[HammerCLI.option_accessor_name(s.name)].nil?
32
+ end
33
+ value
27
34
  end
28
35
 
29
36
  method_name = "#{resource.singular_name}_ids"
@@ -208,11 +208,12 @@ describe HammerCLIForeman::Host do
208
208
  end
209
209
 
210
210
  context "parameters" do
211
+ taxonomies = ["--organization-id=1", "--location-id=1"]
211
212
  it_should_accept "name, environment_id, architecture_id, domain_id, puppet_proxy_id, operatingsystem_id and more",
212
213
  ["--name=host", "--environment-id=1", "--architecture-id=1", "--domain-id=1", "--puppet-proxy-id=1", "--operatingsystem-id=1",
213
214
  "--ip=1.2.3.4", "--mac=11:22:33:44:55:66", "--medium-id=1", "--partition-table-id=1", "--subnet-id=1",
214
215
  "--model-id=1", "--hostgroup-id=1", "--owner-id=1", '--puppet-ca-proxy-id=1', '--puppet-class-ids',
215
- "--root-password=pwd", "--ask-root-password=true", "--provision-method=build", "--interface=primary=true,provision=true"]
216
+ "--root-password=pwd", "--ask-root-password=true", "--provision-method=build", "--interface=primary=true,provision=true"] + taxonomies
216
217
  it_should_fail_with "name or id missing",
217
218
  ["--environment-id=1", "--architecture-id=1", "--domain-id=1", "--puppet-proxy-id=1", "--operatingsystem-id=1", "--interface=primary=true,provision=true"]
218
219
  it_should_fail_with "environment_id missing",
@@ -225,8 +226,8 @@ describe HammerCLIForeman::Host do
225
226
  ["--name=host", "--environment-id=1", "--architecture-id=1", "--domain-id=1", "--operatingsystem-id=1", "--interface=primary=true,provision=true"]
226
227
  it_should_fail_with "operatingsystem_id missing",
227
228
  ["--name=host", "--environment-id=1", "--architecture-id=1", "--domain-id=1", "--puppet-proxy-id=1", "--interface=primary=true,provision=true"]
228
- it_should_accept "only hostgroup name", ["--hostgroup=example", "--name=host", "--interface=primary=true,provision=true"]
229
- it_should_accept "only hostgroup ID", ["--hostgroup-id=1", "--name=host", "--interface=primary=true,provision=true"]
229
+ it_should_accept "only hostgroup name", ["--hostgroup=example", "--name=host", "--interface=primary=true,provision=true"] + taxonomies
230
+ it_should_accept "only hostgroup ID", ["--hostgroup-id=1", "--name=host", "--interface=primary=true,provision=true"] + taxonomies
230
231
 
231
232
  with_params ["--name=host", "--environment-id=1", "--architecture-id=1", "--domain-id=1", "--puppet-proxy-id=1", "--operatingsystem-id=1",
232
233
  "--ip=1.2.3.4", "--mac=11:22:33:44:55:66", "--medium-id=1", "--partition-table-id=1", "--subnet-id=1",
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: 0.12.1
4
+ version: 0.13.0
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: 2018-03-05 00:00:00.000000000 Z
12
+ date: 2018-05-09 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: 0.12.0
20
+ version: 0.13.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: 0.12.0
27
+ version: 0.13.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: apipie-bindings
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -95,6 +95,7 @@ files:
95
95
  - lib/hammer_cli_foreman/api/void_auth.rb
96
96
  - lib/hammer_cli_foreman/architecture.rb
97
97
  - lib/hammer_cli_foreman/associating_commands.rb
98
+ - lib/hammer_cli_foreman/audit.rb
98
99
  - lib/hammer_cli_foreman/auth.rb
99
100
  - lib/hammer_cli_foreman/auth_source.rb
100
101
  - lib/hammer_cli_foreman/auth_source_ldap.rb
@@ -135,6 +136,7 @@ files:
135
136
  - lib/hammer_cli_foreman/image.rb
136
137
  - lib/hammer_cli_foreman/interface.rb
137
138
  - lib/hammer_cli_foreman/location.rb
139
+ - lib/hammer_cli_foreman/logger.rb
138
140
  - lib/hammer_cli_foreman/media.rb
139
141
  - lib/hammer_cli_foreman/model.rb
140
142
  - lib/hammer_cli_foreman/operating_system.rb
@@ -151,6 +153,7 @@ files:
151
153
  - lib/hammer_cli_foreman/param_filters.rb
152
154
  - lib/hammer_cli_foreman/parameter.rb
153
155
  - lib/hammer_cli_foreman/partition_table.rb
156
+ - lib/hammer_cli_foreman/personal_access_token.rb
154
157
  - lib/hammer_cli_foreman/puppet_class.rb
155
158
  - lib/hammer_cli_foreman/realm.rb
156
159
  - lib/hammer_cli_foreman/references.rb
@@ -187,7 +190,11 @@ files:
187
190
  - test/data/1.14/foreman_api.json
188
191
  - test/data/1.15/foreman_api.json
189
192
  - test/data/1.16/foreman_api.json
193
+ - test/data/1.17/foreman_api.json
194
+ - test/data/1.18/foreman_api.json
190
195
  - test/data/README.md
196
+ - test/functional/audit_test.rb
197
+ - test/functional/auth_source_test.rb
191
198
  - test/functional/commands/list_test.rb
192
199
  - test/functional/compute_resource_test.rb
193
200
  - test/functional/filter_test.rb
@@ -196,6 +203,8 @@ files:
196
203
  - test/functional/hostgroup/update_test.rb
197
204
  - test/functional/location_test.rb
198
205
  - test/functional/organization_test.rb
206
+ - test/functional/personal_access_token_test.rb
207
+ - test/functional/proxy_test.rb
199
208
  - test/functional/role_test.rb
200
209
  - test/functional/smart_class_parameter_test.rb
201
210
  - test/functional/smart_variable_test.rb
@@ -451,6 +460,7 @@ files:
451
460
  - test/unit/api_test.rb
452
461
  - test/unit/apipie_resource_mock.rb
453
462
  - test/unit/architecture_test.rb
463
+ - test/unit/audit_test.rb
454
464
  - test/unit/auth_source_ldap_test.rb
455
465
  - test/unit/commands_test.rb
456
466
  - test/unit/common_parameter_test.rb
@@ -516,7 +526,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
516
526
  version: '0'
517
527
  requirements: []
518
528
  rubyforge_project:
519
- rubygems_version: 2.6.14
529
+ rubygems_version: 2.6.14.1
520
530
  signing_key:
521
531
  specification_version: 4
522
532
  summary: Foreman commands for Hammer
@@ -801,6 +811,7 @@ test_files:
801
811
  - test/unit/domain_test.rb
802
812
  - test/unit/test_output_adapter.rb
803
813
  - test/unit/realm_test.rb
814
+ - test/unit/audit_test.rb
804
815
  - test/unit/model_test.rb
805
816
  - test/unit/dependency_resolver_test.rb
806
817
  - test/unit/architecture_test.rb
@@ -820,19 +831,25 @@ test_files:
820
831
  - test/functional/commands/list_test.rb
821
832
  - test/functional/role_test.rb
822
833
  - test/functional/compute_resource_test.rb
834
+ - test/functional/proxy_test.rb
823
835
  - test/functional/user_test.rb
824
836
  - test/functional/filter_test.rb
825
837
  - test/functional/host_test.rb
838
+ - test/functional/auth_source_test.rb
826
839
  - test/functional/organization_test.rb
827
840
  - test/functional/hostgroup/update_test.rb
828
841
  - test/functional/hostgroup/create_test.rb
842
+ - test/functional/audit_test.rb
843
+ - test/functional/personal_access_token_test.rb
829
844
  - test/functional/template_test.rb
830
845
  - test/functional/test_helper.rb
831
846
  - test/data/1.16/foreman_api.json
832
847
  - test/data/1.11/foreman_api.json
833
848
  - test/data/1.14/_foreman_api.json
834
849
  - test/data/1.14/foreman_api.json
850
+ - test/data/1.18/foreman_api.json
835
851
  - test/data/1.15/foreman_api.json
836
852
  - test/data/1.10/foreman_api.json
837
853
  - test/data/README.md
854
+ - test/data/1.17/foreman_api.json
838
855
  - test/test_helper.rb