hammer_cli_foreman_puppet 0.0.3 → 0.0.6
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/README.md +27 -15
- data/lib/hammer_cli_foreman_puppet/combination.rb +23 -0
- data/lib/hammer_cli_foreman_puppet/command_extensions/combination.rb +15 -0
- data/lib/hammer_cli_foreman_puppet/command_extensions/host.rb +27 -2
- data/lib/hammer_cli_foreman_puppet/command_extensions/hostgroup.rb +21 -0
- data/lib/hammer_cli_foreman_puppet/host.rb +5 -0
- data/lib/hammer_cli_foreman_puppet/hostgroup.rb +6 -2
- data/lib/hammer_cli_foreman_puppet/location.rb +1 -14
- data/lib/hammer_cli_foreman_puppet/organization.rb +1 -14
- data/lib/hammer_cli_foreman_puppet/version.rb +1 -1
- data/lib/hammer_cli_foreman_puppet.rb +1 -1
- data/test/data/3.3/foreman_api.json +1 -0
- data/test/functional/host/create_test.rb +35 -4
- data/test/functional/host/update_test.rb +33 -4
- data/test/functional/hostgroup/create_test.rb +34 -5
- data/test/functional/hostgroup/update_test.rb +33 -4
- data/test/functional/template_test.rb +6 -6
- data/test/test_helper.rb +1 -1
- data/test/unit/config_group_test.rb +2 -10
- metadata +26 -26
- data/lib/hammer_cli_foreman_puppet/associating_commands/associating_commands.rb +0 -40
- data/lib/hammer_cli_foreman_puppet/references.rb +0 -22
@@ -25,7 +25,7 @@ module HammerCLIForemanPuppet
|
|
25
25
|
p[:search] == 'name = "env1"'
|
26
26
|
end.returns(index_response([{ 'id' => 1 }]))
|
27
27
|
api_expects(:hosts, :create) do |p|
|
28
|
-
p['host']['environment_id'] == 1 &&
|
28
|
+
p['host']['puppet_attributes']['environment_id'] == 1 &&
|
29
29
|
p['host']['name'] == 'hst1'
|
30
30
|
end
|
31
31
|
run_cmd(cmd + minimal_params_without_hostgroup + params)
|
@@ -59,7 +59,7 @@ module HammerCLIForemanPuppet
|
|
59
59
|
it 'allows puppet class ids' do
|
60
60
|
params = %w[--puppet-class-ids=1,2]
|
61
61
|
api_expects(:hosts, :create) do |p|
|
62
|
-
p['host']['puppetclass_ids'] == %w[1 2] &&
|
62
|
+
p['host']['puppet_attributes']['puppetclass_ids'] == %w[1 2] &&
|
63
63
|
p['host']['name'] == 'hst1'
|
64
64
|
end
|
65
65
|
run_cmd(cmd + minimal_params_without_hostgroup + params)
|
@@ -81,7 +81,7 @@ module HammerCLIForemanPuppet
|
|
81
81
|
{'id' => 2, 'name' => 'pc2'}
|
82
82
|
]))
|
83
83
|
api_expects(:hosts, :create) do |p|
|
84
|
-
p['host']['puppetclass_ids'] == [1,2] &&
|
84
|
+
p['host']['puppet_attributes']['puppetclass_ids'] == [1,2] &&
|
85
85
|
p['host']['name'] == 'hst1'
|
86
86
|
end
|
87
87
|
run_cmd(cmd + minimal_params_without_hostgroup + params)
|
@@ -130,7 +130,7 @@ module HammerCLIForemanPuppet
|
|
130
130
|
|
131
131
|
api_expects(:hosts, :create) do |p|
|
132
132
|
p['host']['name'] == 'hst1' &&
|
133
|
-
p['host']['puppetclass_ids'] == ids
|
133
|
+
p['host']['puppet_attributes']['puppetclass_ids'] == ids
|
134
134
|
end
|
135
135
|
run_cmd(cmd + minimal_params_without_hostgroup + params)
|
136
136
|
end
|
@@ -159,6 +159,37 @@ module HammerCLIForemanPuppet
|
|
159
159
|
end
|
160
160
|
run_cmd(cmd + minimal_params_without_hostgroup + params)
|
161
161
|
end
|
162
|
+
|
163
|
+
it 'allows config group ids' do
|
164
|
+
params = %w[--config-group-ids=1,2]
|
165
|
+
api_expects(:hosts, :create) do |p|
|
166
|
+
p['host']['puppet_attributes']['config_group_ids'] == %w[1 2] &&
|
167
|
+
p['host']['name'] == 'hst1'
|
168
|
+
end
|
169
|
+
run_cmd(cmd + minimal_params_without_hostgroup + params)
|
170
|
+
end
|
171
|
+
|
172
|
+
it 'allows config group names' do
|
173
|
+
params = %w[--config-groups=cg1,cg2]
|
174
|
+
api_expects(:config_groups, :index) do |p|
|
175
|
+
p[:search] = 'name = "cg1" or name = "cg2"'
|
176
|
+
end.returns(index_response([
|
177
|
+
{'id' => 1, 'name' => 'cg1'},
|
178
|
+
{'id' => 2, 'name' => 'cg2'}
|
179
|
+
]))
|
180
|
+
# FIXME: Called twice because of config_group_ids being mentioned twice in the docs
|
181
|
+
api_expects(:config_groups, :index) do |p|
|
182
|
+
p[:search] = 'name = "cg1" or name = "cg2"'
|
183
|
+
end.returns(index_response([
|
184
|
+
{'id' => 1, 'name' => 'cg1'},
|
185
|
+
{'id' => 2, 'name' => 'cg2'}
|
186
|
+
]))
|
187
|
+
api_expects(:hosts, :create) do |p|
|
188
|
+
p['host']['puppet_attributes']['config_group_ids'] == [1, 2] &&
|
189
|
+
p['host']['name'] == 'hst1'
|
190
|
+
end
|
191
|
+
run_cmd(cmd + minimal_params_without_hostgroup + params)
|
192
|
+
end
|
162
193
|
end
|
163
194
|
end
|
164
195
|
end
|
@@ -5,7 +5,7 @@ module HammerCLIForemanPuppet
|
|
5
5
|
describe UpdateCommand do
|
6
6
|
it 'allows environment id' do
|
7
7
|
api_expects(:hosts, :update) do |p|
|
8
|
-
p['host']['environment_id'] == 1 &&
|
8
|
+
p['host']['puppet_attributes']['environment_id'] == 1 &&
|
9
9
|
p['id'] == '1'
|
10
10
|
end
|
11
11
|
run_cmd(%w(host update --id 1 --puppet-environment-id 1))
|
@@ -20,7 +20,7 @@ module HammerCLIForemanPuppet
|
|
20
20
|
p[:search] = "name = \"env1\""
|
21
21
|
end.returns(index_response([{'id' => 1}]))
|
22
22
|
api_expects(:hosts, :update) do |p|
|
23
|
-
p['host']['environment_id'] == 1 &&
|
23
|
+
p['host']['puppet_attributes']['environment_id'] == 1 &&
|
24
24
|
p['id'] == '1'
|
25
25
|
end
|
26
26
|
run_cmd(%w(host update --id 1 --puppet-environment env1))
|
@@ -47,7 +47,7 @@ module HammerCLIForemanPuppet
|
|
47
47
|
|
48
48
|
it 'allows puppet class ids' do
|
49
49
|
api_expects(:hosts, :update) do |p|
|
50
|
-
p['host']['puppetclass_ids'] == ['1','2'] &&
|
50
|
+
p['host']['puppet_attributes']['puppetclass_ids'] == ['1','2'] &&
|
51
51
|
p['id'] == '1'
|
52
52
|
end
|
53
53
|
run_cmd(%w(host update --id 1 --puppet-class-ids 1,2))
|
@@ -68,7 +68,7 @@ module HammerCLIForemanPuppet
|
|
68
68
|
{'id' => 2, 'name' => 'pc2'}
|
69
69
|
]))
|
70
70
|
api_expects(:hosts, :update) do |p|
|
71
|
-
p['host']['puppetclass_ids'] == [1,2] &&
|
71
|
+
p['host']['puppet_attributes']['puppetclass_ids'] == [1,2] &&
|
72
72
|
p['id'] == '1'
|
73
73
|
end
|
74
74
|
run_cmd(%w(host update --id 1 --puppet-classes pc1,pc2))
|
@@ -92,6 +92,35 @@ module HammerCLIForemanPuppet
|
|
92
92
|
end
|
93
93
|
run_cmd(%w(host update --id 1 --puppet-proxy sp1))
|
94
94
|
end
|
95
|
+
|
96
|
+
it 'allows config group ids' do
|
97
|
+
api_expects(:hosts, :update) do |p|
|
98
|
+
p['host']['puppet_attributes']['config_group_ids'] == %w[1 2] &&
|
99
|
+
p['id'] == '1'
|
100
|
+
end
|
101
|
+
run_cmd(%w[host update --id 1 --config-group-ids=1,2])
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'allows config group names' do
|
105
|
+
api_expects(:config_groups, :index) do |p|
|
106
|
+
p[:search] = 'name = "cg1" or name = "cg2"'
|
107
|
+
end.returns(index_response([
|
108
|
+
{'id' => 1, 'name' => 'cg1'},
|
109
|
+
{'id' => 2, 'name' => 'cg2'}
|
110
|
+
]))
|
111
|
+
# FIXME: Called twice because of config_group_ids being mentioned twice in the docs
|
112
|
+
api_expects(:config_groups, :index) do |p|
|
113
|
+
p[:search] = 'name = "cg1" or name = "cg2"'
|
114
|
+
end.returns(index_response([
|
115
|
+
{'id' => 1, 'name' => 'cg1'},
|
116
|
+
{'id' => 2, 'name' => 'cg2'}
|
117
|
+
]))
|
118
|
+
api_expects(:hosts, :update) do |p|
|
119
|
+
p['host']['puppet_attributes']['config_group_ids'] == [1, 2] &&
|
120
|
+
p['id'] == '1'
|
121
|
+
end
|
122
|
+
run_cmd(%w[host update --id 1 --config-groups=cg1,cg2])
|
123
|
+
end
|
95
124
|
end
|
96
125
|
end
|
97
126
|
end
|
@@ -5,7 +5,7 @@ module HammerCLIForemanPuppet
|
|
5
5
|
describe CreateCommand do
|
6
6
|
it 'allows puppet environment id' do
|
7
7
|
api_expects(:hostgroups, :create) do |p|
|
8
|
-
p['hostgroup']['environment_id'] == 1 &&
|
8
|
+
p['hostgroup']['puppet_attributes']['environment_id'] == 1 &&
|
9
9
|
p['hostgroup']['name'] == 'hg1'
|
10
10
|
end
|
11
11
|
run_cmd(%w[hostgroup create --name hg1 --puppet-environment-id 1])
|
@@ -20,7 +20,7 @@ module HammerCLIForemanPuppet
|
|
20
20
|
p[:search] == 'name = "env1"'
|
21
21
|
end.returns(index_response([{ 'id' => 1 }]))
|
22
22
|
api_expects(:hostgroups, :create) do |p|
|
23
|
-
p['hostgroup']['environment_id'] == 1 &&
|
23
|
+
p['hostgroup']['puppet_attributes']['environment_id'] == 1 &&
|
24
24
|
p['hostgroup']['name'] == 'hg1'
|
25
25
|
end
|
26
26
|
run_cmd(%w[hostgroup create --name hg1 --puppet-environment env1])
|
@@ -49,7 +49,7 @@ module HammerCLIForemanPuppet
|
|
49
49
|
|
50
50
|
it 'allows puppet class ids' do
|
51
51
|
api_expects(:hostgroups, :create) do |p|
|
52
|
-
p['hostgroup']['puppetclass_ids'] == ['1','2'] &&
|
52
|
+
p['hostgroup']['puppet_attributes']['puppetclass_ids'] == ['1','2'] &&
|
53
53
|
p['hostgroup']['name'] == 'hg1'
|
54
54
|
end
|
55
55
|
run_cmd(%w(hostgroup create --name hg1 --puppet-class-ids 1,2))
|
@@ -70,7 +70,7 @@ module HammerCLIForemanPuppet
|
|
70
70
|
{'id' => 2, 'name' => 'pc2'}
|
71
71
|
]))
|
72
72
|
api_expects(:hostgroups, :create) do |p|
|
73
|
-
p['hostgroup']['puppetclass_ids'] == [1,2] &&
|
73
|
+
p['hostgroup']['puppet_attributes']['puppetclass_ids'] == [1,2] &&
|
74
74
|
p['hostgroup']['name'] == 'hg1'
|
75
75
|
end
|
76
76
|
run_cmd(%w(hostgroup create --name hg1 --puppet-classes pc1,pc2))
|
@@ -118,7 +118,7 @@ module HammerCLIForemanPuppet
|
|
118
118
|
|
119
119
|
api_expects(:hostgroups, :create) do |p|
|
120
120
|
p['hostgroup']['name'] == 'hg1' &&
|
121
|
-
p['hostgroup']['puppetclass_ids'] == ids
|
121
|
+
p['hostgroup']['puppet_attributes']['puppetclass_ids'] == ids
|
122
122
|
end
|
123
123
|
|
124
124
|
run_cmd(%w[hostgroup create --name hg1 --puppet-classes] << names.join(',').tr('"', ''))
|
@@ -144,6 +144,35 @@ module HammerCLIForemanPuppet
|
|
144
144
|
end
|
145
145
|
run_cmd(%w(hostgroup create --name hg1 --puppet-proxy sp1))
|
146
146
|
end
|
147
|
+
|
148
|
+
it 'allows config group ids' do
|
149
|
+
api_expects(:hostgroups, :create) do |p|
|
150
|
+
p['hostgroup']['puppet_attributes']['config_group_ids'] == %w[1 2] &&
|
151
|
+
p['hostgroup']['name'] == 'hg1'
|
152
|
+
end
|
153
|
+
run_cmd(%w[hostgroup create --name hg1 --config-group-ids 1,2])
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'allows config group names' do
|
157
|
+
api_expects(:config_groups, :index) do |p|
|
158
|
+
p[:search] = 'name = "cg1" or name = "cg2"'
|
159
|
+
end.returns(index_response([
|
160
|
+
{'id' => 1, 'name' => 'cg1'},
|
161
|
+
{'id' => 2, 'name' => 'cg2'}
|
162
|
+
]))
|
163
|
+
# FIXME: Called twice because of config_group_ids being mentioned twice in the docs
|
164
|
+
api_expects(:config_groups, :index) do |p|
|
165
|
+
p[:search] = 'name = "cg1" or name = "cg2"'
|
166
|
+
end.returns(index_response([
|
167
|
+
{'id' => 1, 'name' => 'cg1'},
|
168
|
+
{'id' => 2, 'name' => 'cg2'}
|
169
|
+
]))
|
170
|
+
api_expects(:hostgroups, :create) do |p|
|
171
|
+
p['hostgroup']['puppet_attributes']['config_group_ids'] == [1, 2] &&
|
172
|
+
p['hostgroup']['name'] == 'hg1'
|
173
|
+
end
|
174
|
+
run_cmd(%w[hostgroup create --name hg1 --config-groups cg1,cg2])
|
175
|
+
end
|
147
176
|
end
|
148
177
|
end
|
149
178
|
end
|
@@ -5,7 +5,7 @@ module HammerCLIForemanPuppet
|
|
5
5
|
describe UpdateCommand do
|
6
6
|
it 'allows environment id' do
|
7
7
|
api_expects(:hostgroups, :update) do |p|
|
8
|
-
p['hostgroup']['environment_id'] == 1 &&
|
8
|
+
p['hostgroup']['puppet_attributes']['environment_id'] == 1 &&
|
9
9
|
p['id'] == '1'
|
10
10
|
end
|
11
11
|
run_cmd(%w(hostgroup update --id 1 --puppet-environment-id 1))
|
@@ -20,7 +20,7 @@ module HammerCLIForemanPuppet
|
|
20
20
|
p[:search] = "name = \"env1\""
|
21
21
|
end.returns(index_response([{'id' => 1}]))
|
22
22
|
api_expects(:hostgroups, :update) do |p|
|
23
|
-
p['hostgroup']['environment_id'] == 1 &&
|
23
|
+
p['hostgroup']['puppet_attributes']['environment_id'] == 1 &&
|
24
24
|
p['id'] == '1'
|
25
25
|
end
|
26
26
|
run_cmd(%w(hostgroup update --id 1 --puppet-environment env1))
|
@@ -47,7 +47,7 @@ module HammerCLIForemanPuppet
|
|
47
47
|
|
48
48
|
it 'allows puppet class ids' do
|
49
49
|
api_expects(:hostgroups, :update) do |p|
|
50
|
-
p['hostgroup']['puppetclass_ids'] == ['1','2'] &&
|
50
|
+
p['hostgroup']['puppet_attributes']['puppetclass_ids'] == ['1','2'] &&
|
51
51
|
p['id'] == '1'
|
52
52
|
end
|
53
53
|
run_cmd(%w(hostgroup update --id 1 --puppet-class-ids 1,2))
|
@@ -68,7 +68,7 @@ module HammerCLIForemanPuppet
|
|
68
68
|
{'id' => 2, 'name' => 'pc2'}
|
69
69
|
]))
|
70
70
|
api_expects(:hostgroups, :update) do |p|
|
71
|
-
p['hostgroup']['puppetclass_ids'] == [1,2] &&
|
71
|
+
p['hostgroup']['puppet_attributes']['puppetclass_ids'] == [1,2] &&
|
72
72
|
p['id'] == '1'
|
73
73
|
end
|
74
74
|
run_cmd(%w(hostgroup update --id 1 --puppet-classes pc1,pc2))
|
@@ -92,6 +92,35 @@ module HammerCLIForemanPuppet
|
|
92
92
|
end
|
93
93
|
run_cmd(%w(hostgroup update --id 1 --puppet-proxy sp1))
|
94
94
|
end
|
95
|
+
|
96
|
+
it 'allows config group ids' do
|
97
|
+
api_expects(:hostgroups, :update) do |p|
|
98
|
+
p['hostgroup']['puppet_attributes']['config_group_ids'] == %w[1 2] &&
|
99
|
+
p['id'] == '1'
|
100
|
+
end
|
101
|
+
run_cmd(%w[hostgroup update --id 1 --config-group-ids 1,2])
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'allows config group names' do
|
105
|
+
api_expects(:config_groups, :index) do |p|
|
106
|
+
p[:search] = 'name = "cg1" or name = "cg2"'
|
107
|
+
end.returns(index_response([
|
108
|
+
{'id' => 1, 'name' => 'cg1'},
|
109
|
+
{'id' => 2, 'name' => 'cg2'}
|
110
|
+
]))
|
111
|
+
# FIXME: Called twice because of config_group_ids being mentioned twice in the docs
|
112
|
+
api_expects(:config_groups, :index) do |p|
|
113
|
+
p[:search] = 'name = "cg1" or name = "cg2"'
|
114
|
+
end.returns(index_response([
|
115
|
+
{'id' => 1, 'name' => 'cg1'},
|
116
|
+
{'id' => 2, 'name' => 'cg2'}
|
117
|
+
]))
|
118
|
+
api_expects(:hostgroups, :update) do |p|
|
119
|
+
p['hostgroup']['puppet_attributes']['config_group_ids'] == [1, 2] &&
|
120
|
+
p['id'] == '1'
|
121
|
+
end
|
122
|
+
run_cmd(%w[hostgroup update --id 1 --config-groups cg1,cg2])
|
123
|
+
end
|
95
124
|
end
|
96
125
|
end
|
97
126
|
end
|
@@ -10,10 +10,10 @@ describe 'template' do
|
|
10
10
|
params = ['create', '--provisioning-template-id=10', '--hostgroup-id=1', '--puppet-environment-id=1']
|
11
11
|
expected_result = success_result("Template combination created.\n")
|
12
12
|
api_expects(:template_combinations, :create, 'Create template combination') do |p|
|
13
|
-
p['provisioning_template_id'] == 10 &&
|
14
|
-
p['hostgroup_id'] == 1 &&
|
13
|
+
p['provisioning_template_id'] == '10' &&
|
14
|
+
p['hostgroup_id'] == '1' &&
|
15
15
|
p['environment_id'] == 1 &&
|
16
|
-
p['template_combination'] == { 'environment_id' => 1, 'hostgroup_id' => 1 }
|
16
|
+
p['template_combination'] == { 'environment_id' => 1, 'hostgroup_id' => '1' }
|
17
17
|
end
|
18
18
|
|
19
19
|
result = run_cmd(@cmd + params)
|
@@ -25,10 +25,10 @@ describe 'template' do
|
|
25
25
|
expected_result = success_result("Template combination updated.\n")
|
26
26
|
api_expects(:template_combinations, :update, 'Update template combination') do |p|
|
27
27
|
p['id'] == '3' &&
|
28
|
-
p['provisioning_template_id'] == 10 &&
|
29
|
-
p['hostgroup_id'] == 1 &&
|
28
|
+
p['provisioning_template_id'] == '10' &&
|
29
|
+
p['hostgroup_id'] == '1' &&
|
30
30
|
p['environment_id'] == 1 &&
|
31
|
-
p['template_combination'] == { 'environment_id' => 1, 'hostgroup_id' => 1 }
|
31
|
+
p['template_combination'] == { 'environment_id' => 1, 'hostgroup_id' => '1' }
|
32
32
|
end
|
33
33
|
|
34
34
|
result = run_cmd(@cmd + params)
|
data/test/test_helper.rb
CHANGED
@@ -17,7 +17,7 @@ require "mocha/minitest"
|
|
17
17
|
require 'hammer_cli'
|
18
18
|
require 'hammer_cli/testing/command_assertions'
|
19
19
|
require 'hammer_cli_foreman/testing/api_expectations'
|
20
|
-
FOREMAN_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '3.
|
20
|
+
FOREMAN_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '3.3')
|
21
21
|
|
22
22
|
include HammerCLI::Testing::CommandAssertions
|
23
23
|
include HammerCLIForeman::Testing::APIExpectations
|
@@ -16,8 +16,6 @@ describe HammerCLIForemanPuppet::ConfigGroup do
|
|
16
16
|
context "parameters" do
|
17
17
|
it_should_accept "no arguments"
|
18
18
|
it_should_accept_search_params
|
19
|
-
it_should_accept 'organization', ['--organization-id=1']
|
20
|
-
it_should_accept 'location', ['--location-id=1']
|
21
19
|
end
|
22
20
|
|
23
21
|
context "output" do
|
@@ -33,8 +31,6 @@ describe HammerCLIForemanPuppet::ConfigGroup do
|
|
33
31
|
context "parameters" do
|
34
32
|
it_should_accept "id", ["--id=1"]
|
35
33
|
it_should_accept "name", ["--name=group_x"]
|
36
|
-
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
37
|
-
it_should_accept 'location', %w[--id=1 --location-id=1]
|
38
34
|
end
|
39
35
|
|
40
36
|
context "output" do
|
@@ -51,8 +47,8 @@ describe HammerCLIForemanPuppet::ConfigGroup do
|
|
51
47
|
let(:cmd) { HammerCLIForemanPuppet::ConfigGroup::CreateCommand.new("", ctx) }
|
52
48
|
|
53
49
|
context "parameters" do
|
54
|
-
it_should_accept 'name, puppetclass ids
|
55
|
-
%w[--name=first_group --puppet-class-ids=1,2
|
50
|
+
it_should_accept 'name, puppetclass ids',
|
51
|
+
%w[--name=first_group --puppet-class-ids=1,2]
|
56
52
|
end
|
57
53
|
end
|
58
54
|
|
@@ -62,8 +58,6 @@ describe HammerCLIForemanPuppet::ConfigGroup do
|
|
62
58
|
context "parameters" do
|
63
59
|
it_should_accept "name", ["--name=group_x"]
|
64
60
|
it_should_accept "id", ["--id=1"]
|
65
|
-
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
66
|
-
it_should_accept 'location', %w[--id=1 --location-id=1]
|
67
61
|
end
|
68
62
|
end
|
69
63
|
|
@@ -74,8 +68,6 @@ describe HammerCLIForemanPuppet::ConfigGroup do
|
|
74
68
|
context "parameters" do
|
75
69
|
it_should_accept "name", ["--name=group_x"]
|
76
70
|
it_should_accept "id", ["--id=1"]
|
77
|
-
it_should_accept 'organization', %w[--id=1 --organization-id=1]
|
78
|
-
it_should_accept 'location', %w[--id=1 --location-id=1]
|
79
71
|
end
|
80
72
|
end
|
81
73
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hammer_cli_foreman_puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amir Fefer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hammer_cli_foreman
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 4.0.0
|
33
|
-
description:
|
33
|
+
description:
|
34
34
|
email:
|
35
35
|
- amirfefer@gmail.com
|
36
36
|
executables: []
|
@@ -42,10 +42,10 @@ files:
|
|
42
42
|
- config/foreman_puppet.yml
|
43
43
|
- lib/hammer_cli_foreman_puppet.rb
|
44
44
|
- lib/hammer_cli_foreman_puppet/associating_commands.rb
|
45
|
-
- lib/hammer_cli_foreman_puppet/associating_commands/associating_commands.rb
|
46
45
|
- lib/hammer_cli_foreman_puppet/class.rb
|
47
46
|
- lib/hammer_cli_foreman_puppet/combination.rb
|
48
47
|
- lib/hammer_cli_foreman_puppet/command_extensions.rb
|
48
|
+
- lib/hammer_cli_foreman_puppet/command_extensions/combination.rb
|
49
49
|
- lib/hammer_cli_foreman_puppet/command_extensions/environment.rb
|
50
50
|
- lib/hammer_cli_foreman_puppet/command_extensions/environments.rb
|
51
51
|
- lib/hammer_cli_foreman_puppet/command_extensions/host.rb
|
@@ -65,12 +65,12 @@ files:
|
|
65
65
|
- lib/hammer_cli_foreman_puppet/option_sources/puppet_environment_params.rb
|
66
66
|
- lib/hammer_cli_foreman_puppet/organization.rb
|
67
67
|
- lib/hammer_cli_foreman_puppet/puppet_references.rb
|
68
|
-
- lib/hammer_cli_foreman_puppet/references.rb
|
69
68
|
- lib/hammer_cli_foreman_puppet/smart_class_parameter.rb
|
70
69
|
- lib/hammer_cli_foreman_puppet/smart_proxy.rb
|
71
70
|
- lib/hammer_cli_foreman_puppet/version.rb
|
72
71
|
- test/data/2.1/foreman_api.json
|
73
72
|
- test/data/3.0/foreman_api.json
|
73
|
+
- test/data/3.3/foreman_api.json
|
74
74
|
- test/data/README.md
|
75
75
|
- test/functional/config_group_test.rb
|
76
76
|
- test/functional/host/create_test.rb
|
@@ -96,7 +96,7 @@ homepage: https://github.com/theforeman/hammer-cli-foreman-puppet
|
|
96
96
|
licenses:
|
97
97
|
- GPL-3.0
|
98
98
|
metadata: {}
|
99
|
-
post_install_message:
|
99
|
+
post_install_message:
|
100
100
|
rdoc_options: []
|
101
101
|
require_paths:
|
102
102
|
- lib
|
@@ -111,32 +111,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
|
-
|
115
|
-
|
116
|
-
signing_key:
|
114
|
+
rubygems_version: 3.1.2
|
115
|
+
signing_key:
|
117
116
|
specification_version: 4
|
118
117
|
summary: Foreman Puppet plugin for Hammer CLI
|
119
118
|
test_files:
|
120
|
-
- test/functional/test_helper.rb
|
121
|
-
- test/functional/smart_class_parameter_test.rb
|
122
|
-
- test/functional/config_group_test.rb
|
123
|
-
- test/functional/proxy_test.rb
|
124
|
-
- test/functional/template_test.rb
|
125
|
-
- test/functional/host/create_test.rb
|
126
|
-
- test/functional/host/update_test.rb
|
127
|
-
- test/functional/hostgroup/create_test.rb
|
128
|
-
- test/functional/hostgroup/update_test.rb
|
129
|
-
- test/test_helper.rb
|
130
|
-
- test/unit/puppet_environment_test.rb
|
131
|
-
- test/unit/test_helper.rb
|
132
|
-
- test/unit/smart_class_parameter_test.rb
|
133
119
|
- test/unit/config_group_test.rb
|
134
|
-
- test/unit/
|
120
|
+
- test/unit/smart_class_parameter_test.rb
|
135
121
|
- test/unit/helpers/resource_disabled.rb
|
136
122
|
- test/unit/helpers/command.rb
|
137
123
|
- test/unit/helpers/fake_searchables.rb
|
138
|
-
- test/unit/
|
124
|
+
- test/unit/test_helper.rb
|
125
|
+
- test/unit/test_output_adapter.rb
|
139
126
|
- test/unit/apipie_resource_mock.rb
|
140
|
-
- test/
|
127
|
+
- test/unit/puppet_environment_test.rb
|
128
|
+
- test/unit/puppet_class_test.rb
|
129
|
+
- test/functional/config_group_test.rb
|
130
|
+
- test/functional/smart_class_parameter_test.rb
|
131
|
+
- test/functional/test_helper.rb
|
132
|
+
- test/functional/template_test.rb
|
133
|
+
- test/functional/hostgroup/create_test.rb
|
134
|
+
- test/functional/hostgroup/update_test.rb
|
135
|
+
- test/functional/host/create_test.rb
|
136
|
+
- test/functional/host/update_test.rb
|
137
|
+
- test/functional/proxy_test.rb
|
138
|
+
- test/test_helper.rb
|
141
139
|
- test/data/2.1/foreman_api.json
|
142
140
|
- test/data/3.0/foreman_api.json
|
141
|
+
- test/data/3.3/foreman_api.json
|
142
|
+
- test/data/README.md
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module HammerCLIForemanPuppet
|
2
|
-
module AssociatingCommands
|
3
|
-
module ExtendCommands
|
4
|
-
def create_subcommand(name = :PuppetEnvironment)
|
5
|
-
commands = constants.select { |c| c.to_s.include? name.to_s }.map { |p| const_get(p)}
|
6
|
-
commands.each do |command|
|
7
|
-
subcommand(command.command_name, command.desc, command, warning: command.warning)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
module PuppetEnvironment
|
13
|
-
extend HammerCLIForeman::AssociatingCommands::CommandExtension
|
14
|
-
|
15
|
-
class AddPuppetEnvironmentCommand < HammerCLIForemanPuppet::AddAssociatedCommand
|
16
|
-
include EnvironmentNameMapping
|
17
|
-
associated_resource :environments
|
18
|
-
desc _('Associate a Puppet environment')
|
19
|
-
command_name "add-environment"
|
20
|
-
|
21
|
-
success_message _("The environment has been associated.")
|
22
|
-
failure_message _("Could not associate the environment")
|
23
|
-
|
24
|
-
extend_with(HammerCLIForemanPuppet::CommandExtensions::PuppetEnvironment.new)
|
25
|
-
end
|
26
|
-
|
27
|
-
class RemovePuppetEnvironmentCommand < HammerCLIForemanPuppet::RemoveAssociatedCommand
|
28
|
-
include EnvironmentNameMapping
|
29
|
-
associated_resource :environments
|
30
|
-
desc _('Disassociate a Puppet environment')
|
31
|
-
command_name "remove-environment"
|
32
|
-
|
33
|
-
success_message _("The environment has been disassociated.")
|
34
|
-
failure_message _("Could not disassociate the environment")
|
35
|
-
|
36
|
-
extend_with(HammerCLIForemanPuppet::CommandExtensions::PuppetEnvironment.new)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module HammerCLIForemanPuppet
|
2
|
-
|
3
|
-
module References
|
4
|
-
|
5
|
-
def self.environments(dsl)
|
6
|
-
dsl.build do
|
7
|
-
collection :environments, _("Environments"), :numbered => false do
|
8
|
-
custom_field Fields::Reference
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.puppetclasses(dsl)
|
14
|
-
dsl.build do
|
15
|
-
collection :puppetclasses, _("Puppetclasses"), :numbered => false do
|
16
|
-
custom_field Fields::Reference
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|