hammer_cli_foreman 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4787fbc9dbda1fcd2311672da8001300715cfc1448b82f985509a73cab3ab416
4
- data.tar.gz: a2ee1f1044f4422181109b166040b8e83dd9c727310c7753e89d26c23dae3c7a
3
+ metadata.gz: 006d4b4eed7a0555a9094223fcbf0310fbf45787fa879f96426b7420a3fd8207
4
+ data.tar.gz: 78bb6049eae38f6793a420461c5ee8772eac699d538e33d331d01f12ab236178
5
5
  SHA512:
6
- metadata.gz: d1fe6bb98a5c352f95ce509e7e56f7c398180aa3790d1105f2c7ffb98d8dcfca4e4ab1cda4331a1f70000a834a75671782ed8e1d6b7ba65b3d83b474f8a9f3c6
7
- data.tar.gz: 8e490092a17af3fd13d8c8c5d6ff6f42227e3e9bfa888818975308679a0724e6f6e8183d811a3a47dcbd369da0e0f92ccf4b2131b4e90d9b0d17bda9c01950fc
6
+ metadata.gz: 1a66faf43bc97309b2e98ddbf9aeb9dc9f5bd6a768326d305692819ac4c76bcb4d9def107795823b5df9192993f691ea608a31c9af003c0fcad4cbb57e8c09a1
7
+ data.tar.gz: a873297a23beb5e95f8bd1a232e836a5b914af82836f90e33722ab8a7162f55396c17c93955d50929bbed95b3fe7c1b0cc48907b918c465a247d7ab22d511b90
data/doc/release_notes.md CHANGED
@@ -1,5 +1,11 @@
1
1
  Release notes
2
2
  =============
3
+ ### 3.5.0 (2022-10-31)
4
+ * Extract gce related info ([PR #606](https://github.com/theforeman/hammer-cli-foreman/pull/606)), [#35659](http://projects.theforeman.org/issues/35659)
5
+ * Change auth endpoint for negotiation, [#35473](http://projects.theforeman.org/issues/35473)
6
+ * Enhance vmware listing commands and switch to cluster_name param ([PR #604](https://github.com/theforeman/hammer-cli-foreman/pull/604)), [#35438](http://projects.theforeman.org/issues/35438)
7
+ * Bump to 3.5.0-develop
8
+
3
9
  ### 3.4.0 (2022-08-09)
4
10
  * Add options for table preferences cli ([PR #603](https://github.com/theforeman/hammer-cli-foreman/pull/603)), [#35219](http://projects.theforeman.org/issues/35219)
5
11
  * I18n - extracting new, pulling from tx, [#34629](http://projects.theforeman.org/issues/34629)
@@ -2,7 +2,7 @@ module HammerCLIForeman
2
2
  module Api
3
3
  class NegotiateAuth < ApipieBindings::Authenticators::Negotiate
4
4
  def initialize(foreman_url, **options)
5
- super("#{foreman_url}/users/extlogin", HammerCLI::SSLOptions.new.get_options(foreman_url).merge(options))
5
+ super("#{foreman_url}/api/users/extlogin", HammerCLI::SSLOptions.new.get_options(foreman_url).merge(options))
6
6
  end
7
7
 
8
8
  def user
@@ -0,0 +1,14 @@
1
+ module HammerCLIForeman
2
+ module CommandExtensions
3
+ class ComputeResourceSubcommand < HammerCLI::CommandExtensions
4
+ option '--cluster-id', 'ID', _('Cluster ID'),
5
+ deprecated: _('Use --cluster-name instead')
6
+ option '--cluster-name', 'NAME', _('Cluster name or path to search by'),
7
+ attribute_name: :option_cluster_id
8
+
9
+ request_params do |params|
10
+ params['cluster_id'] = params['cluster_id'].gsub('/', '%2F') if params['cluster_id']
11
+ end
12
+ end
13
+ end
14
+ end
@@ -7,3 +7,4 @@ require 'hammer_cli_foreman/command_extensions/status'
7
7
  require 'hammer_cli_foreman/command_extensions/user'
8
8
  require 'hammer_cli_foreman/command_extensions/subnet'
9
9
  require 'hammer_cli_foreman/command_extensions/domain'
10
+ require 'hammer_cli_foreman/command_extensions/compute_resource_subcommand'
@@ -10,7 +10,6 @@ module HammerCLIForeman
10
10
 
11
11
  require 'hammer_cli_foreman/compute_resource/base'
12
12
  require 'hammer_cli_foreman/compute_resource/ec2.rb'
13
- require 'hammer_cli_foreman/compute_resource/gce.rb'
14
13
  require 'hammer_cli_foreman/compute_resource/libvirt.rb'
15
14
  require 'hammer_cli_foreman/compute_resource/openstack.rb'
16
15
  require 'hammer_cli_foreman/compute_resource/ovirt.rb'
@@ -64,7 +64,9 @@ module HammerCLIForeman
64
64
  def provider_specific_fields
65
65
  super + [
66
66
  Fields::Field.new(:label => _('Datacenter'), :path => [:datacenter]),
67
- Fields::Field.new(:label => _('Server'), :path => [:server])
67
+ Fields::Field.new(:label => _('Server'), :path => [:server]),
68
+ Fields::Boolean.new(:label => _('Console password set'), :path => [:set_console_password]),
69
+ Fields::Boolean.new(:label => _('Caching enabled'), :path => [:caching_enabled])
68
70
  ]
69
71
  end
70
72
 
@@ -121,6 +121,9 @@ module HammerCLIForeman
121
121
  output do
122
122
  field :id, _('Id')
123
123
  field :name, _('Name')
124
+ field :datacenter, _('Datacenter')
125
+ field :num_host, _('Hosts')
126
+ field :full_path, _('Cluster path')
124
127
  end
125
128
 
126
129
  build_options
@@ -133,9 +136,13 @@ module HammerCLIForeman
133
136
  output do
134
137
  field :id, _('Id'), Fields::Field, :max_width => 200, :hide_blank => true
135
138
  field :name, _('Name')
139
+ field :datacenter, _('Datacenter')
140
+ field :virtualswitch, _('Virtual switch')
141
+ field :vlanid, _('VLAN ID')
136
142
  end
137
143
 
138
- build_options
144
+ build_options without: :cluster_id
145
+ extend_with(HammerCLIForeman::CommandExtensions::ComputeResourceSubcommand.new(only: %i[option request_params]))
139
146
  end
140
147
 
141
148
  class AvailableVnicProfilesCommand < HammerCLIForeman::ListCommand
@@ -158,6 +165,7 @@ module HammerCLIForeman
158
165
  output do
159
166
  field :uuid, _('Uuid')
160
167
  field :name, _('Name')
168
+ field :path, _('Path'), Fields::Field, :hide_blank => true
161
169
  end
162
170
 
163
171
  build_options
@@ -182,6 +190,10 @@ module HammerCLIForeman
182
190
  output do
183
191
  field :id, _('Id')
184
192
  field :name, _('Name')
193
+ field :parent, _('Parent')
194
+ field :datacenter, _('Datacenter')
195
+ field :path, _('Path'), Fields::Field, :max_width => 50
196
+ field :type, _('Type')
185
197
  end
186
198
 
187
199
  build_options
@@ -206,9 +218,12 @@ module HammerCLIForeman
206
218
  output do
207
219
  field :id, _('Id')
208
220
  field :name, _('Name')
221
+ field :cluster, _('Cluster')
222
+ field :datacenter, _('Datacenter')
209
223
  end
210
224
 
211
- build_options
225
+ build_options without: :cluster_id
226
+ extend_with(HammerCLIForeman::CommandExtensions::ComputeResourceSubcommand.new(only: %i[option request_params]))
212
227
  end
213
228
 
214
229
  class AvailableStorageDomainsCommand < HammerCLIForeman::ListCommand
@@ -220,7 +235,8 @@ module HammerCLIForeman
220
235
  field :name, _('Name')
221
236
  end
222
237
 
223
- build_options
238
+ build_options without: :cluster_id
239
+ extend_with(HammerCLIForeman::CommandExtensions::ComputeResourceSubcommand.new(only: %i[option request_params]))
224
240
  end
225
241
 
226
242
  class AvailableStoragePodsCommand < HammerCLIForeman::ListCommand
@@ -230,9 +246,11 @@ module HammerCLIForeman
230
246
  output do
231
247
  field :id, _('Id')
232
248
  field :name, _('Name')
249
+ field :datacenter, _('Datacenter')
233
250
  end
234
251
 
235
- build_options
252
+ build_options without: :cluster_id
253
+ extend_with(HammerCLIForeman::CommandExtensions::ComputeResourceSubcommand.new(only: %i[option request_params]))
236
254
  end
237
255
 
238
256
  class AvailableSecurityGroupsCommand < HammerCLIForeman::ListCommand
@@ -252,8 +270,10 @@ module HammerCLIForeman
252
270
  command_name 'virtual-machines'
253
271
 
254
272
  output do
255
- field :id, _("Id")
256
- field :name, _("Name")
273
+ field :id, _('Id')
274
+ field :name, _('Name')
275
+ field :path, _('Path'), Fields::Field, :max_width => 50
276
+ field :state, _('State')
257
277
  end
258
278
 
259
279
  build_options
@@ -1,5 +1,5 @@
1
1
  module HammerCLIForeman
2
2
  def self.version
3
- @version ||= Gem::Version.new "3.4.0"
3
+ @version ||= Gem::Version.new "3.5.0"
4
4
  end
5
5
  end
@@ -9,7 +9,6 @@ module HammerCLIForeman
9
9
  class PowerVmCommand < HammerCLIForeman::Command
10
10
  action :power_vm
11
11
  command_name 'power'
12
- option "--vm-id", "VM-ID", _("Virtual machine id, for gce use virtual machine name")
13
12
 
14
13
  success_message _("Virtual machine is powering.")
15
14
  failure_message _("Could not power the virtual machine")
@@ -19,7 +18,6 @@ module HammerCLIForeman
19
18
 
20
19
  class InfoCommand < HammerCLIForeman::InfoCommand
21
20
  action :show_vm
22
- option "--vm-id", "VM-ID", _("Virtual machine id, for gce use virtual machine name")
23
21
 
24
22
  output do
25
23
  field :id, _("Id")
@@ -39,8 +37,6 @@ module HammerCLIForeman
39
37
 
40
38
  class DeleteCommand < HammerCLIForeman::DeleteCommand
41
39
  action :destroy_vm
42
- option "--vm-id", "VM-ID", _("Virtual machine id, for gce use virtual machine name")
43
-
44
40
 
45
41
  success_message _("Virtual machine deleted.")
46
42
  failure_message _("Could not delete the virtual machine")
@@ -355,10 +355,31 @@ end
355
355
  ]
356
356
  )
357
357
  expected_result = success_result(output)
358
+ expected_result.expected_err = "Warning: Option --cluster-id is deprecated. Use --cluster-name instead\n"
358
359
 
359
360
  result = run_cmd(cmd + params)
360
361
  assert_cmd(expected_result, result)
361
362
  end
363
+
364
+ it 'lists available resource_pools for a compute resource with updated cluster_name param' do
365
+ api_expects(:compute_resources, :available_resource_pools, 'resource-pools').with_params(
366
+ 'id' => '1', 'cluster_id' => 'test%2Ftest1'
367
+ ).returns(index_response(resource_pools))
368
+
369
+ cluster_param = base_params + ['--cluster-name=test/test1']
370
+
371
+ output = IndexMatcher.new(
372
+ [
373
+ %w[ID NAME],
374
+ %w[1 resource_pool1],
375
+ %w[2 resource_pool2]
376
+ ]
377
+ )
378
+ expected_result = success_result(output)
379
+
380
+ result = run_cmd(cmd + cluster_param)
381
+ assert_cmd(expected_result, result)
382
+ end
362
383
  end
363
384
 
364
385
  describe 'storage_domains' do
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.4.0
4
+ version: 3.5.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: 2022-08-09 00:00:00.000000000 Z
12
+ date: 2022-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hammer_cli
@@ -84,10 +84,10 @@ extra_rdoc_files:
84
84
  - doc/option_builder.md
85
85
  - doc/using_hammer_cli_foreman_command.md
86
86
  - doc/developer_docs.md
87
- - doc/host_create.md
88
87
  - doc/plugin.md
89
88
  - doc/testing.md
90
89
  - doc/configuration.md
90
+ - doc/host_create.md
91
91
  - doc/release_notes.md
92
92
  - README.md
93
93
  files:
@@ -124,6 +124,7 @@ files:
124
124
  - lib/hammer_cli_foreman/bookmark.rb
125
125
  - lib/hammer_cli_foreman/combination.rb
126
126
  - lib/hammer_cli_foreman/command_extensions.rb
127
+ - lib/hammer_cli_foreman/command_extensions/compute_resource_subcommand.rb
127
128
  - lib/hammer_cli_foreman/command_extensions/domain.rb
128
129
  - lib/hammer_cli_foreman/command_extensions/fields.rb
129
130
  - lib/hammer_cli_foreman/command_extensions/hosts.rb
@@ -143,7 +144,6 @@ files:
143
144
  - lib/hammer_cli_foreman/compute_resource.rb
144
145
  - lib/hammer_cli_foreman/compute_resource/base.rb
145
146
  - lib/hammer_cli_foreman/compute_resource/ec2.rb
146
- - lib/hammer_cli_foreman/compute_resource/gce.rb
147
147
  - lib/hammer_cli_foreman/compute_resource/libvirt.rb
148
148
  - lib/hammer_cli_foreman/compute_resource/openstack.rb
149
149
  - lib/hammer_cli_foreman/compute_resource/ovirt.rb
@@ -409,12 +409,12 @@ test_files:
409
409
  - test/functional/settings_test.rb
410
410
  - test/functional/status_test.rb
411
411
  - test/functional/user_mail_notification_test.rb
412
+ - test/functional/compute_resource_test.rb
412
413
  - test/functional/compute_profile_test.rb
413
414
  - test/functional/realm_test.rb
414
415
  - test/functional/usergroup_test.rb
415
416
  - test/functional/organization_test.rb
416
417
  - test/functional/virtual_machine_test.rb
417
- - test/functional/compute_resource_test.rb
418
418
  - test/functional/domain/create_test.rb
419
419
  - test/functional/domain/update_test.rb
420
420
  - test/functional/filter_test.rb
@@ -1,47 +0,0 @@
1
- module HammerCLIForeman
2
- module ComputeResources
3
- class GCE < Base
4
- def name
5
- 'GCE'
6
- end
7
-
8
- def compute_attributes
9
- %w[machine_type network associate_external_ip]
10
- end
11
-
12
- def interfaces_attrs_name
13
- 'network_interfaces_nics_attributes'
14
- end
15
-
16
- def volume_attributes
17
- [
18
- ['size_gb', _('Volume size in GB, integer value')]
19
- ]
20
- end
21
-
22
- def provider_specific_fields
23
- [
24
- Fields::Field.new(:label => _('Project'), :path => [:project]),
25
- Fields::Field.new(:label => _('Email'), :path => [:email]),
26
- Fields::Field.new(:label => _('Key Path'), :path => [:key_path]),
27
- Fields::Field.new(:label => _('Zone'), :path => [:zone])
28
- ]
29
- end
30
-
31
- def provider_vm_specific_fields
32
- [
33
- Fields::Field.new(:label => _('Machine Type'), :path => [:machine_type]),
34
- Fields::Field.new(:label => _('Status'), :path => [:status]),
35
- Fields::Field.new(:label => _('Description'), :path => [:description]),
36
- Fields::Field.new(:label => _('Zone'), :path => [:zone])
37
- ]
38
- end
39
-
40
- def mandatory_resource_options
41
- super + %I{project key_path zone}
42
- end
43
- end
44
-
45
- HammerCLIForeman.register_compute_resource('gce', GCE.new)
46
- end
47
- end