hammer_cli_foreman 3.3.0 → 3.5.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.
- checksums.yaml +4 -4
- data/doc/release_notes.md +12 -0
- data/lib/hammer_cli_foreman/api/negotiate_auth.rb +1 -1
- data/lib/hammer_cli_foreman/command_extensions/compute_resource_subcommand.rb +14 -0
- data/lib/hammer_cli_foreman/command_extensions.rb +1 -0
- data/lib/hammer_cli_foreman/compute_resource/register_compute_resources.rb +0 -1
- data/lib/hammer_cli_foreman/compute_resource/vmware.rb +3 -1
- data/lib/hammer_cli_foreman/compute_resource.rb +26 -6
- data/lib/hammer_cli_foreman/id_resolver.rb +2 -1
- data/lib/hammer_cli_foreman/table_preference.rb +48 -0
- data/lib/hammer_cli_foreman/user.rb +3 -0
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/lib/hammer_cli_foreman/virtual_machine.rb +0 -4
- data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/test/data/3.4/foreman_api.json +1 -0
- data/test/functional/compute_resource_test.rb +21 -0
- data/test/functional/table_preference_test.rb +100 -0
- data/test/test_helper.rb +1 -1
- metadata +10 -5
- data/lib/hammer_cli_foreman/compute_resource/gce.rb +0 -47
@@ -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
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
+
|
3
|
+
describe 'table_preference' do
|
4
|
+
let(:base_cmd) { ['user', 'table-preference'] }
|
5
|
+
let(:user) do
|
6
|
+
{
|
7
|
+
:id => 1,
|
8
|
+
:name => 'admin'
|
9
|
+
}
|
10
|
+
end
|
11
|
+
let(:table_preference) do
|
12
|
+
{
|
13
|
+
:id => 1,
|
14
|
+
:user_id => user[:id],
|
15
|
+
:name => 'Table Preference',
|
16
|
+
:columns => ['A', 'B', 'C']
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'list' do
|
21
|
+
let(:cmd) { base_cmd << 'list' }
|
22
|
+
|
23
|
+
it 'lists table preferences for a given user' do
|
24
|
+
params = ['--user-id', user[:id]]
|
25
|
+
api_expects(:table_preferences, :index, params)
|
26
|
+
.returns(index_response([table_preference]))
|
27
|
+
|
28
|
+
expected_result = success_result(/#{table_preference[:name]}/)
|
29
|
+
|
30
|
+
result = run_cmd(cmd + params)
|
31
|
+
assert_cmd(expected_result, result)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'create' do
|
36
|
+
let(:cmd) { base_cmd << 'create' }
|
37
|
+
|
38
|
+
it 'creates a table preference for a given table' do
|
39
|
+
params = ['--user-id', user[:id],
|
40
|
+
'--name', table_preference[:name],
|
41
|
+
'--columns', table_preference[:columns]]
|
42
|
+
api_expects(:table_preferences, :create, params)
|
43
|
+
.returns(table_preference)
|
44
|
+
|
45
|
+
expected_result = success_result("Table preference created.\n")
|
46
|
+
|
47
|
+
result = run_cmd(cmd + params)
|
48
|
+
assert_cmd(expected_result, result)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'update' do
|
53
|
+
let(:cmd) { base_cmd << 'update' }
|
54
|
+
|
55
|
+
it 'updates a table preference for a given table' do
|
56
|
+
params = ['--user-id', user[:id],
|
57
|
+
'--name', table_preference[:name],
|
58
|
+
'--columns', ['A','B','C','D','E']]
|
59
|
+
api_expects(:table_preferences, :update, params)
|
60
|
+
.returns(table_preference)
|
61
|
+
|
62
|
+
expected_result = success_result("Table preference updated.\n")
|
63
|
+
|
64
|
+
result = run_cmd(cmd + params)
|
65
|
+
assert_cmd(expected_result, result)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe 'info' do
|
70
|
+
let(:cmd) { base_cmd << 'info' }
|
71
|
+
|
72
|
+
it 'shows table preference details of a given table' do
|
73
|
+
params = ['--user-id', user[:id],
|
74
|
+
'--name', table_preference[:name]]
|
75
|
+
api_expects(:table_preferences, :show, params)
|
76
|
+
.returns(table_preference)
|
77
|
+
|
78
|
+
expected_result = success_result(/#{table_preference[:name]} | #{table_preference[:columns]}/)
|
79
|
+
|
80
|
+
result = run_cmd(cmd + params)
|
81
|
+
assert_cmd(expected_result, result)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe 'delete' do
|
86
|
+
let(:cmd) { base_cmd << 'delete' }
|
87
|
+
|
88
|
+
it 'deletes a table preference for a given table' do
|
89
|
+
params = ['--user-id', user[:id],
|
90
|
+
'--name', table_preference[:name]]
|
91
|
+
api_expects(:table_preferences, :destroy, params)
|
92
|
+
.returns({})
|
93
|
+
|
94
|
+
expected_result = success_result("Table preference deleted.\n")
|
95
|
+
|
96
|
+
result = run_cmd(cmd + params)
|
97
|
+
assert_cmd(expected_result, result)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -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 = ENV['TEST_API_VERSION'] || '3.
|
20
|
+
FOREMAN_VERSION = ENV['TEST_API_VERSION'] || '3.4'
|
21
21
|
unless Dir.entries('test/data').include? FOREMAN_VERSION
|
22
22
|
raise StandardError.new "Version is not correct"
|
23
23
|
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: 3.
|
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-
|
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
|
@@ -205,6 +205,7 @@ files:
|
|
205
205
|
- lib/hammer_cli_foreman/ssh_keys.rb
|
206
206
|
- lib/hammer_cli_foreman/status.rb
|
207
207
|
- lib/hammer_cli_foreman/subnet.rb
|
208
|
+
- lib/hammer_cli_foreman/table_preference.rb
|
208
209
|
- lib/hammer_cli_foreman/task_helper.rb
|
209
210
|
- lib/hammer_cli_foreman/template.rb
|
210
211
|
- lib/hammer_cli_foreman/testing/api_expectations.rb
|
@@ -245,6 +246,7 @@ files:
|
|
245
246
|
- test/data/2.4/foreman_api.json
|
246
247
|
- test/data/2.5/foreman_api.json
|
247
248
|
- test/data/3.1/foreman_api.json
|
249
|
+
- test/data/3.4/foreman_api.json
|
248
250
|
- test/data/README.md
|
249
251
|
- test/functional/architecture_test.rb
|
250
252
|
- test/functional/associating_commands_test.rb
|
@@ -280,6 +282,7 @@ files:
|
|
280
282
|
- test/functional/status_test.rb
|
281
283
|
- test/functional/subnet/create_test.rb
|
282
284
|
- test/functional/subnet/update_test.rb
|
285
|
+
- test/functional/table_preference_test.rb
|
283
286
|
- test/functional/template_test.rb
|
284
287
|
- test/functional/test_helper.rb
|
285
288
|
- test/functional/user_mail_notification_test.rb
|
@@ -385,6 +388,7 @@ test_files:
|
|
385
388
|
- test/data/2.4/foreman_api.json
|
386
389
|
- test/data/2.5/foreman_api.json
|
387
390
|
- test/data/3.1/foreman_api.json
|
391
|
+
- test/data/3.4/foreman_api.json
|
388
392
|
- test/functional/auth_source_test.rb
|
389
393
|
- test/functional/commands/list_test.rb
|
390
394
|
- test/functional/hostgroup/create_test.rb
|
@@ -405,12 +409,12 @@ test_files:
|
|
405
409
|
- test/functional/settings_test.rb
|
406
410
|
- test/functional/status_test.rb
|
407
411
|
- test/functional/user_mail_notification_test.rb
|
412
|
+
- test/functional/compute_resource_test.rb
|
408
413
|
- test/functional/compute_profile_test.rb
|
409
414
|
- test/functional/realm_test.rb
|
410
415
|
- test/functional/usergroup_test.rb
|
411
416
|
- test/functional/organization_test.rb
|
412
417
|
- test/functional/virtual_machine_test.rb
|
413
|
-
- test/functional/compute_resource_test.rb
|
414
418
|
- test/functional/domain/create_test.rb
|
415
419
|
- test/functional/domain/update_test.rb
|
416
420
|
- test/functional/filter_test.rb
|
@@ -425,6 +429,7 @@ test_files:
|
|
425
429
|
- test/functional/bookmark_test.rb
|
426
430
|
- test/functional/model_test.rb
|
427
431
|
- test/functional/registration_test.rb
|
432
|
+
- test/functional/table_preference_test.rb
|
428
433
|
- test/unit/api/void_auth_test.rb
|
429
434
|
- test/unit/api/interactive_basic_auth_test.rb
|
430
435
|
- test/unit/api/oauth/oauth_authentication_code_grant_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
|