knife-ionoscloud 6.1.0 → 6.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +17 -0
- data/.rubocop.yml +72 -0
- data/docs/docs_generator.rb +21 -24
- data/docs/subcommands/dbaas-postgres/dbaas_postgres_backup_get.md +1 -1
- data/docs/subcommands/dbaas-postgres/dbaas_postgres_backup_list.md +1 -2
- data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_create.md +6 -3
- data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_delete.md +1 -1
- data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_get.md +1 -1
- data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_list.md +1 -1
- data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_restore.md +1 -1
- data/docs/subcommands/dbaas-postgres/dbaas_postgres_cluster_update.md +2 -2
- data/docs/subcommands/dbaas-postgres/dbaas_postgres_logs_get.md +7 -4
- data/docs/subcommands/dbaas-postgres/dbaas_postgres_version_list.md +1 -2
- data/docs/subcommands/kubernetes/k8s_create.md +4 -1
- data/docs/subcommands/kubernetes/nodepool_create.md +4 -1
- data/docs/summary.md +124 -124
- data/knife-ionoscloud.gemspec +2 -2
- data/lib/chef/knife/ionoscloud_backupunit_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_update.rb +1 -1
- data/lib/chef/knife/ionoscloud_base.rb +3 -0
- data/lib/chef/knife/ionoscloud_composite_server_create.rb +2 -2
- data/lib/chef/knife/ionoscloud_contract_list.rb +1 -2
- data/lib/chef/knife/ionoscloud_cube_server_create.rb +3 -3
- data/lib/chef/knife/ionoscloud_datacenter_create.rb +2 -2
- data/lib/chef/knife/ionoscloud_datacenter_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_datacenter_update.rb +2 -2
- data/lib/chef/knife/ionoscloud_dbaas_postgres_backup_get.rb +2 -2
- data/lib/chef/knife/ionoscloud_dbaas_postgres_backup_list.rb +2 -2
- data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_create.rb +11 -7
- data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_delete.rb +2 -2
- data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_get.rb +3 -3
- data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_list.rb +3 -1
- data/lib/chef/knife/ionoscloud_dbaas_postgres_cluster_update.rb +2 -4
- data/lib/chef/knife/ionoscloud_dbaas_postgres_logs_get.rb +37 -6
- data/lib/chef/knife/ionoscloud_dbaas_postgres_version_list.rb +3 -2
- data/lib/chef/knife/ionoscloud_firewall_create.rb +1 -1
- data/lib/chef/knife/ionoscloud_firewall_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_firewall_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_flowlog_delete.rb +1 -3
- data/lib/chef/knife/ionoscloud_flowlog_list.rb +3 -5
- data/lib/chef/knife/ionoscloud_group_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_group_update.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipblock_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_k8s_create.rb +6 -0
- data/lib/chef/knife/ionoscloud_k8s_delete.rb +2 -2
- data/lib/chef/knife/ionoscloud_k8s_list.rb +3 -1
- data/lib/chef/knife/ionoscloud_k8s_update.rb +2 -6
- data/lib/chef/knife/ionoscloud_label_list.rb +1 -3
- data/lib/chef/knife/ionoscloud_lan_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_natgateway_create.rb +1 -1
- data/lib/chef/knife/ionoscloud_natgateway_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_natgateway_rule_add.rb +1 -1
- data/lib/chef/knife/ionoscloud_natgateway_rule_update.rb +1 -1
- data/lib/chef/knife/ionoscloud_natgateway_update.rb +1 -2
- data/lib/chef/knife/ionoscloud_networkloadbalancer_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_add.rb +1 -2
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove.rb +1 -2
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_update.rb +1 -2
- data/lib/chef/knife/ionoscloud_nic_create.rb +3 -3
- data/lib/chef/knife/ionoscloud_nic_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_node_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_node_replace.rb +3 -3
- data/lib/chef/knife/ionoscloud_nodepool_create.rb +7 -2
- data/lib/chef/knife/ionoscloud_nodepool_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_nodepool_list.rb +3 -1
- data/lib/chef/knife/ionoscloud_pcc_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_pcc_update.rb +1 -1
- data/lib/chef/knife/ionoscloud_request_list.rb +6 -18
- data/lib/chef/knife/ionoscloud_resource_list.rb +10 -12
- data/lib/chef/knife/ionoscloud_s3key_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_server_create.rb +3 -3
- data/lib/chef/knife/ionoscloud_server_delete.rb +3 -3
- data/lib/chef/knife/ionoscloud_server_upgrade.rb +1 -1
- data/lib/chef/knife/ionoscloud_share_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_snapshot_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_snapshot_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_user_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_delete.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_detach.rb +4 -4
- data/lib/knife-ionoscloud/version.rb +1 -1
- data/sonar-project.properties +3 -0
- data/spec/chef/knife/ionoscloud_backupunit_create_spec.rb +1 -2
- data/spec/chef/knife/ionoscloud_backupunit_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_backupunit_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_backupunit_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_backupunit_ssourl_spec.rb +2 -4
- data/spec/chef/knife/ionoscloud_backupunit_update_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_base_spec.rb +3 -4
- data/spec/chef/knife/ionoscloud_composite_server_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_contract_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_cube_server_create_spec.rb +2 -3
- data/spec/chef/knife/ionoscloud_datacenter_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_datacenter_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_datacenter_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_datacenter_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_datacenter_update_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_dbaas_postgres_backup_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_dbaas_postgres_backup_list_spec.rb +1 -2
- data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_create_spec.rb +4 -3
- data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_delete_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_get_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_list_spec.rb +3 -2
- data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_restore_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_dbaas_postgres_cluster_update_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_dbaas_postgres_logs_get_spec.rb +75 -4
- data/spec/chef/knife/ionoscloud_dbaas_postgres_version_list_spec.rb +2 -3
- data/spec/chef/knife/ionoscloud_firewall_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_firewall_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_firewall_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_firewall_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_firewall_update_spec.rb +2 -3
- data/spec/chef/knife/ionoscloud_flowlog_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_flowlog_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_flowlog_get_spec.rb +0 -2
- data/spec/chef/knife/ionoscloud_flowlog_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_flowlog_update_spec.rb +0 -2
- data/spec/chef/knife/ionoscloud_group_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_group_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_group_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_group_list_spec.rb +2 -3
- data/spec/chef/knife/ionoscloud_group_update_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_group_user_add_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_group_user_remove_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_image_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_ipblock_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_ipblock_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_ipblock_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_ipblock_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_ipblock_update_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_k8s_create_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_k8s_get_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_k8s_list_spec.rb +3 -2
- data/spec/chef/knife/ionoscloud_k8s_update_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_kubeconfig_get_spec.rb +2 -4
- data/spec/chef/knife/ionoscloud_label_add_spec.rb +1 -2
- data/spec/chef/knife/ionoscloud_label_list_spec.rb +4 -5
- data/spec/chef/knife/ionoscloud_label_remove_spec.rb +1 -2
- data/spec/chef/knife/ionoscloud_lan_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_lan_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_lan_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_lan_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_lan_update_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_loadbalancer_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_loadbalancer_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_loadbalancer_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_loadbalancer_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_loadbalancer_nic_add_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_loadbalancer_nic_remove_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_loadbalancer_update_spec.rb +1 -2
- data/spec/chef/knife/ionoscloud_location_list_spec.rb +1 -2
- data/spec/chef/knife/ionoscloud_natgateway_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_natgateway_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_natgateway_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_natgateway_lan_add_spec.rb +2 -3
- data/spec/chef/knife/ionoscloud_natgateway_lan_remove_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_natgateway_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_natgateway_rule_add_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_natgateway_rule_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_natgateway_rule_remove_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_natgateway_rule_update_spec.rb +4 -5
- data/spec/chef/knife/ionoscloud_natgateway_update_spec.rb +4 -6
- data/spec/chef/knife/ionoscloud_networkloadbalancer_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_networkloadbalancer_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_networkloadbalancer_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_networkloadbalancer_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_add_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_remove_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_add_spec.rb +1 -2
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove_spec.rb +12 -15
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_update_spec.rb +4 -6
- data/spec/chef/knife/ionoscloud_networkloadbalancer_update_spec.rb +2 -3
- data/spec/chef/knife/ionoscloud_nic_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_nic_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_nic_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_nic_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_nic_update_spec.rb +1 -2
- data/spec/chef/knife/ionoscloud_node_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_node_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_node_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_node_replace_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +2 -1
- data/spec/chef/knife/ionoscloud_nodepool_delete_spec.rb +2 -1
- data/spec/chef/knife/ionoscloud_nodepool_get_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_nodepool_lan_add_spec.rb +3 -3
- data/spec/chef/knife/{ionoscloud_nodepool_lan_remove.rb → ionoscloud_nodepool_lan_remove_spec.rb} +14 -17
- data/spec/chef/knife/ionoscloud_nodepool_list_spec.rb +3 -2
- data/spec/chef/knife/ionoscloud_nodepool_update_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_pcc_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_pcc_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_pcc_update_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_request_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_request_list_spec.rb +1 -3
- data/spec/chef/knife/ionoscloud_request_status_spec.rb +2 -4
- data/spec/chef/knife/ionoscloud_request_wait_spec.rb +2 -5
- data/spec/chef/knife/ionoscloud_resource_list_spec.rb +1 -3
- data/spec/chef/knife/ionoscloud_s3key_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_s3key_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_s3key_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_s3key_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_server_console_spec.rb +2 -4
- data/spec/chef/knife/ionoscloud_server_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_server_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_server_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_server_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_server_reboot_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_server_resume_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_server_start_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_server_stop_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_server_suspend_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_server_token_spec.rb +2 -4
- data/spec/chef/knife/ionoscloud_server_update_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_server_upgrade_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_share_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_share_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_share_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_share_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_share_update_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_snapshot_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_snapshot_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_snapshot_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_snapshot_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_snapshot_restore_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_snapshot_update_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_template_list_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_user_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_user_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_user_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_user_list_spec.rb +2 -3
- data/spec/chef/knife/ionoscloud_user_ssourl_spec.rb +2 -4
- data/spec/chef/knife/ionoscloud_user_update_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_volume_attach_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_volume_create_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_volume_detach_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_volume_get_spec.rb +0 -1
- data/spec/chef/knife/ionoscloud_volume_list_spec.rb +2 -3
- data/spec/chef/knife/ionoscloud_volume_update_spec.rb +0 -1
- data/spec/spec_helper.rb +10 -7
- metadata +12 -12
@@ -48,10 +48,10 @@ class Chef
|
|
48
48
|
def initialize(args = [])
|
49
49
|
super(args)
|
50
50
|
@description =
|
51
|
-
|
52
|
-
|
51
|
+
'One of the unique features of the Ionoscloud platform when compared '\
|
52
|
+
'with the other providers is that they allow you to define your own settings '\
|
53
53
|
"for cores, memory, and disk size without being tied to a particular size or flavor.\n\n"\
|
54
|
-
|
54
|
+
'Note: _The memory parameter value must be a multiple of 256, e.g. 256, 512, 768, 1024, and so forth._'
|
55
55
|
@directory = 'compute-engine'
|
56
56
|
@required_options = [:datacenter_id, :cores, :ram, :ionoscloud_username, :ionoscloud_password]
|
57
57
|
end
|
@@ -16,8 +16,8 @@ class Chef
|
|
16
16
|
super(args)
|
17
17
|
@description =
|
18
18
|
"This will remove a server from a VDC.\n\n"\
|
19
|
-
|
20
|
-
|
19
|
+
'**NOTE**: This will not automatically remove the storage volume\\(s\\) '\
|
20
|
+
'attached to a server. A separate API call is required to perform that action.'
|
21
21
|
@directory = 'compute-engine'
|
22
22
|
@required_options = [:datacenter_id, :ionoscloud_username, :ionoscloud_password]
|
23
23
|
end
|
@@ -43,7 +43,7 @@ class Chef
|
|
43
43
|
|
44
44
|
begin
|
45
45
|
confirm('Do you really want to delete this server')
|
46
|
-
rescue SystemExit
|
46
|
+
rescue SystemExit
|
47
47
|
next
|
48
48
|
end
|
49
49
|
|
@@ -20,7 +20,7 @@ class Chef
|
|
20
20
|
def initialize(args = [])
|
21
21
|
super(args)
|
22
22
|
@description =
|
23
|
-
|
23
|
+
'This will upgrade the version of the server, if needed. To verify if there is an upgrade available for a server, '\
|
24
24
|
"call '/datacenters/{datacenterId}/servers?upgradeNeeded=true'."
|
25
25
|
@directory = 'compute-engine'
|
26
26
|
@required_options = [:datacenter_id, :server_id, :ionoscloud_username, :ionoscloud_password]
|
@@ -20,10 +20,10 @@ class Chef
|
|
20
20
|
def initialize(args = [])
|
21
21
|
super(args)
|
22
22
|
@description =
|
23
|
-
|
23
|
+
'This will detach the volume from the server. Depending on the volume '\
|
24
24
|
"HotUnplug settings, this may result in the server being rebooted.\n\n"\
|
25
|
-
|
26
|
-
|
25
|
+
'This will NOT delete the volume from your virtual data center. You will '\
|
26
|
+
'need to make a separate request to delete a volume.'
|
27
27
|
@directory = 'compute-engine'
|
28
28
|
@required_options = [:datacenter_id, :server_id, :ionoscloud_username, :ionoscloud_password]
|
29
29
|
end
|
@@ -59,7 +59,7 @@ class Chef
|
|
59
59
|
|
60
60
|
begin
|
61
61
|
confirm('Do you really want to detach this volume')
|
62
|
-
rescue SystemExit
|
62
|
+
rescue SystemExit
|
63
63
|
next
|
64
64
|
end
|
65
65
|
|
data/sonar-project.properties
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
sonar.projectKey=knife-plugin
|
2
2
|
sonar.organization=ionos-cloud
|
3
3
|
|
4
|
+
sonar.ruby.coverage.reportPaths=coverage/coverage.json
|
5
|
+
sonar.cpd.exclusions=spec/chef/knife/*.rb
|
6
|
+
|
4
7
|
# This is the name and version displayed in the SonarCloud UI.
|
5
8
|
#sonar.projectName=knife-plugin
|
6
9
|
#sonar.projectVersion=1.0
|
@@ -14,7 +14,7 @@ describe Chef::Knife::IonoscloudBackupunitCreate do
|
|
14
14
|
describe '#run' do
|
15
15
|
it 'should call BackupUnitsApi.backupunits_post with the expected arguments and output based on what it receives' do
|
16
16
|
backupunit = backupunit_mock
|
17
|
-
|
17
|
+
{
|
18
18
|
ionoscloud_username: 'email',
|
19
19
|
ionoscloud_password: 'password',
|
20
20
|
name: backupunit.properties.name,
|
@@ -48,7 +48,6 @@ describe Chef::Knife::IonoscloudBackupunitCreate do
|
|
48
48
|
required_options = subject.instance_variable_get(:@required_options)
|
49
49
|
|
50
50
|
arrays_without_one_element(required_options).each do |test_case|
|
51
|
-
|
52
51
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
53
52
|
|
54
53
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -84,7 +84,6 @@ describe Chef::Knife::IonoscloudBackupunitDelete do
|
|
84
84
|
required_options = subject.instance_variable_get(:@required_options)
|
85
85
|
|
86
86
|
arrays_without_one_element(required_options).each do |test_case|
|
87
|
-
|
88
87
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
89
88
|
|
90
89
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -48,7 +48,6 @@ describe Chef::Knife::IonoscloudBackupunitGet do
|
|
48
48
|
required_options = subject.instance_variable_get(:@required_options)
|
49
49
|
|
50
50
|
arrays_without_one_element(required_options).each do |test_case|
|
51
|
-
|
52
51
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
53
52
|
|
54
53
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -55,7 +55,6 @@ describe Chef::Knife::IonoscloudBackupunitList do
|
|
55
55
|
required_options = subject.instance_variable_get(:@required_options)
|
56
56
|
|
57
57
|
arrays_without_one_element(required_options).each do |test_case|
|
58
|
-
|
59
58
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
60
59
|
|
61
60
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -74,9 +74,7 @@ describe Chef::Knife::IonoscloudBackupunitSsourl do
|
|
74
74
|
allow(subject).to receive(:puts)
|
75
75
|
allow(subject).to receive(:print)
|
76
76
|
|
77
|
-
arrays_without_one_element(required_options).each
|
78
|
-
|test_case|
|
79
|
-
|
77
|
+
arrays_without_one_element(required_options).each do |test_case|
|
80
78
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
81
79
|
|
82
80
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -87,7 +85,7 @@ describe Chef::Knife::IonoscloudBackupunitSsourl do
|
|
87
85
|
end
|
88
86
|
|
89
87
|
required_options.each { |value| subject.config[value] = nil }
|
90
|
-
|
88
|
+
end
|
91
89
|
end
|
92
90
|
end
|
93
91
|
end
|
@@ -61,7 +61,6 @@ describe Chef::Knife::IonoscloudBackupunitUpdate do
|
|
61
61
|
required_options = subject.instance_variable_get(:@required_options)
|
62
62
|
|
63
63
|
arrays_without_one_element(required_options).each do |test_case|
|
64
|
-
|
65
64
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
66
65
|
|
67
66
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -99,14 +99,13 @@ describe Chef::Knife::IonoscloudBaseTest do
|
|
99
99
|
expect { subject.is_done? request_id }.to raise_error(SystemExit) do |error|
|
100
100
|
expect(error.status).to eq(1)
|
101
101
|
end
|
102
|
-
|
103
102
|
end
|
104
103
|
end
|
105
104
|
|
106
105
|
describe '#get_request_id' do
|
107
106
|
it 'should return nil when Headers has no Location key' do
|
108
107
|
headers = {
|
109
|
-
'another_key' => '/requests/123'
|
108
|
+
'another_key' => '/requests/123',
|
110
109
|
}
|
111
110
|
|
112
111
|
expect(subject.get_request_id headers).to be_nil
|
@@ -114,7 +113,7 @@ describe Chef::Knife::IonoscloudBaseTest do
|
|
114
113
|
|
115
114
|
it 'should return nil when Headers[\'Location\'] contains no uuid' do
|
116
115
|
headers = {
|
117
|
-
'Location' => '/requests/123'
|
116
|
+
'Location' => '/requests/123',
|
118
117
|
}
|
119
118
|
|
120
119
|
expect(subject.get_request_id headers).to be_nil
|
@@ -123,7 +122,7 @@ describe Chef::Knife::IonoscloudBaseTest do
|
|
123
122
|
it 'should extract the ID from the headers' do
|
124
123
|
request_id = SecureRandom.uuid
|
125
124
|
headers = {
|
126
|
-
'Location' => "/requests/#{request_id}"
|
125
|
+
'Location' => "/requests/#{request_id}",
|
127
126
|
}
|
128
127
|
|
129
128
|
expect(subject.get_request_id headers).to eql(request_id)
|
@@ -97,7 +97,6 @@ describe Chef::Knife::IonoscloudCompositeServerCreate do
|
|
97
97
|
required_options = subject.instance_variable_get(:@required_options)
|
98
98
|
|
99
99
|
arrays_without_one_element(required_options).each do |test_case|
|
100
|
-
|
101
100
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
102
101
|
|
103
102
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -69,7 +69,6 @@ describe Chef::Knife::IonoscloudContractList do
|
|
69
69
|
required_options = subject.instance_variable_get(:@required_options)
|
70
70
|
|
71
71
|
arrays_without_one_element(required_options).each do |test_case|
|
72
|
-
|
73
72
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
74
73
|
|
75
74
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -60,7 +60,7 @@ describe Chef::Knife::IonoscloudCubeServerCreate do
|
|
60
60
|
expect(subject).to receive(:puts).with("Ram: #{server.properties.ram}")
|
61
61
|
expect(subject).to receive(:puts).with("Availability Zone: #{server.properties.availability_zone}")
|
62
62
|
expect(subject).to receive(:puts).with("Boot Volume: #{server.entities.volumes.items.first.id}")
|
63
|
-
expect(subject).to receive(:puts).with(
|
63
|
+
expect(subject).to receive(:puts).with('Boot CDROM: ')
|
64
64
|
|
65
65
|
expected_properties = server.properties.to_hash
|
66
66
|
expected_properties.delete(:bootCdrom)
|
@@ -176,7 +176,7 @@ describe Chef::Knife::IonoscloudCubeServerCreate do
|
|
176
176
|
expect(subject).to receive(:puts).with("Ram: #{server.properties.ram}")
|
177
177
|
expect(subject).to receive(:puts).with("Availability Zone: #{server.properties.availability_zone}")
|
178
178
|
expect(subject).to receive(:puts).with("Boot Volume: #{server.entities.volumes.items.first.id}")
|
179
|
-
expect(subject).to receive(:puts).with(
|
179
|
+
expect(subject).to receive(:puts).with('Boot CDROM: ')
|
180
180
|
|
181
181
|
expected_properties = server.properties.to_hash
|
182
182
|
expected_properties.delete(:bootCdrom)
|
@@ -232,7 +232,6 @@ describe Chef::Knife::IonoscloudCubeServerCreate do
|
|
232
232
|
required_options = subject.instance_variable_get(:@required_options)
|
233
233
|
|
234
234
|
arrays_without_one_element(required_options).each do |test_case|
|
235
|
-
|
236
235
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
237
236
|
|
238
237
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -59,7 +59,6 @@ describe Chef::Knife::IonoscloudDatacenterCreate do
|
|
59
59
|
required_options = subject.instance_variable_get(:@required_options)
|
60
60
|
|
61
61
|
arrays_without_one_element(required_options).each do |test_case|
|
62
|
-
|
63
62
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
64
63
|
|
65
64
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -88,7 +88,6 @@ describe Chef::Knife::IonoscloudDatacenterDelete do
|
|
88
88
|
required_options = subject.instance_variable_get(:@required_options)
|
89
89
|
|
90
90
|
arrays_without_one_element(required_options).each do |test_case|
|
91
|
-
|
92
91
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
93
92
|
|
94
93
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -52,7 +52,6 @@ describe Chef::Knife::IonoscloudDatacenterGet do
|
|
52
52
|
required_options = subject.instance_variable_get(:@required_options)
|
53
53
|
|
54
54
|
arrays_without_one_element(required_options).each do |test_case|
|
55
|
-
|
56
55
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
57
56
|
|
58
57
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -61,7 +61,6 @@ describe Chef::Knife::IonoscloudDatacenterList do
|
|
61
61
|
required_options = subject.instance_variable_get(:@required_options)
|
62
62
|
|
63
63
|
arrays_without_one_element(required_options).each do |test_case|
|
64
|
-
|
65
64
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
66
65
|
|
67
66
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -65,7 +65,6 @@ describe Chef::Knife::IonoscloudDatacenterUpdate do
|
|
65
65
|
required_options = subject.instance_variable_get(:@required_options)
|
66
66
|
|
67
67
|
arrays_without_one_element(required_options).each do |test_case|
|
68
|
-
|
69
68
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
70
69
|
|
71
70
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -50,7 +50,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresBackupGet do
|
|
50
50
|
required_options = subject.instance_variable_get(:@required_options)
|
51
51
|
|
52
52
|
arrays_without_one_element(required_options).each do |test_case|
|
53
|
-
|
54
53
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
55
54
|
|
56
55
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -67,7 +67,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresBackupList do
|
|
67
67
|
subject_config = {
|
68
68
|
ionoscloud_username: 'email',
|
69
69
|
ionoscloud_password: 'password',
|
70
|
-
cluster_id: 'cluster_id'
|
70
|
+
cluster_id: 'cluster_id',
|
71
71
|
}
|
72
72
|
|
73
73
|
subject_config.each { |key, value| subject.config[key] = value }
|
@@ -94,7 +94,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresBackupList do
|
|
94
94
|
required_options = subject.instance_variable_get(:@required_options)
|
95
95
|
|
96
96
|
arrays_without_one_element(required_options).each do |test_case|
|
97
|
-
|
98
97
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
99
98
|
|
100
99
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -21,6 +21,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterCreate do
|
|
21
21
|
display_name: cluster.properties.display_name,
|
22
22
|
postgres_version: cluster.properties.postgres_version,
|
23
23
|
location: cluster.properties.location,
|
24
|
+
backup_location: cluster.properties.backup_location,
|
24
25
|
instances: cluster.properties.instances,
|
25
26
|
ram: cluster.properties.ram,
|
26
27
|
cores: cluster.properties.cores,
|
@@ -37,8 +38,8 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterCreate do
|
|
37
38
|
day_of_the_week: cluster.properties.maintenance_window.day_of_the_week,
|
38
39
|
synchronization_mode: cluster.properties.synchronization_mode,
|
39
40
|
state: cluster.metadata.state,
|
40
|
-
username:
|
41
|
-
password:
|
41
|
+
username: 'usr',
|
42
|
+
password: 'pass123',
|
42
43
|
}
|
43
44
|
|
44
45
|
subject_config.each { |key, value| subject.config[key] = value }
|
@@ -47,6 +48,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterCreate do
|
|
47
48
|
expect(subject).to receive(:puts).with("Display Name: #{cluster.properties.display_name}")
|
48
49
|
expect(subject).to receive(:puts).with("Postgres Version: #{cluster.properties.postgres_version}")
|
49
50
|
expect(subject).to receive(:puts).with("Location: #{cluster.properties.location}")
|
51
|
+
expect(subject).to receive(:puts).with("Backup location: #{cluster.properties.backup_location}")
|
50
52
|
expect(subject).to receive(:puts).with("Instances: #{cluster.properties.instances}")
|
51
53
|
expect(subject).to receive(:puts).with("RAM Size: #{cluster.properties.ram}")
|
52
54
|
expect(subject).to receive(:puts).with("Cores: #{cluster.properties.cores}")
|
@@ -82,7 +84,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterCreate do
|
|
82
84
|
required_options = subject.instance_variable_get(:@required_options)
|
83
85
|
|
84
86
|
arrays_without_one_element(required_options).each do |test_case|
|
85
|
-
|
86
87
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
87
88
|
|
88
89
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -27,6 +27,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterDelete do
|
|
27
27
|
expect(subject).to receive(:puts).with("Display Name: #{cluster.properties.display_name}")
|
28
28
|
expect(subject).to receive(:puts).with("Postgres Version: #{cluster.properties.postgres_version}")
|
29
29
|
expect(subject).to receive(:puts).with("Location: #{cluster.properties.location}")
|
30
|
+
expect(subject).to receive(:puts).with("Backup location: #{cluster.properties.backup_location}")
|
30
31
|
expect(subject).to receive(:puts).with("Instances: #{cluster.properties.instances}")
|
31
32
|
expect(subject).to receive(:puts).with("RAM Size: #{cluster.properties.ram}")
|
32
33
|
expect(subject).to receive(:puts).with("Cores: #{cluster.properties.cores}")
|
@@ -92,7 +93,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterDelete do
|
|
92
93
|
required_options = subject.instance_variable_get(:@required_options)
|
93
94
|
|
94
95
|
arrays_without_one_element(required_options).each do |test_case|
|
95
|
-
|
96
96
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
97
97
|
|
98
98
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -27,6 +27,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterGet do
|
|
27
27
|
expect(subject).to receive(:puts).with("Display Name: #{cluster.properties.display_name}")
|
28
28
|
expect(subject).to receive(:puts).with("Postgres Version: #{cluster.properties.postgres_version}")
|
29
29
|
expect(subject).to receive(:puts).with("Location: #{cluster.properties.location}")
|
30
|
+
expect(subject).to receive(:puts).with("Backup location: #{cluster.properties.backup_location}")
|
30
31
|
expect(subject).to receive(:puts).with("Instances: #{cluster.properties.instances}")
|
31
32
|
expect(subject).to receive(:puts).with("RAM Size: #{cluster.properties.ram}")
|
32
33
|
expect(subject).to receive(:puts).with("Cores: #{cluster.properties.cores}")
|
@@ -56,7 +57,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterGet do
|
|
56
57
|
required_options = subject.instance_variable_get(:@required_options)
|
57
58
|
|
58
59
|
arrays_without_one_element(required_options).each do |test_case|
|
59
|
-
|
60
60
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
61
61
|
|
62
62
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -26,6 +26,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterList do
|
|
26
26
|
subject.ui.color('Display Name', :bold),
|
27
27
|
subject.ui.color('Postgres Version', :bold),
|
28
28
|
subject.ui.color('Location', :bold),
|
29
|
+
subject.ui.color('Backup location', :bold),
|
29
30
|
subject.ui.color('Instances', :bold),
|
30
31
|
subject.ui.color('Datacenter ID', :bold),
|
31
32
|
subject.ui.color('Lan ID', :bold),
|
@@ -38,6 +39,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterList do
|
|
38
39
|
cluster_list << cluster.properties.display_name
|
39
40
|
cluster_list << cluster.properties.postgres_version
|
40
41
|
cluster_list << cluster.properties.location
|
42
|
+
cluster_list << cluster.properties.backup_location
|
41
43
|
cluster_list << cluster.properties.instances
|
42
44
|
cluster_list << cluster.properties.connections.first.datacenter_id
|
43
45
|
cluster_list << cluster.properties.connections.first.lan_id
|
@@ -45,7 +47,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterList do
|
|
45
47
|
cluster_list << cluster.metadata.state
|
46
48
|
end
|
47
49
|
|
48
|
-
expect(subject.ui).to receive(:list).with(cluster_list, :uneven_columns_across,
|
50
|
+
expect(subject.ui).to receive(:list).with(cluster_list, :uneven_columns_across, 10)
|
49
51
|
|
50
52
|
mock_dbaas_call_api(
|
51
53
|
subject,
|
@@ -67,7 +69,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterList do
|
|
67
69
|
required_options = subject.instance_variable_get(:@required_options)
|
68
70
|
|
69
71
|
arrays_without_one_element(required_options).each do |test_case|
|
70
|
-
|
71
72
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
72
73
|
|
73
74
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -42,7 +42,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterRestore do
|
|
42
42
|
required_options = subject.instance_variable_get(:@required_options)
|
43
43
|
|
44
44
|
arrays_without_one_element(required_options).each do |test_case|
|
45
|
-
|
46
45
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
47
46
|
|
48
47
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -28,6 +28,7 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterUpdate do
|
|
28
28
|
expect(subject).to receive(:puts).with("Display Name: #{subject_config[:display_name]}")
|
29
29
|
expect(subject).to receive(:puts).with("Postgres Version: #{cluster.properties.postgres_version}")
|
30
30
|
expect(subject).to receive(:puts).with("Location: #{cluster.properties.location}")
|
31
|
+
expect(subject).to receive(:puts).with("Backup location: #{cluster.properties.backup_location}")
|
31
32
|
expect(subject).to receive(:puts).with("Instances: #{cluster.properties.instances}")
|
32
33
|
expect(subject).to receive(:puts).with("RAM Size: #{cluster.properties.ram}")
|
33
34
|
expect(subject).to receive(:puts).with("Cores: #{cluster.properties.cores}")
|
@@ -72,7 +73,6 @@ describe Chef::Knife::IonoscloudDbaasPostgresClusterUpdate do
|
|
72
73
|
required_options = subject.instance_variable_get(:@required_options)
|
73
74
|
|
74
75
|
arrays_without_one_element(required_options).each do |test_case|
|
75
|
-
|
76
76
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
77
77
|
|
78
78
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|
@@ -12,20 +12,24 @@ describe Chef::Knife::IonoscloudDbaasPostgresLogsGet do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '#run' do
|
15
|
-
it 'should call LogsApi.cluster_logs_get' do
|
15
|
+
it 'should call LogsApi.cluster_logs_get and use start and end even if since and until are also provided' do
|
16
16
|
cluster_logs = cluster_logs_mock
|
17
17
|
subject_config = {
|
18
18
|
ionoscloud_username: 'email',
|
19
19
|
ionoscloud_password: 'password',
|
20
20
|
cluster_id: 'cluster_id',
|
21
21
|
limit: 3,
|
22
|
+
start: '2022-03-22T01:01:01Z',
|
23
|
+
end: '2022-03-22T09:01:01Z',
|
24
|
+
since: '2h',
|
25
|
+
until: '20m',
|
26
|
+
direction: 'FORWARD',
|
22
27
|
yes: true,
|
23
28
|
}
|
24
29
|
|
25
30
|
subject_config.each { |key, value| subject.config[key] = value }
|
26
31
|
|
27
|
-
cluster_logs.instances.each do
|
28
|
-
|instance|
|
32
|
+
cluster_logs.instances.each do |instance|
|
29
33
|
expect(subject).to receive(:puts).with("Instance Name: #{instance.name}")
|
30
34
|
expect(subject).to receive(:puts).with(instance.messages.map { |message| message.message })
|
31
35
|
end
|
@@ -37,6 +41,12 @@ describe Chef::Knife::IonoscloudDbaasPostgresLogsGet do
|
|
37
41
|
method: 'GET',
|
38
42
|
path: "/clusters/#{subject_config[:cluster_id]}/logs",
|
39
43
|
operation: :'LogsApi.cluster_logs_get',
|
44
|
+
options: {
|
45
|
+
limit: subject_config[:limit],
|
46
|
+
direction: subject_config[:direction],
|
47
|
+
start: subject_config[:start],
|
48
|
+
_end: subject_config[:end],
|
49
|
+
},
|
40
50
|
return_type: 'ClusterLogs',
|
41
51
|
result: cluster_logs,
|
42
52
|
},
|
@@ -46,11 +56,72 @@ describe Chef::Knife::IonoscloudDbaasPostgresLogsGet do
|
|
46
56
|
expect { subject.run }.not_to raise_error(Exception)
|
47
57
|
end
|
48
58
|
|
59
|
+
it 'should call LogsApi.cluster_logs_get using since and until' do
|
60
|
+
cluster_logs = cluster_logs_mock
|
61
|
+
subject_config = {
|
62
|
+
ionoscloud_username: 'email',
|
63
|
+
ionoscloud_password: 'password',
|
64
|
+
cluster_id: 'cluster_id',
|
65
|
+
limit: 3,
|
66
|
+
since: '2h',
|
67
|
+
until: '20m',
|
68
|
+
direction: 'FORWARD',
|
69
|
+
yes: true,
|
70
|
+
}
|
71
|
+
|
72
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
73
|
+
|
74
|
+
cluster_logs.instances.each do |instance|
|
75
|
+
expect(subject).to receive(:puts).with("Instance Name: #{instance.name}")
|
76
|
+
expect(subject).to receive(:puts).with(instance.messages.map { |message| message.message })
|
77
|
+
end
|
78
|
+
|
79
|
+
mock_dbaas_call_api(
|
80
|
+
subject,
|
81
|
+
[
|
82
|
+
{
|
83
|
+
method: 'GET',
|
84
|
+
path: "/clusters/#{subject_config[:cluster_id]}/logs",
|
85
|
+
operation: :'LogsApi.cluster_logs_get',
|
86
|
+
options: {
|
87
|
+
limit: subject_config[:limit],
|
88
|
+
direction: subject_config[:direction],
|
89
|
+
start: (Time.now - 2 * 60 * 60).iso8601,
|
90
|
+
_end: (Time.now - 20 * 60).iso8601,
|
91
|
+
},
|
92
|
+
return_type: 'ClusterLogs',
|
93
|
+
result: cluster_logs,
|
94
|
+
},
|
95
|
+
],
|
96
|
+
)
|
97
|
+
|
98
|
+
expect { subject.run }.not_to raise_error(Exception)
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'should call not LogsApi.cluster_logs_get when using something different from minutes and hours for delta' do
|
102
|
+
subject_config = {
|
103
|
+
ionoscloud_username: 'email',
|
104
|
+
ionoscloud_password: 'password',
|
105
|
+
cluster_id: 'cluster_id',
|
106
|
+
since: '2d',
|
107
|
+
yes: true,
|
108
|
+
}
|
109
|
+
|
110
|
+
subject_config.each { |key, value| subject.config[key] = value }
|
111
|
+
|
112
|
+
expect(subject.ui).to receive(:error).with('Time delta may only be specified in hours(h) or minutes(m)!')
|
113
|
+
|
114
|
+
expect(subject.api_client_dbaas).not_to receive(:call_api)
|
115
|
+
|
116
|
+
expect { subject.run }.to raise_error(SystemExit) do |error|
|
117
|
+
expect(error.status).to eq(1)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
49
121
|
it 'should not make any call if any required option is missing' do
|
50
122
|
required_options = subject.instance_variable_get(:@required_options)
|
51
123
|
|
52
124
|
arrays_without_one_element(required_options).each do |test_case|
|
53
|
-
|
54
125
|
test_case[:array].each { |value| subject.config[value] = 'test' }
|
55
126
|
|
56
127
|
expect(subject).to receive(:puts).with("Missing required parameters #{test_case[:removed]}")
|