hammer_cli_foreman 2.5.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/release_notes.md +10 -1
- data/lib/hammer_cli_foreman.rb +0 -21
- data/lib/hammer_cli_foreman/architecture.rb +5 -5
- data/lib/hammer_cli_foreman/associating_commands.rb +0 -24
- data/lib/hammer_cli_foreman/bookmark.rb +5 -5
- data/lib/hammer_cli_foreman/combination.rb +3 -13
- data/lib/hammer_cli_foreman/command_extensions.rb +0 -2
- data/lib/hammer_cli_foreman/commands.rb +2 -9
- data/lib/hammer_cli_foreman/compute_profile.rb +5 -5
- data/lib/hammer_cli_foreman/host.rb +0 -35
- data/lib/hammer_cli_foreman/hostgroup.rb +2 -53
- data/lib/hammer_cli_foreman/hosts/common_update_options.rb +1 -23
- data/lib/hammer_cli_foreman/id_resolver.rb +0 -61
- data/lib/hammer_cli_foreman/location.rb +0 -6
- data/lib/hammer_cli_foreman/mail_notification.rb +2 -2
- data/lib/hammer_cli_foreman/model.rb +5 -5
- data/lib/hammer_cli_foreman/operating_system.rb +10 -10
- data/lib/hammer_cli_foreman/option_sources.rb +0 -1
- data/lib/hammer_cli_foreman/option_sources/id_params.rb +27 -10
- data/lib/hammer_cli_foreman/option_sources/ids_params.rb +25 -6
- data/lib/hammer_cli_foreman/organization.rb +0 -6
- data/lib/hammer_cli_foreman/references.rb +0 -16
- data/lib/hammer_cli_foreman/settings.rb +3 -3
- data/lib/hammer_cli_foreman/smart_proxy.rb +0 -52
- data/lib/hammer_cli_foreman/usergroup.rb +5 -5
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/lib/minitest/coverage_reporter.rb +1 -1
- 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/functional/architecture_test.rb +6 -4
- data/test/functional/bookmark_test.rb +3 -1
- data/test/functional/compute_profile_test.rb +3 -1
- data/test/functional/host_test.rb +0 -1
- data/test/functional/hostgroup/create_test.rb +0 -117
- data/test/functional/hostgroup/update_test.rb +0 -79
- data/test/functional/location_test.rb +0 -3
- data/test/functional/mail_notification_test.rb +3 -1
- data/test/functional/model_test.rb +3 -1
- data/test/functional/operating_system_test.rb +3 -1
- data/test/functional/settings_test.rb +4 -4
- data/test/functional/template_test.rb +4 -37
- data/test/functional/usergroup_test.rb +3 -1
- data/test/unit/apipie_resource_mock.rb +1 -39
- data/test/unit/architecture_test.rb +10 -10
- data/test/unit/bookmark_test.rb +10 -14
- data/test/unit/compute_profile_test.rb +10 -10
- data/test/unit/helpers/command.rb +0 -8
- data/test/unit/host_test.rb +14 -61
- data/test/unit/hostgroup_test.rb +7 -26
- data/test/unit/id_resolver_test.rb +0 -28
- data/test/unit/mail_notification_test.rb +4 -4
- data/test/unit/model_test.rb +47 -47
- data/test/unit/operating_system_test.rb +10 -16
- data/test/unit/option_sources/id_params_test.rb +9 -0
- data/test/unit/option_sources/ids_params_test.rb +9 -0
- data/test/unit/settings_test.rb +4 -4
- data/test/unit/smart_proxy_test.rb +0 -12
- data/test/unit/usergroup_test.rb +10 -10
- metadata +64 -85
- data/lib/hammer_cli_foreman/command_extensions/puppet_environment.rb +0 -29
- data/lib/hammer_cli_foreman/command_extensions/puppet_environments.rb +0 -29
- data/lib/hammer_cli_foreman/config_group.rb +0 -45
- data/lib/hammer_cli_foreman/option_sources/puppet_environment_params.rb +0 -59
- data/lib/hammer_cli_foreman/puppet_class.rb +0 -61
- data/lib/hammer_cli_foreman/puppet_environment.rb +0 -65
- data/lib/hammer_cli_foreman/smart_class_parameter.rb +0 -189
- data/test/functional/config_group_test.rb +0 -50
- data/test/functional/proxy_test.rb +0 -86
- data/test/functional/smart_class_parameter_test.rb +0 -97
- data/test/unit/config_group_test.rb +0 -82
- data/test/unit/puppet_class_test.rb +0 -72
- data/test/unit/puppet_environment_test.rb +0 -114
- data/test/unit/smart_class_parameter_test.rb +0 -113
@@ -1,97 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
-
|
3
|
-
|
4
|
-
describe 'sc-params update' do
|
5
|
-
let(:cmd) { %w(sc-param update) }
|
6
|
-
|
7
|
-
it 'does not allow to update parameter name' do
|
8
|
-
params = ['--id=1', '--new-name=name2']
|
9
|
-
|
10
|
-
expected_result = usage_error_result(
|
11
|
-
cmd,
|
12
|
-
"Unrecognised option '--new-name'.",
|
13
|
-
"Could not update the parameter"
|
14
|
-
)
|
15
|
-
|
16
|
-
api_expects_no_call
|
17
|
-
result = run_cmd(cmd + params)
|
18
|
-
assert_cmd(expected_result, result)
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
describe 'sc-params add-matcher' do
|
24
|
-
let(:cmd) { %w(sc-param add-matcher) }
|
25
|
-
let(:override_value) { 'something' }
|
26
|
-
let(:match) { 'domain = example.com' }
|
27
|
-
let(:puppet_class) { { 'name' => 'motd', 'id' => '1' } }
|
28
|
-
let(:parameter) { { 'name' => 'content', 'id' => '2' } }
|
29
|
-
let(:base) { [
|
30
|
-
'--puppet-class', puppet_class['name'],
|
31
|
-
'--smart-class-parameter', parameter['name'],
|
32
|
-
'--match', match
|
33
|
-
] }
|
34
|
-
|
35
|
-
def api_expects_parameter_search(puppet_class, parameter)
|
36
|
-
api_expects(:puppetclasses, :index, 'Find puppet class') do |par|
|
37
|
-
par[:search] == %Q(name = "#{puppet_class['name']}")
|
38
|
-
end.returns(index_response('motd' => [puppet_class]))
|
39
|
-
|
40
|
-
api_expects(:smart_class_parameters, :index, 'Find smart parameter') do |par|
|
41
|
-
par[:search] == %Q(key = "#{parameter['name']}") &&
|
42
|
-
par[:puppetclass_id] == puppet_class['id']
|
43
|
-
end.returns(index_response([parameter]))
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'allows to set value' do
|
47
|
-
params = ['--value', override_value]
|
48
|
-
expected_result = success_result("Override value created.\n")
|
49
|
-
|
50
|
-
api_expects_parameter_search(puppet_class, parameter)
|
51
|
-
|
52
|
-
api_expects(:override_values, :create, 'Create override value').with_params(
|
53
|
-
:smart_class_parameter_id => parameter['id'],
|
54
|
-
:override_value => {
|
55
|
-
:match => match,
|
56
|
-
:value => override_value
|
57
|
-
}
|
58
|
-
)
|
59
|
-
|
60
|
-
result = run_cmd(cmd + base + params)
|
61
|
-
assert_cmd(expected_result, result)
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'allows to set value with disabled puppet default' do
|
65
|
-
params = ['--value', override_value, '--omit', false]
|
66
|
-
expected_result = success_result("Override value created.\n")
|
67
|
-
|
68
|
-
api_expects_parameter_search(puppet_class, parameter)
|
69
|
-
|
70
|
-
api_expects(:override_values, :create, 'Create override value').with_params(
|
71
|
-
:smart_class_parameter_id => parameter['id'],
|
72
|
-
:override_value => {
|
73
|
-
:match => match,
|
74
|
-
:value => override_value,
|
75
|
-
:omit => false
|
76
|
-
}
|
77
|
-
)
|
78
|
-
|
79
|
-
result = run_cmd(cmd + base + params)
|
80
|
-
assert_cmd(expected_result, result)
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'does not allow to use puppet default and value at the same time' do
|
84
|
-
params = ['--value', 'something', '--omit', true]
|
85
|
-
|
86
|
-
expected_result = usage_error_result(
|
87
|
-
cmd,
|
88
|
-
"Cannot use --value when --omit is true.",
|
89
|
-
'Could not create the override value'
|
90
|
-
)
|
91
|
-
|
92
|
-
api_expects_parameter_search(puppet_class, parameter)
|
93
|
-
|
94
|
-
result = run_cmd(cmd + base + params)
|
95
|
-
assert_cmd(expected_result, result)
|
96
|
-
end
|
97
|
-
end
|
@@ -1,82 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
-
require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
|
3
|
-
|
4
|
-
require 'hammer_cli_foreman/config_group'
|
5
|
-
|
6
|
-
describe HammerCLIForeman::ConfigGroup do
|
7
|
-
include CommandTestHelper
|
8
|
-
|
9
|
-
context "ListCommand" do
|
10
|
-
let(:cmd) { HammerCLIForeman::ConfigGroup::ListCommand.new("", ctx) }
|
11
|
-
|
12
|
-
before :each do
|
13
|
-
ResourceMocks.config_groups_index
|
14
|
-
end
|
15
|
-
|
16
|
-
context "parameters" do
|
17
|
-
it_should_accept "no arguments"
|
18
|
-
it_should_accept_search_params
|
19
|
-
it_should_fail_with 'organization param', ['--organization-id=1']
|
20
|
-
it_should_fail_with 'location param', ['--location-id=1']
|
21
|
-
end
|
22
|
-
|
23
|
-
context "output" do
|
24
|
-
let(:expected_record_count) { cmd.resource.call(:index).length }
|
25
|
-
it_should_print_n_records
|
26
|
-
it_should_print_columns ["ID", "Name"]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context "InfoCommand" do
|
31
|
-
let(:cmd) { HammerCLIForeman::ConfigGroup::InfoCommand.new("", ctx) }
|
32
|
-
|
33
|
-
context "parameters" do
|
34
|
-
it_should_accept "id", ["--id=1"]
|
35
|
-
it_should_accept "name", ["--name=group_x"]
|
36
|
-
it_should_fail_with 'organization param', ['--organization-id=1']
|
37
|
-
it_should_fail_with 'location param', ['--location-id=1']
|
38
|
-
end
|
39
|
-
|
40
|
-
context "output" do
|
41
|
-
with_params ["--id=1"] do
|
42
|
-
it_should_print_n_records 1
|
43
|
-
it_should_print_column "Name"
|
44
|
-
it_should_print_column "ID"
|
45
|
-
it_should_print_column "Puppetclasses"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context "CreateCommand" do
|
51
|
-
let(:cmd) { HammerCLIForeman::ConfigGroup::CreateCommand.new("", ctx) }
|
52
|
-
|
53
|
-
context "parameters" do
|
54
|
-
it_should_accept "name, puppetclass ids", ["--name=first_group", "--puppet-class-ids=1,2"]
|
55
|
-
it_should_fail_with 'organization param', ['--organization-id=1']
|
56
|
-
it_should_fail_with 'location param', ['--location-id=1']
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context "DeleteCommand" do
|
61
|
-
let(:cmd) { HammerCLIForeman::ConfigGroup::DeleteCommand.new("", ctx) }
|
62
|
-
|
63
|
-
context "parameters" do
|
64
|
-
it_should_accept "name", ["--name=group_x"]
|
65
|
-
it_should_accept "id", ["--id=1"]
|
66
|
-
it_should_fail_with 'organization param', ['--organization-id=1']
|
67
|
-
it_should_fail_with 'location param', ['--location-id=1']
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context "UpdateCommand" do
|
72
|
-
|
73
|
-
let(:cmd) { HammerCLIForeman::ConfigGroup::UpdateCommand.new("", ctx) }
|
74
|
-
|
75
|
-
context "parameters" do
|
76
|
-
it_should_accept "name", ["--name=group_x"]
|
77
|
-
it_should_accept "id", ["--id=1"]
|
78
|
-
it_should_fail_with 'organization param', ['--organization-id=1']
|
79
|
-
it_should_fail_with 'location param', ['--location-id=1']
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
-
require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
|
3
|
-
|
4
|
-
require 'hammer_cli_foreman/puppet_class'
|
5
|
-
|
6
|
-
describe HammerCLIForeman::PuppetClass do
|
7
|
-
|
8
|
-
include CommandTestHelper
|
9
|
-
|
10
|
-
context "ListCommand" do
|
11
|
-
before do
|
12
|
-
ResourceMocks.mock_action_call(:puppetclasses, :index, {})
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:cmd) { HammerCLIForeman::PuppetClass::ListCommand.new("", ctx) }
|
16
|
-
|
17
|
-
context "parameters" do
|
18
|
-
it_should_accept "no arguments"
|
19
|
-
# FIXME: the command should accept search parameters in future
|
20
|
-
# it_should_accept_search_params
|
21
|
-
end
|
22
|
-
|
23
|
-
context "output" do
|
24
|
-
let(:expected_record_count) do
|
25
|
-
# data are retuned in specific format
|
26
|
-
HammerCLIForeman.collection_to_common_format(cmd.resource.call(:index)).first.keys.count
|
27
|
-
end
|
28
|
-
|
29
|
-
it_should_print_n_records
|
30
|
-
it_should_print_column "Id"
|
31
|
-
it_should_print_column "Name"
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
context "InfoCommand" do
|
38
|
-
|
39
|
-
let(:cmd) { HammerCLIForeman::PuppetClass::InfoCommand.new("", ctx) }
|
40
|
-
|
41
|
-
context "parameters" do
|
42
|
-
it_should_accept "id", ["--id=1"]
|
43
|
-
# it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
|
44
|
-
end
|
45
|
-
|
46
|
-
context "output" do
|
47
|
-
with_params ["--id=1"] do
|
48
|
-
it_should_print_n_records 1
|
49
|
-
it_should_print_column "Id"
|
50
|
-
it_should_print_column "Name"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
context "SCParamsCommand" do
|
57
|
-
|
58
|
-
before :each do
|
59
|
-
ResourceMocks.smart_class_parameters_index
|
60
|
-
end
|
61
|
-
|
62
|
-
let(:cmd) { HammerCLIForeman::PuppetClass::SCParamsCommand.new("", ctx) }
|
63
|
-
|
64
|
-
context "parameters" do
|
65
|
-
it_should_accept "puppet-class", ["--puppet-class=cls"]
|
66
|
-
it_should_accept "puppet-class-id", ["--puppet-class-id=1"]
|
67
|
-
# it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
@@ -1,114 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
-
require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
|
3
|
-
|
4
|
-
require 'hammer_cli_foreman/puppet_environment'
|
5
|
-
|
6
|
-
describe HammerCLIForeman::PuppetEnvironment do
|
7
|
-
|
8
|
-
include CommandTestHelper
|
9
|
-
|
10
|
-
context "ListCommand" do
|
11
|
-
before do
|
12
|
-
ResourceMocks.mock_action_call(:environments, :index, [])
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:cmd) { HammerCLIForeman::PuppetEnvironment::ListCommand.new("", ctx) }
|
16
|
-
|
17
|
-
context "parameters" do
|
18
|
-
it_should_accept "no arguments"
|
19
|
-
it_should_accept_search_params
|
20
|
-
end
|
21
|
-
|
22
|
-
context "output" do
|
23
|
-
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
24
|
-
|
25
|
-
it_should_print_n_records
|
26
|
-
it_should_print_column "Name"
|
27
|
-
it_should_print_column "Id"
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
context "InfoCommand" do
|
34
|
-
|
35
|
-
let(:cmd) { HammerCLIForeman::PuppetEnvironment::InfoCommand.new("", ctx) }
|
36
|
-
|
37
|
-
context "parameters" do
|
38
|
-
it_should_accept "id", ["--id=1"]
|
39
|
-
it_should_accept "name", ["--name=env"]
|
40
|
-
# it_should_fail_with "no arguments"
|
41
|
-
# TODO: temporarily disabled, parameters are checked in the id resolver
|
42
|
-
end
|
43
|
-
|
44
|
-
context "output" do
|
45
|
-
with_params ["--id=1"] do
|
46
|
-
it_should_print_n_records 1
|
47
|
-
it_should_print_column "Name"
|
48
|
-
it_should_print_column "Id"
|
49
|
-
it_should_print_column "Created at"
|
50
|
-
it_should_print_column "Updated at"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
context "CreateCommand" do
|
58
|
-
|
59
|
-
let(:cmd) { HammerCLIForeman::PuppetEnvironment::CreateCommand.new("", ctx) }
|
60
|
-
|
61
|
-
context "parameters" do
|
62
|
-
it_should_accept "name", ["--name=env"]
|
63
|
-
# it_should_fail_with "name missing", []
|
64
|
-
# TODO: temporarily disabled, parameters are checked by the api
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
context "DeleteCommand" do
|
71
|
-
|
72
|
-
let(:cmd) { HammerCLIForeman::PuppetEnvironment::DeleteCommand.new("", ctx) }
|
73
|
-
|
74
|
-
context "parameters" do
|
75
|
-
it_should_accept "name", ["--name=env"]
|
76
|
-
it_should_accept "id", ["--id=1"]
|
77
|
-
# it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
|
83
|
-
context "UpdateCommand" do
|
84
|
-
|
85
|
-
let(:cmd) { HammerCLIForeman::PuppetEnvironment::UpdateCommand.new("", ctx) }
|
86
|
-
|
87
|
-
context "parameters" do
|
88
|
-
it_should_accept "name", ["--name=env", "--new-name=env2"]
|
89
|
-
it_should_accept "id", ["--id=1", "--new-name=env2"]
|
90
|
-
# it_should_fail_with "no params", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
91
|
-
# it_should_fail_with "name or id missing", ["--new-name=env2"] # TODO: temporarily disabled, parameters are checked in the id resolver
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
context "SCParamsCommand" do
|
97
|
-
|
98
|
-
before :each do
|
99
|
-
ResourceMocks.smart_class_parameters_index
|
100
|
-
end
|
101
|
-
|
102
|
-
let(:cmd) { HammerCLIForeman::PuppetEnvironment::SCParamsCommand.new("", ctx) }
|
103
|
-
|
104
|
-
context "parameters" do
|
105
|
-
it_should_accept "environment", ["--environment=env"]
|
106
|
-
it_should_accept "environment-id", ["--environment-id=1"]
|
107
|
-
it_should_accept "puppet-environment", ["--puppet-environment=env"]
|
108
|
-
it_should_accept "puppet-environment-id", ["--puppet-environment-id=1"]
|
109
|
-
# it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
@@ -1,113 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
-
require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
|
3
|
-
|
4
|
-
require 'hammer_cli_foreman/smart_class_parameter'
|
5
|
-
|
6
|
-
describe HammerCLIForeman::SmartClassParameter do
|
7
|
-
|
8
|
-
include CommandTestHelper
|
9
|
-
|
10
|
-
context "ListCommand" do
|
11
|
-
|
12
|
-
before :each do
|
13
|
-
ResourceMocks.smart_class_parameters_index
|
14
|
-
end
|
15
|
-
|
16
|
-
let(:cmd) { HammerCLIForeman::SmartClassParameter::ListCommand.new("", ctx) }
|
17
|
-
|
18
|
-
context "parameters" do
|
19
|
-
it_should_accept "no arguments"
|
20
|
-
it_should_accept "hostgroup id", ["--hostgroup-id=1"]
|
21
|
-
it_should_accept "host id", ["--host-id=1"]
|
22
|
-
it_should_accept "environment id", ["--environment-id=1"]
|
23
|
-
it_should_accept "puppet-class-id", ["--puppet-class-id=1"]
|
24
|
-
it_should_accept_search_params
|
25
|
-
end
|
26
|
-
|
27
|
-
context "output" do
|
28
|
-
let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
|
29
|
-
|
30
|
-
it_should_print_n_records
|
31
|
-
it_should_print_column "Id"
|
32
|
-
it_should_print_column "Class Id"
|
33
|
-
it_should_print_column "Puppet class"
|
34
|
-
it_should_print_column "Parameter"
|
35
|
-
it_should_print_column "Default Value"
|
36
|
-
it_should_print_column "Override"
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
context "InfoCommand" do
|
43
|
-
|
44
|
-
before :each do
|
45
|
-
ResourceMocks.smart_class_parameters_show
|
46
|
-
end
|
47
|
-
|
48
|
-
let(:cmd) { HammerCLIForeman::SmartClassParameter::InfoCommand.new("", ctx) }
|
49
|
-
|
50
|
-
context "parameters" do
|
51
|
-
it_should_accept "id", ["--id=1"]
|
52
|
-
it_should_accept "name, puppet-class", ["--name=par", "--puppet-class=ntp"]
|
53
|
-
it_should_fail_with "name", ["--name=par"]
|
54
|
-
# it_should_fail_with "no arguments"
|
55
|
-
# TODO: temporarily disabled, parameters are checked in the id resolver
|
56
|
-
end
|
57
|
-
|
58
|
-
context "output" do
|
59
|
-
with_params ["--id=1"] do
|
60
|
-
it_should_print_n_records 1
|
61
|
-
it_should_print_columns ["Description", "Type", "Omit", "Required"]
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
context "UpdateCommand" do
|
68
|
-
|
69
|
-
let(:cmd) { HammerCLIForeman::SmartClassParameter::UpdateCommand.new("", ctx) }
|
70
|
-
|
71
|
-
context "parameters" do
|
72
|
-
it_should_accept "id", ["--id=1"]
|
73
|
-
it_should_accept "name, puppet-class", ["--name=par", "--puppet-class=ntp"]
|
74
|
-
it_should_fail_with "name", ["--name=par"]
|
75
|
-
it_should_accept "override", ["--id=1","--override=true"]
|
76
|
-
it_should_accept "description", ["--id=1","--description=descr"]
|
77
|
-
it_should_accept "default-value", ["--id=1","--default-value=1"]
|
78
|
-
it_should_accept "path ", ["--id=1","--path=path"]
|
79
|
-
it_should_accept "validator-type", ["--id=1","--validator-type=list"]
|
80
|
-
it_should_accept "validator-rule ", ["--id=1","--validator-rule=''"]
|
81
|
-
it_should_accept "override-value-order", ["--id=1","--override-value-order=fqdn"]
|
82
|
-
it_should_accept "parameter-type ", ["--id=1","--parameter-type=string"]
|
83
|
-
it_should_accept "required", ["--id=1","--required=true"]
|
84
|
-
|
85
|
-
# it_should_fail_with "no params", []
|
86
|
-
# TODO: temporarily disabled, parameters are checked in the id resolver
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
90
|
-
|
91
|
-
context "AddMatcherCommand" do
|
92
|
-
|
93
|
-
let(:cmd) { HammerCLIForeman::SmartClassParameter::AddMatcherCommand.new("", ctx) }
|
94
|
-
|
95
|
-
context "parameters" do
|
96
|
-
it_should_accept "smart-class-parametr-id, match, value", ["--smart-class-parameter-id=1", "--match='domain=my.lan'", "--value=1"]
|
97
|
-
it_should_accept "smart-class-parameter, puppet-class, match, value", ["--smart-class-parameter=par", "--puppet-class=ntp", "--match='domain=my.lan'", "--value=1"]
|
98
|
-
it_should_fail_with "smart-class-parameter, match, value", ["--smart-class-parameter=par", "--match='domain=my.lan'", "--value=1"]
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
context "RemoveMatcherCommand" do
|
103
|
-
|
104
|
-
let(:cmd) { HammerCLIForeman::SmartClassParameter::RemoveMatcherCommand.new("", ctx) }
|
105
|
-
|
106
|
-
context "parameters" do
|
107
|
-
it_should_accept "smart-class-parametr-id, id", ["--smart-class-parameter-id=1", "--id=1"]
|
108
|
-
it_should_accept "smart-class-parameter, puppet-class, id", ["--smart-class-parameter=par", "--puppet-class=ntp", "--id=1"]
|
109
|
-
it_should_fail_with "smart-class-parameter, id", ["--smart-class-parameter=par", "--id=1"]
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|