hammer_cli_foreman 3.14.1 → 3.16.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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/doc/host_create.md +0 -27
  3. data/doc/release_notes.md +9 -1
  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/exception_handler.rb +2 -1
  8. data/lib/hammer_cli_foreman/version.rb +1 -1
  9. data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  10. data/locale/cs_CZ/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  11. data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  12. data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  13. data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  14. data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  15. data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  16. data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  17. data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  18. data/locale/ka/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  19. data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  20. data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  21. data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  22. data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  23. data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  24. data/test/data/3.15/foreman_api.json +1 -0
  25. data/test/functional/compute_attribute_test.rb +25 -25
  26. data/test/functional/compute_profile_test.rb +2 -2
  27. data/test/functional/compute_resource_test.rb +1 -75
  28. data/test/functional/virtual_machine_test.rb +2 -5
  29. data/test/test_helper.rb +1 -1
  30. metadata +8 -10
  31. data/lib/hammer_cli_foreman/compute_resource/ovirt.rb +0 -70
@@ -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' } }
@@ -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
data/test/test_helper.rb CHANGED
@@ -16,7 +16,7 @@ require "mocha/minitest"
16
16
  require 'hammer_cli'
17
17
  require 'hammer_cli_foreman/testing/api_expectations'
18
18
 
19
- FOREMAN_VERSION = ENV['TEST_API_VERSION'] || '3.14'
19
+ FOREMAN_VERSION = ENV['TEST_API_VERSION'] || '3.15'
20
20
  unless Dir.entries('test/data').include? FOREMAN_VERSION
21
21
  raise StandardError.new "Version is not correct"
22
22
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.14.1
4
+ version: 3.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomáš Strachota
8
8
  - Martin Bačovský
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2025-03-31 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: hammer_cli
@@ -17,14 +16,14 @@ dependencies:
17
16
  requirements:
18
17
  - - ">="
19
18
  - !ruby/object:Gem::Version
20
- version: 3.14.0
19
+ version: 3.15.0
21
20
  type: :runtime
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
24
  - - ">="
26
25
  - !ruby/object:Gem::Version
27
- version: 3.14.0
26
+ version: 3.15.0
28
27
  - !ruby/object:Gem::Dependency
29
28
  name: apipie-bindings
30
29
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +79,7 @@ email: tstracho@redhat.com
80
79
  executables: []
81
80
  extensions: []
82
81
  extra_rdoc_files:
82
+ - README.md
83
83
  - doc/configuration.md
84
84
  - doc/developer_docs.md
85
85
  - doc/host_create.md
@@ -89,7 +89,6 @@ extra_rdoc_files:
89
89
  - doc/release_notes.md
90
90
  - doc/testing.md
91
91
  - doc/using_hammer_cli_foreman_command.md
92
- - README.md
93
92
  files:
94
93
  - LICENSE
95
94
  - README.md
@@ -148,7 +147,6 @@ files:
148
147
  - lib/hammer_cli_foreman/compute_resource/ec2.rb
149
148
  - lib/hammer_cli_foreman/compute_resource/libvirt.rb
150
149
  - lib/hammer_cli_foreman/compute_resource/openstack.rb
151
- - lib/hammer_cli_foreman/compute_resource/ovirt.rb
152
150
  - lib/hammer_cli_foreman/compute_resource/register_compute_resources.rb
153
151
  - lib/hammer_cli_foreman/compute_resource/utils.rb
154
152
  - lib/hammer_cli_foreman/compute_resource/vmware.rb
@@ -237,6 +235,7 @@ files:
237
235
  - test/data/3.11/foreman_api.json
238
236
  - test/data/3.12/foreman_api.json
239
237
  - test/data/3.14/foreman_api.json
238
+ - test/data/3.15/foreman_api.json
240
239
  - test/data/3.4/foreman_api.json
241
240
  - test/data/README.md
242
241
  - test/functional/architecture_test.rb
@@ -341,7 +340,6 @@ homepage: https://github.com/theforeman/hammer-cli-foreman
341
340
  licenses:
342
341
  - GPL-3.0-or-later
343
342
  metadata: {}
344
- post_install_message:
345
343
  rdoc_options: []
346
344
  require_paths:
347
345
  - lib
@@ -356,8 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
356
354
  - !ruby/object:Gem::Version
357
355
  version: '0'
358
356
  requirements: []
359
- rubygems_version: 3.2.33
360
- signing_key:
357
+ rubygems_version: 3.6.7
361
358
  specification_version: 4
362
359
  summary: Foreman commands for Hammer
363
360
  test_files:
@@ -365,6 +362,7 @@ test_files:
365
362
  - test/data/3.11/foreman_api.json
366
363
  - test/data/3.12/foreman_api.json
367
364
  - test/data/3.14/foreman_api.json
365
+ - test/data/3.15/foreman_api.json
368
366
  - test/data/3.4/foreman_api.json
369
367
  - test/data/README.md
370
368
  - test/functional/architecture_test.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