knife-ionoscloud 5.0.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +4 -4
- data/.rubocop.yml +0 -1
- data/docs/docs_generator.rb +1 -1
- data/docs/subcommands/backupunit_create.md +1 -2
- data/docs/subcommands/backupunit_delete.md +1 -2
- data/docs/subcommands/backupunit_list.md +1 -2
- data/docs/subcommands/backupunit_ssourl.md +1 -2
- data/docs/subcommands/composite_server_create.md +1 -2
- data/docs/subcommands/contract_list.md +1 -2
- data/docs/subcommands/datacenter_create.md +3 -3
- data/docs/subcommands/datacenter_delete.md +1 -2
- data/docs/subcommands/datacenter_list.md +1 -2
- data/docs/subcommands/firewall_create.md +1 -2
- data/docs/subcommands/firewall_delete.md +1 -2
- data/docs/subcommands/firewall_list.md +1 -2
- data/docs/subcommands/group_create.md +11 -3
- data/docs/subcommands/group_delete.md +1 -2
- data/docs/subcommands/group_get.md +1 -2
- data/docs/subcommands/group_list.md +1 -2
- data/docs/subcommands/group_user_add.md +1 -2
- data/docs/subcommands/group_user_remove.md +1 -2
- data/docs/subcommands/image_list.md +1 -2
- data/docs/subcommands/ipblock_create.md +1 -2
- data/docs/subcommands/ipblock_delete.md +1 -2
- data/docs/subcommands/ipblock_list.md +1 -2
- data/docs/subcommands/ipfailover_add.md +2 -3
- data/docs/subcommands/ipfailover_remove.md +1 -2
- data/docs/subcommands/k8s_create.md +8 -3
- data/docs/subcommands/k8s_delete.md +1 -2
- data/docs/subcommands/k8s_list.md +1 -2
- data/docs/subcommands/kubeconfig_get.md +1 -2
- data/docs/subcommands/label_add.md +1 -2
- data/docs/subcommands/label_list.md +1 -2
- data/docs/subcommands/label_remove.md +1 -2
- data/docs/subcommands/lan_create.md +5 -3
- data/docs/subcommands/lan_delete.md +1 -2
- data/docs/subcommands/lan_list.md +1 -2
- data/docs/subcommands/loadbalancer_create.md +1 -2
- data/docs/subcommands/loadbalancer_delete.md +1 -2
- data/docs/subcommands/loadbalancer_get.md +1 -2
- data/docs/subcommands/loadbalancer_list.md +1 -2
- data/docs/subcommands/loadbalancer_nic_add.md +1 -2
- data/docs/subcommands/loadbalancer_nic_remove.md +1 -2
- data/docs/subcommands/location_list.md +1 -2
- data/docs/subcommands/nic_create.md +1 -2
- data/docs/subcommands/nic_delete.md +1 -2
- data/docs/subcommands/nic_list.md +1 -2
- data/docs/subcommands/node_delete.md +1 -2
- data/docs/subcommands/node_list.md +1 -2
- data/docs/subcommands/node_replace.md +1 -2
- data/docs/subcommands/nodepool_create.md +1 -2
- data/docs/subcommands/nodepool_delete.md +1 -2
- data/docs/subcommands/nodepool_list.md +1 -2
- data/docs/subcommands/pcc_create.md +3 -7
- data/docs/subcommands/pcc_delete.md +1 -2
- data/docs/subcommands/pcc_list.md +1 -2
- data/docs/subcommands/request_list.md +9 -4
- data/docs/subcommands/request_status.md +1 -2
- data/docs/subcommands/request_wait.md +1 -2
- data/docs/subcommands/resource_list.md +3 -2
- data/docs/subcommands/s3key_create.md +1 -2
- data/docs/subcommands/s3key_delete.md +1 -2
- data/docs/subcommands/s3key_list.md +1 -2
- data/docs/subcommands/server_create.md +1 -2
- data/docs/subcommands/server_delete.md +1 -2
- data/docs/subcommands/server_list.md +1 -2
- data/docs/subcommands/server_reboot.md +1 -2
- data/docs/subcommands/server_start.md +1 -2
- data/docs/subcommands/server_stop.md +1 -2
- data/docs/subcommands/share_create.md +1 -2
- data/docs/subcommands/share_delete.md +1 -2
- data/docs/subcommands/share_list.md +1 -2
- data/docs/subcommands/snapshot_create.md +14 -3
- data/docs/subcommands/snapshot_delete.md +1 -2
- data/docs/subcommands/snapshot_list.md +1 -2
- data/docs/subcommands/snapshot_restore.md +1 -2
- data/docs/subcommands/user_create.md +3 -4
- data/docs/subcommands/user_delete.md +1 -2
- data/docs/subcommands/user_list.md +1 -2
- data/docs/subcommands/user_ssourl.md +1 -2
- data/docs/subcommands/volume_attach.md +1 -2
- data/docs/subcommands/volume_create.md +1 -2
- data/docs/subcommands/volume_delete.md +1 -2
- data/docs/subcommands/volume_detach.md +1 -2
- data/docs/subcommands/volume_list.md +1 -2
- data/docs/summary.md +0 -1
- data/docs/templates/subcommand_doc.mustache +9 -7
- data/lib/chef/knife/ionoscloud_backupunit_ssourl.rb +1 -1
- data/lib/chef/knife/ionoscloud_datacenter_create.rb +1 -1
- data/lib/chef/knife/ionoscloud_group_create.rb +18 -0
- data/lib/chef/knife/ionoscloud_image_list.rb +3 -3
- data/lib/chef/knife/ionoscloud_ipblock_create.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipblock_list.rb +3 -1
- data/lib/chef/knife/ionoscloud_k8s_create.rb +18 -0
- data/lib/chef/knife/ionoscloud_lan_create.rb +6 -0
- data/lib/chef/knife/ionoscloud_lan_list.rb +3 -1
- data/lib/chef/knife/ionoscloud_nic_create.rb +1 -2
- data/lib/chef/knife/ionoscloud_node_list.rb +3 -1
- data/lib/chef/knife/ionoscloud_pcc_create.rb +34 -7
- data/lib/chef/knife/ionoscloud_request_list.rb +24 -11
- data/lib/chef/knife/ionoscloud_server_create.rb +1 -1
- data/lib/chef/knife/ionoscloud_server_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_server_list.rb +2 -2
- data/lib/chef/knife/ionoscloud_snapshot_create.rb +24 -0
- data/lib/chef/knife/ionoscloud_user_create.rb +4 -4
- data/lib/chef/knife/ionoscloud_user_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_list.rb +1 -1
- data/lib/knife-ionoscloud/version.rb +1 -1
- data/spec/chef/knife/ionoscloud_group_create_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_image_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_ipblock_list_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_lan_create_spec.rb +2 -0
- data/spec/chef/knife/ionoscloud_lan_list_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_node_list_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +34 -3
- data/spec/chef/knife/ionoscloud_request_list_spec.rb +120 -1
- data/spec/chef/knife/ionoscloud_server_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_snapshot_create_spec.rb +10 -0
- data/spec/spec_helper.rb +12 -7
- metadata +2 -2
@@ -24,6 +24,9 @@ describe Chef::Knife::IonoscloudGroupCreate do
|
|
24
24
|
access_activity_log: group.properties.access_activity_log,
|
25
25
|
s3_privilege: group.properties.s3_privilege,
|
26
26
|
create_backup_unit: group.properties.create_backup_unit,
|
27
|
+
create_k8s_cluster: group.properties.create_k8s_cluster,
|
28
|
+
create_pcc: group.properties.create_pcc,
|
29
|
+
create_internet_access: group.properties.create_internet_access,
|
27
30
|
}
|
28
31
|
|
29
32
|
subject_config.each { |key, value| subject.config[key] = value }
|
@@ -36,6 +39,9 @@ describe Chef::Knife::IonoscloudGroupCreate do
|
|
36
39
|
expect(subject).to receive(:puts).with("Access Activity Log: #{group.properties.access_activity_log.to_s}")
|
37
40
|
expect(subject).to receive(:puts).with("S3 Privilege: #{group.properties.s3_privilege.to_s}")
|
38
41
|
expect(subject).to receive(:puts).with("Create Backup Unit: #{group.properties.create_backup_unit.to_s}")
|
42
|
+
expect(subject).to receive(:puts).with("Create K8s Clusters: #{group.properties.create_k8s_cluster.to_s}")
|
43
|
+
expect(subject).to receive(:puts).with("Create PCC: #{group.properties.create_pcc.to_s}")
|
44
|
+
expect(subject).to receive(:puts).with("Create Internet Acess: #{group.properties.create_internet_access.to_s}")
|
39
45
|
|
40
46
|
mock_wait_for(subject)
|
41
47
|
mock_call_api(
|
@@ -24,16 +24,16 @@ describe Chef::Knife::IonoscloudImageList do
|
|
24
24
|
image_list = [
|
25
25
|
subject.ui.color('ID', :bold),
|
26
26
|
subject.ui.color('Name', :bold),
|
27
|
-
subject.ui.color('Description', :bold),
|
28
27
|
subject.ui.color('Location', :bold),
|
29
28
|
subject.ui.color('Size', :bold),
|
30
29
|
subject.ui.color('Public', :bold),
|
30
|
+
subject.ui.color('Aliases', :bold),
|
31
31
|
images.items.first.id,
|
32
32
|
images.items.first.properties.name,
|
33
|
-
images.items.first.properties.description,
|
34
33
|
images.items.first.properties.location,
|
35
34
|
images.items.first.properties.size.to_s,
|
36
35
|
images.items.first.properties.public.to_s,
|
36
|
+
images.items.first.properties.image_aliases,
|
37
37
|
]
|
38
38
|
|
39
39
|
expect(subject.ui).to receive(:list).with(image_list, :uneven_columns_across, 6)
|
@@ -26,6 +26,7 @@ describe Chef::Knife::IonoscloudIpblockList do
|
|
26
26
|
subject.ui.color('Name', :bold),
|
27
27
|
subject.ui.color('Location', :bold),
|
28
28
|
subject.ui.color('IP Addresses', :bold),
|
29
|
+
subject.ui.color('IP Consumers count', :bold),
|
29
30
|
]
|
30
31
|
|
31
32
|
ipblocks.items.each do |ipblock|
|
@@ -33,9 +34,10 @@ describe Chef::Knife::IonoscloudIpblockList do
|
|
33
34
|
ipblock_list << ipblock.properties.name
|
34
35
|
ipblock_list << ipblock.properties.location
|
35
36
|
ipblock_list << ipblock.properties.ips.join(', ')
|
37
|
+
ipblock_list << ipblock.properties.ip_consumers.nil? ? 0 : ipblock.properties.ip_consumers.length
|
36
38
|
end
|
37
39
|
|
38
|
-
expect(subject.ui).to receive(:list).with(ipblock_list, :uneven_columns_across,
|
40
|
+
expect(subject.ui).to receive(:list).with(ipblock_list, :uneven_columns_across, 5)
|
39
41
|
|
40
42
|
mock_call_api(
|
41
43
|
subject,
|
@@ -20,6 +20,7 @@ describe Chef::Knife::IonoscloudLanCreate do
|
|
20
20
|
datacenter_id: 'datacenter_id',
|
21
21
|
name: lan.properties.name,
|
22
22
|
public: lan.properties.public,
|
23
|
+
pcc: lan.properties.pcc,
|
23
24
|
}
|
24
25
|
|
25
26
|
subject_config.each { |key, value| subject.config[key] = value }
|
@@ -27,6 +28,7 @@ describe Chef::Knife::IonoscloudLanCreate do
|
|
27
28
|
expect(subject).to receive(:puts).with("ID: #{lan.id}")
|
28
29
|
expect(subject).to receive(:puts).with("Name: #{lan.properties.name}")
|
29
30
|
expect(subject).to receive(:puts).with("Public: #{lan.properties.public.to_s}")
|
31
|
+
expect(subject).to receive(:puts).with("PCC: #{lan.properties.pcc}")
|
30
32
|
|
31
33
|
expected_body = lan.properties.to_hash
|
32
34
|
expected_body.delete(:ipFailover)
|
@@ -26,15 +26,17 @@ describe Chef::Knife::IonoscloudLanList do
|
|
26
26
|
subject.ui.color('ID', :bold),
|
27
27
|
subject.ui.color('Name', :bold),
|
28
28
|
subject.ui.color('Public', :bold),
|
29
|
+
subject.ui.color('PCC', :bold),
|
29
30
|
]
|
30
31
|
|
31
32
|
lans.items.each do |lan|
|
32
33
|
lan_list << lan.id
|
33
34
|
lan_list << lan.properties.name
|
34
35
|
lan_list << lan.properties.public.to_s
|
36
|
+
lan_list << lan.properties.pcc
|
35
37
|
end
|
36
38
|
|
37
|
-
expect(subject.ui).to receive(:list).with(lan_list, :uneven_columns_across,
|
39
|
+
expect(subject.ui).to receive(:list).with(lan_list, :uneven_columns_across, 4)
|
38
40
|
|
39
41
|
mock_call_api(
|
40
42
|
subject,
|
@@ -27,16 +27,18 @@ describe Chef::Knife::IonoscloudNodeList do
|
|
27
27
|
subject.ui.color('ID', :bold),
|
28
28
|
subject.ui.color('Name', :bold),
|
29
29
|
subject.ui.color('Public IP', :bold),
|
30
|
+
subject.ui.color('Private IP', :bold),
|
30
31
|
subject.ui.color('K8s Version', :bold),
|
31
32
|
subject.ui.color('State', :bold),
|
32
33
|
k8s_nodes.items.first.id,
|
33
34
|
k8s_nodes.items.first.properties.name,
|
34
35
|
k8s_nodes.items.first.properties.public_ip,
|
36
|
+
k8s_nodes.items.first.properties.private_ip,
|
35
37
|
k8s_nodes.items.first.properties.k8s_version,
|
36
38
|
k8s_nodes.items.first.metadata.state,
|
37
39
|
]
|
38
40
|
|
39
|
-
expect(subject.ui).to receive(:list).with(node_list, :uneven_columns_across,
|
41
|
+
expect(subject.ui).to receive(:list).with(node_list, :uneven_columns_across, 6)
|
40
42
|
|
41
43
|
mock_call_api(
|
42
44
|
subject,
|
@@ -14,13 +14,14 @@ describe Chef::Knife::IonoscloudPccCreate do
|
|
14
14
|
describe '#run' do
|
15
15
|
it 'should call PrivateCrossConnectApi.pccs_post with the expected arguments and output based on what it receives' do
|
16
16
|
pcc = pcc_mock
|
17
|
+
datacenter_ids = pcc.properties.connectable_datacenters.map { |datacenter| datacenter.id }
|
18
|
+
lan_ids = pcc.properties.peers.map { |peer| peer.id }
|
17
19
|
subject_config = {
|
18
20
|
ionoscloud_username: 'email',
|
19
21
|
ionoscloud_password: 'password',
|
20
22
|
name: pcc.properties.name,
|
21
23
|
description: pcc.properties.description,
|
22
|
-
peers:
|
23
|
-
datacenters: pcc.properties.connectable_datacenters.join(','),
|
24
|
+
peers: datacenter_ids.zip(lan_ids).flatten.compact.join(','),
|
24
25
|
}
|
25
26
|
|
26
27
|
subject_config.each { |key, value| subject.config[key] = value }
|
@@ -31,7 +32,7 @@ describe Chef::Knife::IonoscloudPccCreate do
|
|
31
32
|
expect(subject).to receive(:puts).with("Peers: #{pcc.properties.peers.to_s}")
|
32
33
|
expect(subject).to receive(:puts).with("Datacenters: #{pcc.properties.connectable_datacenters.to_s}")
|
33
34
|
|
34
|
-
mock_wait_for(subject)
|
35
|
+
3.times { mock_wait_for(subject) }
|
35
36
|
mock_call_api(
|
36
37
|
subject,
|
37
38
|
[
|
@@ -43,6 +44,36 @@ describe Chef::Knife::IonoscloudPccCreate do
|
|
43
44
|
body: { properties: { name: pcc.properties.name, description: pcc.properties.description } },
|
44
45
|
result: pcc,
|
45
46
|
},
|
47
|
+
{
|
48
|
+
method: 'GET',
|
49
|
+
path: "/pccs/#{pcc.id}",
|
50
|
+
operation: :'PrivateCrossConnectApi.pccs_find_by_id',
|
51
|
+
return_type: 'PrivateCrossConnect',
|
52
|
+
result: pcc,
|
53
|
+
},
|
54
|
+
{
|
55
|
+
method: 'PATCH',
|
56
|
+
path: "/datacenters/#{pcc.properties.connectable_datacenters[0].id}/lans/#{pcc.properties.peers[0].id}",
|
57
|
+
operation: :'LanApi.datacenters_lans_patch',
|
58
|
+
return_type: 'Lan',
|
59
|
+
body: { pcc: pcc.id },
|
60
|
+
result: pcc.properties.peers[0],
|
61
|
+
},
|
62
|
+
{
|
63
|
+
method: 'PATCH',
|
64
|
+
path: "/datacenters/#{pcc.properties.connectable_datacenters[1].id}/lans/#{pcc.properties.peers[1].id}",
|
65
|
+
operation: :'LanApi.datacenters_lans_patch',
|
66
|
+
return_type: 'Lan',
|
67
|
+
body: { pcc: pcc.id },
|
68
|
+
result: pcc.properties.peers[1],
|
69
|
+
},
|
70
|
+
{
|
71
|
+
method: 'GET',
|
72
|
+
path: "/pccs/#{pcc.id}",
|
73
|
+
operation: :'PrivateCrossConnectApi.pccs_find_by_id',
|
74
|
+
return_type: 'PrivateCrossConnect',
|
75
|
+
result: pcc,
|
76
|
+
},
|
46
77
|
],
|
47
78
|
)
|
48
79
|
|
@@ -84,7 +84,7 @@ describe Chef::Knife::IonoscloudRequestList do
|
|
84
84
|
expect { subject.run }.not_to raise_error(Exception)
|
85
85
|
end
|
86
86
|
|
87
|
-
it 'should call RequestApi.resources_get with default limit if it is not an
|
87
|
+
it 'should call RequestApi.resources_get with default limit if it is not an Integer' do
|
88
88
|
subject_config = {
|
89
89
|
ionoscloud_username: 'email',
|
90
90
|
ionoscloud_password: 'password',
|
@@ -144,6 +144,125 @@ describe Chef::Knife::IonoscloudRequestList do
|
|
144
144
|
expect { subject.run }.not_to raise_error(Exception)
|
145
145
|
end
|
146
146
|
|
147
|
+
it 'should call RequestApi.resources_get with the expected status when set' do
|
148
|
+
subject_config = {
|
149
|
+
ionoscloud_username: 'email',
|
150
|
+
ionoscloud_password: 'password',
|
151
|
+
status: 'FAILED',
|
152
|
+
limit: 12,
|
153
|
+
}
|
154
|
+
|
155
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
156
|
+
|
157
|
+
expect(subject.ui).to receive(:list).with(@request_list, :uneven_columns_across, 4)
|
158
|
+
|
159
|
+
mock_call_api(
|
160
|
+
subject,
|
161
|
+
[
|
162
|
+
{
|
163
|
+
method: 'GET',
|
164
|
+
path: '/requests',
|
165
|
+
operation: :'RequestApi.requests_get',
|
166
|
+
options: { depth: 2, limit: subject_config[:limit], offset: 0, filter_request_status: subject_config[:status] },
|
167
|
+
return_type: 'Requests',
|
168
|
+
result: @requests,
|
169
|
+
},
|
170
|
+
],
|
171
|
+
)
|
172
|
+
|
173
|
+
expect { subject.run }.not_to raise_error(Exception)
|
174
|
+
end
|
175
|
+
|
176
|
+
it 'should call RequestApi.resources_get with no status when set wrong' do
|
177
|
+
subject_config = {
|
178
|
+
ionoscloud_username: 'email',
|
179
|
+
ionoscloud_password: 'password',
|
180
|
+
status: 'invalid',
|
181
|
+
limit: 12,
|
182
|
+
}
|
183
|
+
|
184
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
185
|
+
|
186
|
+
expect(subject.ui).to receive(:list).with(@request_list, :uneven_columns_across, 4)
|
187
|
+
expect(subject.ui).to receive(:warn).with('status should be one of [QUEUED, RUNNING, DONE, FAILED]')
|
188
|
+
|
189
|
+
mock_call_api(
|
190
|
+
subject,
|
191
|
+
[
|
192
|
+
{
|
193
|
+
method: 'GET',
|
194
|
+
path: '/requests',
|
195
|
+
operation: :'RequestApi.requests_get',
|
196
|
+
options: { depth: 2, limit: subject_config[:limit], offset: 0 },
|
197
|
+
return_type: 'Requests',
|
198
|
+
result: @requests,
|
199
|
+
},
|
200
|
+
],
|
201
|
+
)
|
202
|
+
|
203
|
+
expect { subject.run }.not_to raise_error(Exception)
|
204
|
+
end
|
205
|
+
|
206
|
+
|
207
|
+
it 'should call RequestApi.resources_get with the expected method when set' do
|
208
|
+
subject_config = {
|
209
|
+
ionoscloud_username: 'email',
|
210
|
+
ionoscloud_password: 'password',
|
211
|
+
method: 'DELETE',
|
212
|
+
limit: 12,
|
213
|
+
}
|
214
|
+
|
215
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
216
|
+
|
217
|
+
expect(subject.ui).to receive(:list).with(@request_list, :uneven_columns_across, 4)
|
218
|
+
|
219
|
+
mock_call_api(
|
220
|
+
subject,
|
221
|
+
[
|
222
|
+
{
|
223
|
+
method: 'GET',
|
224
|
+
path: '/requests',
|
225
|
+
operation: :'RequestApi.requests_get',
|
226
|
+
options: { depth: 2, limit: subject_config[:limit], offset: 0, filter_method: subject_config[:method] },
|
227
|
+
return_type: 'Requests',
|
228
|
+
result: @requests,
|
229
|
+
},
|
230
|
+
],
|
231
|
+
)
|
232
|
+
|
233
|
+
expect { subject.run }.not_to raise_error(Exception)
|
234
|
+
end
|
235
|
+
|
236
|
+
it 'should call RequestApi.resources_get with no method when set wrong' do
|
237
|
+
subject_config = {
|
238
|
+
ionoscloud_username: 'email',
|
239
|
+
ionoscloud_password: 'password',
|
240
|
+
method: 'invalid',
|
241
|
+
limit: 12,
|
242
|
+
}
|
243
|
+
|
244
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
245
|
+
|
246
|
+
expect(subject.ui).to receive(:list).with(@request_list, :uneven_columns_across, 4)
|
247
|
+
expect(subject.ui).to receive(:warn).with('method should be one of [POST, PUT, PATCH, DELETE]')
|
248
|
+
|
249
|
+
mock_call_api(
|
250
|
+
subject,
|
251
|
+
[
|
252
|
+
{
|
253
|
+
method: 'GET',
|
254
|
+
path: '/requests',
|
255
|
+
operation: :'RequestApi.requests_get',
|
256
|
+
options: { depth: 2, limit: subject_config[:limit], offset: 0 },
|
257
|
+
return_type: 'Requests',
|
258
|
+
result: @requests,
|
259
|
+
},
|
260
|
+
],
|
261
|
+
)
|
262
|
+
|
263
|
+
expect { subject.run }.not_to raise_error(Exception)
|
264
|
+
end
|
265
|
+
|
147
266
|
it 'should not make any call if any required option is missing' do
|
148
267
|
required_options = subject.instance_variable_get(:@required_options)
|
149
268
|
|
@@ -42,8 +42,8 @@ describe Chef::Knife::IonoscloudServerList do
|
|
42
42
|
server_list << server.properties.ram.to_s
|
43
43
|
server_list << server.properties.availability_zone
|
44
44
|
server_list << server.properties.vm_state
|
45
|
-
server_list << server.properties.boot_volume
|
46
|
-
server_list << server.properties.boot_cdrom
|
45
|
+
server_list << (server.properties.boot_volume.nil? ? '' : server.properties.boot_volume.id)
|
46
|
+
server_list << (server.properties.boot_cdrom.nil? ? '' : server.properties.boot_cdrom.id)
|
47
47
|
end
|
48
48
|
|
49
49
|
expect(subject.ui).to receive(:list).with(server_list, :uneven_columns_across, 9)
|
@@ -19,6 +19,10 @@ describe Chef::Knife::IonoscloudSnapshotCreate do
|
|
19
19
|
ionoscloud_password: 'password',
|
20
20
|
datacenter_id: 'datacenter_id',
|
21
21
|
volume_id: 'volume_id',
|
22
|
+
name: snapshot_mock.properties.name,
|
23
|
+
description: snapshot_mock.properties.description,
|
24
|
+
licence_type: snapshot_mock.properties.licence_type,
|
25
|
+
sec_auth_protection: snapshot_mock.properties.sec_auth_protection,
|
22
26
|
}
|
23
27
|
|
24
28
|
subject_config.each { |key, value| subject.config[key] = value }
|
@@ -39,6 +43,12 @@ describe Chef::Knife::IonoscloudSnapshotCreate do
|
|
39
43
|
operation: :'VolumeApi.datacenters_volumes_create_snapshot_post',
|
40
44
|
return_type: 'Snapshot',
|
41
45
|
result: snapshot,
|
46
|
+
form_params: {
|
47
|
+
'name' => snapshot_mock.properties.name,
|
48
|
+
'description' => snapshot_mock.properties.description,
|
49
|
+
'licenceType' => snapshot_mock.properties.licence_type,
|
50
|
+
'secAuthProtection' => snapshot_mock.properties.sec_auth_protection,
|
51
|
+
},
|
42
52
|
},
|
43
53
|
{
|
44
54
|
method: 'GET',
|
data/spec/spec_helper.rb
CHANGED
@@ -34,7 +34,7 @@ def contract_mock(opts = {})
|
|
34
34
|
ram_provisioned: opts[:ram_provisioned] || 4096,
|
35
35
|
reservable_ips: opts[:reservable_ips] || 10,
|
36
36
|
reserved_ips_in_use: opts[:reserved_ips_in_use] || 12,
|
37
|
-
reserved_ips_on_contract: opts[:reserved_ips_on_contract] || 20,
|
37
|
+
reserved_ips_on_contract: opts[:reserved_ips_on_contract] || 20,
|
38
38
|
ssd_limit_per_contract: opts[:ssd_limit_per_contract] || 600,
|
39
39
|
ssd_limit_per_volume: opts[:ssd_limit_per_volume] || 300,
|
40
40
|
ssd_volume_provisioned: opts[:ssd_volume_provisioned] || 50,
|
@@ -198,6 +198,7 @@ def lan_mock(opts = {})
|
|
198
198
|
properties: Ionoscloud::LanProperties.new(
|
199
199
|
name: opts[:name] || 'lan_name',
|
200
200
|
public: opts[:public] || true,
|
201
|
+
pcc: opts[:pcc] || SecureRandom.uuid,
|
201
202
|
ip_failover: opts[:ip_failover] || [],
|
202
203
|
),
|
203
204
|
)
|
@@ -289,7 +290,7 @@ def image_mock(opts = {})
|
|
289
290
|
id: opts[:id] || SecureRandom.uuid,
|
290
291
|
properties: Ionoscloud::ImageProperties.new(
|
291
292
|
name: opts[:name] || 'image_name',
|
292
|
-
|
293
|
+
image_aliases: opts[:image_aliases] || ['alias1', 'alias2'],
|
293
294
|
location: opts[:location] || 'image_location',
|
294
295
|
size: opts[:size] || 10,
|
295
296
|
public: opts[:public] || true,
|
@@ -341,14 +342,14 @@ end
|
|
341
342
|
|
342
343
|
def maintenance_window_mock(opts = {})
|
343
344
|
Ionoscloud::KubernetesMaintenanceWindow.new(
|
344
|
-
day_of_the_week: opts[:day_of_the_week] || 'Sunday',
|
345
|
+
day_of_the_week: opts[:day_of_the_week] || 'Sunday',
|
345
346
|
time: opts[:time] || '23:03:19Z',
|
346
347
|
)
|
347
348
|
end
|
348
349
|
|
349
350
|
def auto_scaling_mock(opts = {})
|
350
351
|
Ionoscloud::KubernetesAutoScaling.new(
|
351
|
-
min_node_count: opts[:min_node_count] || 2,
|
352
|
+
min_node_count: opts[:min_node_count] || 2,
|
352
353
|
max_node_count: opts[:max_node_count] || 3,
|
353
354
|
)
|
354
355
|
end
|
@@ -559,6 +560,7 @@ def snapshot_mock(opts = {})
|
|
559
560
|
name: opts[:name] || 'snapshot_name',
|
560
561
|
description: opts[:description] || 'snapshot_description',
|
561
562
|
licence_type: opts[:licence_type] || 'LINUX',
|
563
|
+
sec_auth_protection: opts[:sec_auth_protection] || true,
|
562
564
|
location: opts[:location] || 'de/fra',
|
563
565
|
size: opts[:size] || 10.0,
|
564
566
|
),
|
@@ -584,6 +586,9 @@ def group_mock(opts = {})
|
|
584
586
|
access_activity_log: opts[:access_activity_log] || true,
|
585
587
|
s3_privilege: opts[:s3_privilege] || true,
|
586
588
|
create_backup_unit: opts[:create_backup_unit] || true,
|
589
|
+
create_k8s_cluster: opts[:create_k8s_cluster] || true,
|
590
|
+
create_pcc: opts[:create_pcc] || true,
|
591
|
+
create_internet_access: opts[:create_internet_access] || true,
|
587
592
|
),
|
588
593
|
entities: Ionoscloud::GroupEntities.new(
|
589
594
|
users: group_members_mock,
|
@@ -610,7 +615,7 @@ end
|
|
610
615
|
def user_mock(opts = {})
|
611
616
|
Ionoscloud::User.new(
|
612
617
|
id: opts[:id] || SecureRandom.uuid,
|
613
|
-
properties: Ionoscloud::
|
618
|
+
properties: Ionoscloud::UserPropertiesPost.new(
|
614
619
|
firstname: opts[:firstname] || 'Firstname',
|
615
620
|
lastname: opts[:lastname] || 'Lastname',
|
616
621
|
email: opts[:email] || 'a@a.a',
|
@@ -668,8 +673,8 @@ def requests_mock(opts = {})
|
|
668
673
|
end
|
669
674
|
|
670
675
|
def arrays_without_one_element(arr)
|
671
|
-
result = [{ array: arr[1..], removed: [arr[0]]}]
|
672
|
-
(1..arr.length - 1).each { |i| result.append({ array: arr[0..i-1] + arr[i+1..], removed: [arr[i]]}) }
|
676
|
+
result = [{ array: arr[1..], removed: [arr[0]] }]
|
677
|
+
(1..arr.length - 1).each { |i| result.append({ array: arr[0..i - 1] + arr[i + 1..], removed: [arr[i]] }) }
|
673
678
|
result
|
674
679
|
end
|
675
680
|
|