hammer_cli_foreman 3.15.0 → 3.17.0

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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/doc/host_create.md +0 -27
  3. data/doc/release_notes.md +12 -0
  4. data/lib/hammer_cli_foreman/auth_source_ldap.rb +2 -1
  5. data/lib/hammer_cli_foreman/compute_resource/register_compute_resources.rb +0 -1
  6. data/lib/hammer_cli_foreman/compute_resource.rb +0 -31
  7. data/lib/hammer_cli_foreman/filter.rb +8 -66
  8. data/lib/hammer_cli_foreman/report_template.rb +1 -0
  9. data/lib/hammer_cli_foreman/template.rb +1 -0
  10. data/lib/hammer_cli_foreman/version.rb +1 -1
  11. data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  12. data/locale/cs_CZ/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  13. data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  14. data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  15. data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  16. data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  17. data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  18. data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  19. data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  20. data/locale/ka/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  21. data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  22. data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  23. data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  24. data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  25. data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  26. data/test/functional/compute_attribute_test.rb +25 -25
  27. data/test/functional/compute_profile_test.rb +2 -2
  28. data/test/functional/compute_resource_test.rb +1 -75
  29. data/test/functional/filter_test.rb +3 -124
  30. data/test/functional/virtual_machine_test.rb +2 -5
  31. data/test/unit/filter_test.rb +0 -10
  32. metadata +2 -3
  33. data/lib/hammer_cli_foreman/compute_resource/ovirt.rb +0 -70
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4080ad3a471b47ea68f872665fca82acc64f2288483fa77d487026c9765eea6
4
- data.tar.gz: c57ca48ff2872564c096cea2083cf233cdc862d65b19f7202cb0e20da48845d4
3
+ metadata.gz: 19aecc76c45aea21d165a63bf62ce10fec9774e4d552fd34e176dae195dcaf23
4
+ data.tar.gz: 18d5e71e31373b5b4ac1d744712f9a77b8a263e9eb612690f94b63f49eb5d0dd
5
5
  SHA512:
6
- metadata.gz: 444c1c313da816ecffc0e4d6c45d07977cc855168830cdb1393dba2b0d4cf135353a25acf955f0cfec172d069087ed9c1c08f0153db630d33cf9f7dd68589079
7
- data.tar.gz: 41dc813d04ca7ad2090c220701371b701bde0be770b8e464417fad8226856a70cbb5f22508d44a836fcb38603197348f3fec3a670a204cfa983adde3c12525a5
6
+ metadata.gz: ecd60a4cadea52d36350b5dc32a42a5741dab3bb2d99bc5568754879b55b2521c3f9da136490dfbde9d7ea745349ecdc2693dd2b0f50db7605f2ca460be29cd7
7
+ data.tar.gz: ae9865919068552dcafdf72d1d8da6a35f2b3d999c7d88251849e75c83bb54d9dba9e7982a5f91d5be735545e1f6d5928a224e999f6a2da6ef92ab81b263b035
data/doc/host_create.md CHANGED
@@ -225,33 +225,6 @@ security_groups
225
225
  network
226
226
  ```
227
227
 
228
- ## oVirt
229
- Available keys for `--compute-attributes`:
230
- ```
231
- cluster
232
- template # hardware profile to use
233
- cores # int value, number of cores
234
- sockets # int value, number of sockets
235
- memory # amount of memory, int value in bytes
236
- start # Must be a 1 or 0, whether to start the machine or not
237
- ```
238
-
239
- Available keys for `--interface`:
240
- ```
241
- compute_name # eg. eth0
242
- compute_network # select one of available networks for a cluster
243
- compute_interface # interface type
244
- ```
245
-
246
- Available keys for `--volume`:
247
- ```
248
- size_gb # volume size in GB, integer value
249
- storage_domain # select one of available storage domains
250
- bootable # boolean, only one volume can be bootable
251
- preallocate # boolean, set true to preallocate
252
- wipe_after_delete # boolean, set true to wipe disk after delete
253
- ```
254
-
255
228
  ## VMware
256
229
  Available keys for `--compute-attributes`:
257
230
  ```
data/doc/release_notes.md CHANGED
@@ -1,5 +1,17 @@
1
1
  Release notes
2
2
  =============
3
+ ### 3.17.0 (2025-11-11)
4
+ * Add packit commit trigger job
5
+ * Remove options related to filter overrides ([PR #645](https://github.com/theforeman/hammer-cli-foreman/pull/645)), [#38805](http://projects.theforeman.org/issues/38805)
6
+ * Add github actions workflow for releases
7
+ * Expose cloned from id in template info command
8
+ * Bump to 3.17.0-develop
9
+
10
+ ### 3.16.0 (2025-08-13)
11
+ * Ldap group membership ([PR #641](https://github.com/theforeman/hammer-cli-foreman/pull/641)), [#38611](http://projects.theforeman.org/issues/38611)
12
+ * Remove ovirt ([PR #639](https://github.com/theforeman/hammer-cli-foreman/pull/639)), [#38294](http://projects.theforeman.org/issues/38294)
13
+ * Bump to 3.16.0-develop
14
+
3
15
  ### 3.15.0 (2025-05-14)
4
16
  * Use 3.15 test data
5
17
  * Fix hammer insights inventory sync error message ([PR #640](https://github.com/theforeman/hammer-cli-foreman/pull/640)), [#38401](http://projects.theforeman.org/issues/38401)
@@ -30,7 +30,8 @@ module HammerCLIForeman
30
30
  field :account, _('Account Username')
31
31
  field :base_dn, _('Base DN')
32
32
  field :groups_base, _('Groups base DN')
33
- field :use_netgroups, _('Use Netgroups'), Fields::Boolean
33
+ field :use_netgroups, _('Use Netgroups'), Fields::Boolean, :replaced_by => [_('Account'), _('LDAP group membership')].join('/')
34
+ field :ldap_group_membership, _('LDAP group membership')
34
35
  field :ldap_filter, _('LDAP filter')
35
36
  field :onthefly_register, _('Automatically Create Accounts?'), Fields::Boolean
36
37
  field :usergroup_sync, _('Usergroup sync'), Fields::Boolean
@@ -12,6 +12,5 @@ module HammerCLIForeman
12
12
  require 'hammer_cli_foreman/compute_resource/ec2.rb'
13
13
  require 'hammer_cli_foreman/compute_resource/libvirt.rb'
14
14
  require 'hammer_cli_foreman/compute_resource/openstack.rb'
15
- require 'hammer_cli_foreman/compute_resource/ovirt.rb'
16
15
  require 'hammer_cli_foreman/compute_resource/vmware.rb'
17
16
  end
@@ -51,21 +51,11 @@ module HammerCLIForeman
51
51
 
52
52
 
53
53
  class CreateCommand < HammerCLIForeman::CreateCommand
54
- option "--public-key-path", "PUBLIC_KEY_PATH", _("Path to a file that contains oVirt public key (For oVirt only)"),
55
- :format => HammerCLI::Options::Normalizers::File.new
56
-
57
-
58
54
  success_message _("Compute resource created.")
59
55
  failure_message _("Could not create the compute resource")
60
56
 
61
57
  build_options
62
58
 
63
- def request_params
64
- params = super
65
- params['compute_resource']['public_key'] = option_public_key_path if option_public_key_path
66
- params
67
- end
68
-
69
59
  validate_options do
70
60
  if option(:option_provider).value.nil? || option(:option_name).value.nil?
71
61
  all(:option_name, :option_provider).required
@@ -82,17 +72,9 @@ module HammerCLIForeman
82
72
  end
83
73
 
84
74
  class UpdateCommand < HammerCLIForeman::UpdateCommand
85
- option "--public-key-path", "PUBLIC_KEY_PATH", _("Path to a file that contains oVirt public key (For oVirt only)"),
86
- :format => HammerCLI::Options::Normalizers::File.new
87
-
88
75
  success_message _("Compute resource updated.")
89
76
  failure_message _("Could not update the compute resource")
90
77
 
91
- def request_params
92
- params = super
93
- params['compute_resource']['public_key'] = option_public_key_path if option_public_key_path
94
- params
95
- end
96
78
  build_options :without => :name
97
79
  end
98
80
 
@@ -145,19 +127,6 @@ module HammerCLIForeman
145
127
  extend_with(HammerCLIForeman::CommandExtensions::ComputeResourceSubcommand.new(only: %i[option request_params]))
146
128
  end
147
129
 
148
- class AvailableVnicProfilesCommand < HammerCLIForeman::ListCommand
149
- action :available_vnic_profiles
150
- command_name 'vnic-profiles'
151
-
152
- output do
153
- field :id, _('VNIC profile ID'), Fields::Field, :max_width => 200, :hide_blank => true
154
- field :name, _('Name')
155
- field :network, _('Network ID')
156
- end
157
-
158
- build_options
159
- end
160
-
161
130
  class AvailableImagesCommand < HammerCLIForeman::ListCommand
162
131
  action :available_images
163
132
  command_name 'images'
@@ -9,8 +9,6 @@ module HammerCLIForeman
9
9
  field :id, _("Id")
10
10
  field :resource_type, _("Resource type")
11
11
  field :search, _("Search")
12
- field :unlimited?, _("Unlimited?"), Fields::Boolean
13
- field :override?, _("Override?"), Fields::Boolean
14
12
  field :role, _("Role"), Fields::Reference
15
13
  field :permissions, _("Permissions"), Fields::List
16
14
  end
@@ -27,8 +25,15 @@ module HammerCLIForeman
27
25
 
28
26
  class InfoCommand < HammerCLIForeman::InfoCommand
29
27
  output ListCommand.output_definition do
30
- HammerCLIForeman::References.taxonomies(self)
31
28
  HammerCLIForeman::References.timestamps(self)
29
+ from :role do
30
+ collection :locations, _("Locations"), numbered: false, hide_blank: true do
31
+ custom_field Fields::Reference, name_key: :title
32
+ end
33
+ collection :organizations, _("Organizations"), numbered: false, hide_blank: true do
34
+ custom_field Fields::Reference, name_key: :title
35
+ end
36
+ end
32
37
  end
33
38
 
34
39
  def extend_data(filter)
@@ -42,81 +47,18 @@ module HammerCLIForeman
42
47
  end
43
48
 
44
49
 
45
- module TaxonomyCheck
46
-
47
- def self.included(base)
48
- def taxonomy_options?
49
- opt_names = ['location_ids', 'organization_ids']
50
- opt_names += resolver.searchables(:locations).map { |s| 'location_' + s.plural_name }
51
- opt_names += resolver.searchables(:organizations).map { |s| 'organization_' + s.plural_name }
52
- opt_names.any? { |opt| send(HammerCLI.option_accessor_name(opt)) }
53
- end
54
-
55
- def signal_override_usage_error
56
- signal_usage_error _('Organizations and locations can be set only for overriding filters.')
57
- end
58
-
59
- base.extend_help do |base_h|
60
- base_h.section(_('Overriding organizations and locations')) do |section_h|
61
- override_condition = "--override=true"
62
- org_opts = '--organization[s|-ids]'
63
- loc_opts = '--location[s|-ids]'
64
-
65
- section_h.text(_("Filters inherit organizations and locations from its role by default. This behavior can be changed by setting %{condition}.%{wsp}" +
66
- "Therefore options %{org_opts} and %{loc_opts} are applicable only when the override flag is set.") % {
67
- :wsp => "\n",
68
- :org_opts => org_opts,
69
- :loc_opts => loc_opts,
70
- :condition => override_condition
71
- })
72
- end
73
- end
74
- end
75
- end
76
-
77
-
78
50
  class CreateCommand < HammerCLIForeman::CreateCommand
79
- include TaxonomyCheck
80
-
81
51
  success_message _("Permission filter for [%<resource_type_label>s] created.")
82
52
  failure_message _("Could not create the permission filter")
83
53
 
84
- def validate_options
85
- signal_override_usage_error if !option_override && taxonomy_options?
86
- end
87
-
88
54
  build_options
89
55
  end
90
56
 
91
57
 
92
58
  class UpdateCommand < HammerCLIForeman::UpdateCommand
93
- include TaxonomyCheck
94
-
95
59
  success_message _("Permission filter for [%<resource_type_label>s] updated.")
96
60
  failure_message _("Could not update the permission filter")
97
61
 
98
- def request_params
99
- params = super
100
- unless override?
101
- # Clear taxonomies in case the filter is switching override from true to false
102
- params['filter']['location_ids'] = [] if !@filter || !@filter['locations'].empty?
103
- params['filter']['organization_ids'] = [] if !@filter || !@filter['organizations'].empty?
104
- end
105
- params
106
- end
107
-
108
- def validate_options
109
- signal_override_usage_error if !override? && taxonomy_options?
110
- end
111
-
112
- def override?
113
- if option_override.nil?
114
- filter['override?']
115
- else
116
- option_override
117
- end
118
- end
119
-
120
62
  def filter
121
63
  @filter ||= HammerCLIForeman.foreman_resource!(:filters).action(:show).call({ :id => get_identifier }, request_headers, request_options)
122
64
  end
@@ -16,6 +16,7 @@ module HammerCLIForeman
16
16
  output ListCommand.output_definition do
17
17
  field :description, _('Description'), Fields::Text
18
18
  field :locked, _("Locked"), Fields::Boolean
19
+ field :cloned_from_id, _("Cloned from id"), nil, :hide_blank => true
19
20
  field :default, _("Default"), Fields::Boolean
20
21
  HammerCLIForeman::References.timestamps(self)
21
22
  HammerCLIForeman::References.taxonomies(self)
@@ -42,6 +42,7 @@ module HammerCLIForeman
42
42
  output ListCommand.output_definition do
43
43
  field :description, _('Description'), Fields::Text
44
44
  field :locked, _("Locked"), Fields::Boolean
45
+ field :cloned_from_id, _("Cloned from id"), nil, :hide_blank => true
45
46
  HammerCLIForeman::References.operating_systems(self)
46
47
  HammerCLIForeman::References.taxonomies(self)
47
48
  collection :template_combinations, 'Template Combinations' do
@@ -1,5 +1,5 @@
1
1
  module HammerCLIForeman
2
2
  def self.version
3
- @version ||= Gem::Version.new "3.15.0"
3
+ @version ||= Gem::Version.new "3.17.0"
4
4
  end
5
5
  end
@@ -48,7 +48,7 @@ describe "parameters" do
48
48
  "id" => 2,
49
49
  "compute_resource_id" => 1,
50
50
  "compute_resource_name" => "bla",
51
- "provider_friendly_name" => "oVirt",
51
+ "provider_friendly_name" => "Libvirt",
52
52
  "compute_profile_id" => 1,
53
53
  "compute_profile_name" => "profile2",
54
54
  "vm_attrs" => {}
@@ -59,16 +59,16 @@ describe "parameters" do
59
59
  "compute_attribute" =>
60
60
  {
61
61
  "id" => 2, "compute_resource_id" => 1, "compute_resource_name" => "bla",
62
- "provider_friendly_name" => "oVirt", "compute_profile_id" => 1,
62
+ "provider_friendly_name" => "Libvirt", "compute_profile_id" => 1,
63
63
  "compute_profile_name" => "profile2", "vm_attrs" => {"cores" => "1"}
64
64
  }
65
65
  }
66
66
 
67
67
  @compute_resource = {
68
68
  "id" => 1,
69
- "name" => "ovirt_compute_resource",
70
- "provider" => "Ovirt",
71
- "provider_friendly_name" => "oVirt",
69
+ "name" => "libvirt_compute_resource",
70
+ "provider" => "Libvirt",
71
+ "provider_friendly_name" => "Libvirt",
72
72
  }
73
73
  end
74
74
 
@@ -129,7 +129,7 @@ describe "parameters" do
129
129
  "id" => 2,
130
130
  "compute_resource_id" => 1,
131
131
  "compute_resource_name" => "bla",
132
- "provider_friendly_name" => "oVirt",
132
+ "provider_friendly_name" => "Libvirt",
133
133
  "compute_profile_id" => 1,
134
134
  "compute_profile_name" => "profile2",
135
135
  "vm_attrs" => {}
@@ -137,7 +137,7 @@ describe "parameters" do
137
137
  }
138
138
  @compute_attribute = {
139
139
  "id" => 2, "compute_resource_id" => 1, "compute_resource_name" => "bla",
140
- "provider_friendly_name" => "oVirt", "compute_profile_id" => 1, "compute_profile_name" => "profile2",
140
+ "provider_friendly_name" => "Libvirt", "compute_profile_id" => 1, "compute_profile_name" => "profile2",
141
141
  "vm_attrs" => {"volumes_attributes" => {"1525004465" => {"size_gb" => "1"}}}
142
142
  }
143
143
 
@@ -211,7 +211,7 @@ describe "parameters" do
211
211
  "id" => 2,
212
212
  "compute_resource_id" => 1,
213
213
  "compute_resource_name" => "bla",
214
- "provider_friendly_name" => "oVirt",
214
+ "provider_friendly_name" => "Libvirt",
215
215
  "compute_profile_id" => 1,
216
216
  "compute_profile_name" => "profile2",
217
217
  "vm_attrs" => {}
@@ -283,7 +283,7 @@ describe "parameters" do
283
283
  "id" => 2,
284
284
  "compute_resource_id" => 1,
285
285
  "compute_resource_name" => "bla",
286
- "provider_friendly_name" => "oVirt",
286
+ "provider_friendly_name" => "Libvirt",
287
287
  "compute_profile_id" => 1,
288
288
  "compute_profile_name" => "profile2",
289
289
  "vm_attrs" => {"volumes_attributes" => { "1" => {"size_gb"=>"1"}}}
@@ -291,7 +291,7 @@ describe "parameters" do
291
291
  }
292
292
  @compute_attribute = {
293
293
  "id" => 2, "compute_resource_id" => 1, "compute_resource_name" => "bla",
294
- "provider_friendly_name" => "oVirt", "compute_profile_id" => 1,
294
+ "provider_friendly_name" => "Libvirt", "compute_profile_id" => 1,
295
295
  "compute_profile_name" => "profile2", "vm_attrs" => {"volumes_attributes" => {}}
296
296
  }
297
297
  end
@@ -362,7 +362,7 @@ describe "parameters" do
362
362
  "id" => 2,
363
363
  "compute_resource_id" => 1,
364
364
  "compute_resource_name" => "bla",
365
- "provider_friendly_name" => "oVirt",
365
+ "provider_friendly_name" => "Libvirt",
366
366
  "compute_profile_id" => 1,
367
367
  "compute_profile_name" => "profile2",
368
368
  "vm_attrs" => {}
@@ -376,7 +376,7 @@ describe "parameters" do
376
376
  "id" => 2,
377
377
  "compute_resource_id" => 1,
378
378
  "compute_resource_name" => "bla",
379
- "provider_friendly_name" => "oVirt",
379
+ "provider_friendly_name" => "Libvirt",
380
380
  "compute_profile_id" => 1,
381
381
  "compute_profile_name" => "profile2",
382
382
  "vm_attrs" => {}
@@ -385,9 +385,9 @@ describe "parameters" do
385
385
 
386
386
  @compute_resource = {
387
387
  "id" => 1,
388
- "name" => "ovirt_compute_resource",
389
- "provider" => "Ovirt",
390
- "provider_friendly_name" => "oVirt",
388
+ "name" => "libvirt_compute_resource",
389
+ "provider" => "Libvirt",
390
+ "provider_friendly_name" => "Libvirt",
391
391
  }
392
392
 
393
393
  end
@@ -491,7 +491,7 @@ describe "parameters" do
491
491
  "id" => 2,
492
492
  "compute_resource_id" => 1,
493
493
  "compute_resource_name" => "bla",
494
- "provider_friendly_name" => "oVirt",
494
+ "provider_friendly_name" => "Libvirt",
495
495
  "compute_profile_id" => 1,
496
496
  "compute_profile_name" => "profile2",
497
497
  "vm_attrs" => {}
@@ -500,9 +500,9 @@ describe "parameters" do
500
500
 
501
501
  @compute_resource = {
502
502
  "id" => 1,
503
- "name" => "ovirt_compute_resource",
504
- "provider" => "Ovirt",
505
- "provider_friendly_name" => "oVirt",
503
+ "name" => "libvirt_compute_resource",
504
+ "provider" => "Libvirt",
505
+ "provider_friendly_name" => "Libvirt",
506
506
  }
507
507
  end
508
508
 
@@ -574,23 +574,23 @@ describe "parameters" do
574
574
  "id" => 2,
575
575
  "compute_resource_id" => 1,
576
576
  "compute_resource_name" => "bla",
577
- "provider_friendly_name" => "oVirt",
577
+ "provider_friendly_name" => "Libvirt",
578
578
  "compute_profile_id" => 1,
579
579
  "compute_profile_name" => "profile2",
580
- "vm_attrs" => {"interfaces_attributes" => { "1" => {"compute_name"=>"eth0"}}}
580
+ "vm_attrs" => {"nics_attributes" => { "1" => {"compute_name"=>"eth0"}}}
581
581
  }]
582
582
  }
583
583
  @compute_attribute = {
584
584
  "id" => 2, "compute_resource_id" => 1, "compute_resource_name" => "bla",
585
- "provider_friendly_name" => "oVirt", "compute_profile_id" => 1,
585
+ "provider_friendly_name" => "Libvirt", "compute_profile_id" => 1,
586
586
  "compute_profile_name" => "profile2", "vm_attrs" => {"interfaces_attributes" => {}}
587
587
  }
588
588
 
589
589
  @compute_resource = {
590
590
  "id" => 1,
591
- "name" => "ovirt_compute_resource",
592
- "provider" => "Ovirt",
593
- "provider_friendly_name" => "oVirt",
591
+ "name" => "libvirt_compute_resource",
592
+ "provider" => "Libvirt",
593
+ "provider_friendly_name" => "Libvirt",
594
594
  }
595
595
 
596
596
  end
@@ -26,7 +26,7 @@ describe "parameters" do
26
26
  "id": 2,
27
27
  "compute_resource_id": 3,
28
28
  "compute_resource_name": "bla",
29
- "provider_friendly_name": "oVirt",
29
+ "provider_friendly_name": "Libvirt",
30
30
  "compute_profile_id": 1,
31
31
  "compute_profile_name": "profile2",
32
32
  }]
@@ -64,7 +64,7 @@ describe "parameters" do
64
64
  "id": 4,
65
65
  "compute_resource_id": 3,
66
66
  "compute_resource_name": "bla",
67
- "provider_friendly_name": "oVirt",
67
+ "provider_friendly_name": "Libvirt",
68
68
  "compute_profile_id": 3,
69
69
  "compute_profile_name": "profile3",
70
70
  }]
@@ -61,7 +61,7 @@ describe 'compute-resource' do
61
61
  assert_cmd(expected_result, result)
62
62
  end
63
63
  end
64
-
64
+
65
65
 
66
66
  it 'should print error for blank --provider option' do
67
67
  params = %w(--provider= --name=new'')
@@ -109,55 +109,6 @@ describe 'compute-resource' do
109
109
 
110
110
  assert_cmd(success_result("Compute resource created.\n"), result)
111
111
  end
112
-
113
- it 'should create a compute-resource ovirt' do
114
- params = %w(--name=test-ovirt
115
- --provider=ovirt
116
- --url=https://ovirt.example.com/ovirt-engine/api
117
- --user=foreman
118
- --password=changeme
119
- --datacenter=ovirt.example.com)
120
-
121
- api_expects(:compute_resources, :create, 'Create Compute Resource') do |params|
122
- (params['compute_resource']['name'] == 'test-ovirt') &&
123
- (params['compute_resource']['provider'] == 'ovirt') &&
124
- (params['compute_resource']['url'] == 'https://ovirt.example.com/ovirt-engine/api') &&
125
- (params['compute_resource']['user'] == 'foreman') &&
126
- (params['compute_resource']['password'] == 'changeme') &&
127
- (params['compute_resource']['datacenter'] == 'ovirt.example.com')
128
- end
129
-
130
- result = run_cmd(@cmd + params)
131
-
132
- assert_cmd(success_result("Compute resource created.\n"), result)
133
- end
134
-
135
-
136
- it 'should create a compute-resource ovirt with custom public key' do
137
- tempfile = Tempfile.new('ca.pem')
138
- tempfile << 'test data'
139
- tempfile.close
140
- params = %W(--name=test-ovirt
141
- --provider=ovirt
142
- --url=https://ovirt.example.com/ovirt-engine/api
143
- --user=foreman
144
- --password=changeme
145
- --datacenter=ovirt.example.com
146
- --public-key-path=#{tempfile.path})
147
-
148
- api_expects(:compute_resources, :create, 'Create Compute Resource') do |params|
149
- (params['compute_resource']['name'] =='test-ovirt') &&
150
- (params['compute_resource']['provider'] == 'ovirt') &&
151
- (params['compute_resource']['url'] == 'https://ovirt.example.com/ovirt-engine/api') &&
152
- (params['compute_resource']['user'] == 'foreman') &&
153
- (params['compute_resource']['password'] == 'changeme') &&
154
- (params['compute_resource']['datacenter'] == 'ovirt.example.com' &&
155
- (params['compute_resource']['public_key'] == 'test data'))
156
- end
157
- result = run_cmd(@cmd + params)
158
-
159
- assert_cmd(success_result("Compute resource created.\n"), result)
160
- end
161
112
  end
162
113
 
163
114
  describe 'clusters' do
@@ -210,31 +161,6 @@ end
210
161
  end
211
162
  end
212
163
 
213
- describe 'vnic profiles' do
214
- let(:cmd) { base_cmd << 'vnic-profiles' }
215
- let(:vnic_profile_1) { { id: 1, name: 'network1', network: 2 } }
216
- let(:vnic_profile_2) { { id: 2, name: 'network2', network: 2 } }
217
- let(:vnic_profiles) { [vnic_profile_1, vnic_profile_2] }
218
-
219
- it 'lists available vnic profiles for a compute resource' do
220
- api_expects(:compute_resources, :available_vnic_profiles, 'vnic-profiles').with_params(
221
- 'id' => '1'
222
- ).returns(index_response(vnic_profiles))
223
-
224
- output = IndexMatcher.new(
225
- [
226
- ['VNIC PROFILE ID', 'NAME', 'NETWORK ID'],
227
- ['1', 'network1','2'],
228
- ['2', 'network2','2']
229
- ]
230
- )
231
- expected_result = success_result(output)
232
-
233
- result = run_cmd(cmd + base_params)
234
- assert_cmd(expected_result, result)
235
- end
236
- end
237
-
238
164
  describe 'images' do
239
165
  let(:cmd) { base_cmd << 'images' }
240
166
  let(:image1) { { uuid: 1, name: 'image1' } }
@@ -4,10 +4,9 @@ require File.join(File.dirname(__FILE__), 'test_helper')
4
4
 
5
5
  describe 'filter' do
6
6
  def api_expects_filter_info(options)
7
- override = !!options[:override]
8
7
  api_expects(:filters, :show, 'Get filter info').with_params(
9
8
  id: '1'
10
- ).returns(@filter.merge('override?' => override))
9
+ ).returns(@filter)
11
10
  end
12
11
 
13
12
  def taxonomy_usage_error(action, cmd)
@@ -27,15 +26,6 @@ describe 'filter' do
27
26
  @cmd = %w[filter create]
28
27
  end
29
28
 
30
- it 'prints error when taxonomies are used for a not-overriding filter' do
31
- params = ['--organization-ids=1,2', '--location-ids=3,4', '--override=false']
32
-
33
- api_expects_no_call
34
-
35
- result = run_cmd(@cmd + params)
36
- assert_cmd(taxonomy_usage_error('create', @cmd), result)
37
- end
38
-
39
29
  it 'should create a filter' do
40
30
  params = ['--role-id=1', '--permission-ids=[1]']
41
31
 
@@ -67,8 +57,8 @@ describe 'filter' do
67
57
  api_expects(:filters, :index, 'List filters').returns(@filters)
68
58
 
69
59
  output = IndexMatcher.new([
70
- ['ID', 'RESOURCE TYPE', 'SEARCH', 'UNLIMITED?', 'OVERRIDE?', 'ROLE', 'PERMISSIONS'],
71
- ['1', 'Architecture', 'none', 'yes', 'no', 'Manager', 'view_architectures']
60
+ ['ID', 'RESOURCE TYPE', 'SEARCH', 'ROLE', 'PERMISSIONS'],
61
+ ['1', 'Architecture', 'none', 'Manager', 'view_architectures']
72
62
  ])
73
63
  expected_result = success_result(output)
74
64
 
@@ -100,115 +90,4 @@ describe 'filter' do
100
90
  assert_cmd(success_result("Permission filter deleted.\n"), result)
101
91
  end
102
92
  end
103
-
104
- describe 'update' do
105
- before do
106
- @cmd = %w[filter update]
107
- @filter = {
108
- 'search' => nil,
109
- 'resource_type_label' => 'User',
110
- 'resource_type' => 'User',
111
- 'unlimited?' => false,
112
- 'created_at' => '2017-07-18 14:34:09 UTC',
113
- 'updated_at' => '2017-07-18 14:34:09 UTC',
114
- 'override?' => true,
115
- 'id' => 404,
116
- 'role' => {
117
- 'name' => 'Some Role',
118
- 'id' => 28,
119
- 'description' => "Description\nof the new\nrole",
120
- 'origin' => nil
121
- },
122
- 'permissions' => [{
123
- 'name' => 'view_users',
124
- 'id' => 164,
125
- 'resource_type' => 'User'
126
- }],
127
- 'locations' => [{
128
- 'id' => 28,
129
- 'name' => 'location74',
130
- 'title' => 'location74',
131
- 'description' => nil
132
- }],
133
- 'organizations' => [{
134
- 'id' => 27,
135
- 'name' => 'organization74',
136
- 'title' => 'organization74',
137
- 'description' => nil
138
- }]
139
- }
140
- end
141
-
142
- it 'resets taxonomies when a filter is not-overriding' do
143
- params = ['--id=1']
144
-
145
- api_expects_filter_info(override: false)
146
- api_expects(:filters, :update, 'Update the filter').with_params(
147
- 'filter' => {
148
- 'organization_ids' => [],
149
- 'location_ids' => []
150
- }
151
- ).returns(@filter)
152
-
153
- assert_update_success(run_cmd(@cmd + params))
154
- end
155
-
156
- it 'resets taxonomies when switching a filter to not-overriding' do
157
- params = ['--id=1', '--override=false']
158
-
159
- api_expects(:filters, :update, 'Update the filter').with_params(
160
- 'filter' => {
161
- 'organization_ids' => [],
162
- 'location_ids' => []
163
- }
164
- ).returns(@filter)
165
-
166
- assert_update_success(run_cmd(@cmd + params))
167
- end
168
-
169
- it 'can add taxonomies when a filter is overriding' do
170
- params = ['--id=1', '--organization-ids=1,2', '--location-ids=3,4']
171
-
172
- api_expects_filter_info(override: true)
173
- api_expects(:filters, :update, 'Update the filter').with_params(
174
- 'filter' => {
175
- 'organization_ids' => %w[1 2],
176
- 'location_ids' => %w[3 4]
177
- }
178
- ).returns(@filter)
179
-
180
- assert_update_success(run_cmd(@cmd + params))
181
- end
182
-
183
- it 'can add taxonomies when switching a filter to overriding' do
184
- params = ['--id=1', '--organization-ids=1,2', '--location-ids=3,4', '--override=true']
185
-
186
- api_expects(:filters, :update, 'Update the filter').with_params(
187
- 'filter' => {
188
- 'organization_ids' => %w[1 2],
189
- 'location_ids' => %w[3 4]
190
- }
191
- ).returns(@filter)
192
-
193
- assert_update_success(run_cmd(@cmd + params))
194
- end
195
-
196
- it 'prints error when taxonomies are used on not-overriding' do
197
- params = ['--id=1', '--organization-ids=1,2', '--location-ids=3,4']
198
-
199
- api_expects_filter_info(override: false)
200
-
201
- result = run_cmd(@cmd + params)
202
- assert_cmd(taxonomy_usage_error('update', @cmd), result)
203
- end
204
-
205
- it 'prints error when taxonomies are used when switching a filter to not-overriding' do
206
- params = ['--id=1', '--organization-ids=1,2', '--location-ids=3,4', '--override=false']
207
-
208
- api_expects_no_call
209
-
210
- result = run_cmd(@cmd + params)
211
- assert_cmd(taxonomy_usage_error('update', @cmd), result)
212
- end
213
- end
214
93
  end
@@ -11,10 +11,7 @@ describe HammerCLIForeman::VirtualMachine do
11
11
  @vm = {
12
12
  'id' => 1,
13
13
  'name' => 'vm1',
14
- 'provider' => 'Ovirt',
15
- 'cpu' => 1,
16
- 'memory' => 1,
17
- 'status' => 'down'
14
+ 'provider' => 'Libvirt',
18
15
  }
19
16
  end
20
17
 
@@ -38,7 +35,7 @@ describe HammerCLIForeman::VirtualMachine do
38
35
  par['id'] == '1' && par['vm_id'] == '1'
39
36
  end.returns(@vm)
40
37
  result = run_cmd(@cmd + params)
41
- assert_match("Id: 1\nName: vm1\nCPUs: 1\nMemory: 1\nStatus: down\n\n", result.out)
38
+ assert_match("Id: 1\nName: vm1\n\n", result.out)
42
39
  end
43
40
 
44
41
  end
@@ -60,11 +60,6 @@ describe HammerCLIForeman::Filter do
60
60
  describe "CreateCommand" do
61
61
  let(:cmd) { HammerCLIForeman::Filter::CreateCommand.new("", ctx) }
62
62
 
63
- before do
64
- # FIXME: remove stubbing option_override once tests are switched to apidoc 1.14+
65
- cmd.stubs(:option_override).returns(false)
66
- end
67
-
68
63
  describe "parameters" do
69
64
  it_should_accept "role id and permission ids", ["--role-id=1", "--permission-ids=1,2"]
70
65
  it_should_accept "role name and permission ids", ["--role=role", "--permission-ids=1,2"]
@@ -85,11 +80,6 @@ describe HammerCLIForeman::Filter do
85
80
  describe "UpdateCommand" do
86
81
  let(:cmd) { HammerCLIForeman::Filter::UpdateCommand.new("", ctx) }
87
82
 
88
- before do
89
- # FIXME: remove stubbing option_override once tests are switched to apidoc 1.14+
90
- cmd.stubs(:option_override).returns(false)
91
- end
92
-
93
83
  describe "parameters" do
94
84
  it_should_accept "id, role id and permission ids", ["--id=1", "--role-id=1", "--permission-ids=1,2"]
95
85
  it_should_accept "id, role name and permission ids", ["--id=1", "--role=role", "--permission-ids=1,2"]
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: 3.15.0
4
+ version: 3.17.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: 2025-05-14 00:00:00.000000000 Z
12
+ date: 2025-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hammer_cli
@@ -148,7 +148,6 @@ files:
148
148
  - lib/hammer_cli_foreman/compute_resource/ec2.rb
149
149
  - lib/hammer_cli_foreman/compute_resource/libvirt.rb
150
150
  - lib/hammer_cli_foreman/compute_resource/openstack.rb
151
- - lib/hammer_cli_foreman/compute_resource/ovirt.rb
152
151
  - lib/hammer_cli_foreman/compute_resource/register_compute_resources.rb
153
152
  - lib/hammer_cli_foreman/compute_resource/utils.rb
154
153
  - lib/hammer_cli_foreman/compute_resource/vmware.rb
@@ -1,70 +0,0 @@
1
- module HammerCLIForeman
2
- module ComputeResources
3
- class Ovirt < Base
4
- def name
5
- 'oVirt'
6
- end
7
-
8
- def compute_attributes
9
- [
10
- ['cluster', _('ID or name of cluster to use')],
11
- ['template', _('Hardware profile to use')],
12
- ['cores', _('Integer value, number of cores')],
13
- ['sockets', _('Integer value, number of sockets')],
14
- ['memory', _('Amount of memory, integer value in bytes')],
15
- ['ha', _('Boolean, set 1 to high availability')],
16
- ['display_type', _('Possible values: %s') % 'VNC, SPICE'],
17
- ['keyboard_layout', _('Possible values: %s. Not usable if display type is SPICE.') % 'ar, de-ch, es, fo, fr-ca, hu, ja, mk, no, pt-br, sv, da, en-gb, et, fr, fr-ch, is, lt, nl, pl, ru, th, de, en-us, fi, fr-be, hr, it, lv, nl-be, pt, sl, tr']
18
- ]
19
- end
20
-
21
- def host_attributes
22
- [
23
- ['start', _('Boolean, set 1 to start the vm')]
24
- ]
25
- end
26
-
27
- def interface_attributes
28
- [
29
- ['compute_name', _('Compute name, e.g. eth0')],
30
- ['compute_network', _('Select one of available networks for a cluster, must be an ID or a name')],
31
- ['compute_interface', _('Interface type')],
32
- ['compute_vnic_profile', _('Vnic Profile')]
33
- ]
34
- end
35
-
36
- def volume_attributes
37
- [
38
- ['size_gb', _('Volume size in GB, integer value')],
39
- ['storage_domain', _('ID or name of storage domain')],
40
- ['bootable', _('Boolean, set 1 for bootable, only one volume can be bootable')],
41
- ['preallocate', _('Boolean, set 1 to preallocate')],
42
- ['wipe_after_delete', _('Boolean, set 1 to wipe disk after delete')],
43
- ['interface', _('Disk interface name, must be ide, virtio or virtio_scsi')]
44
- ]
45
- end
46
-
47
- def provider_specific_fields
48
- super + [
49
- Fields::Field.new(:label => _('Datacenter'), :path => [:datacenter])
50
- ]
51
- end
52
-
53
- def provider_vm_specific_fields
54
- [
55
- Fields::Field.new(:label => _('CPUs'), :path => [:cpu]),
56
- Fields::Field.new(:label => _('Memory'), :path => [:memory]),
57
- Fields::Field.new(:label => _('Status'), :path => [:status]),
58
- Fields::Field.new(:label => _('Cores'), :path => [:cores]),
59
- Fields::Field.new(:label => _('Type'), :path => [:type])
60
- ]
61
- end
62
-
63
- def mandatory_resource_options
64
- super + %i[url user password datacenter]
65
- end
66
- end
67
-
68
- HammerCLIForeman.register_compute_resource('ovirt', Ovirt.new)
69
- end
70
- end