diff --git a/plugins/module_utils/clients/base.py b/plugins/module_utils/clients/base.py index 47ce909..982f721 100644 --- a/plugins/module_utils/clients/base.py +++ b/plugins/module_utils/clients/base.py @@ -1,8 +1,10 @@ +# pylint: disable=inconsistent-return-statements from string import Formatter from time import sleep from typing import Optional from ansible.module_utils.basic import AnsibleModule + from ansible_collections.gcore.cloud.plugins.module_utils.api import CloudAPIClient from ansible_collections.gcore.cloud.plugins.module_utils.exceptions import ( ValidationError, diff --git a/plugins/module_utils/cloud.py b/plugins/module_utils/cloud.py index ceb3271..aaf2252 100644 --- a/plugins/module_utils/cloud.py +++ b/plugins/module_utils/cloud.py @@ -1,4 +1,5 @@ from ansible.module_utils.basic import AnsibleModule, env_fallback + from ansible_collections.gcore.cloud.plugins.module_utils.api import CloudAPIClient from ansible_collections.gcore.cloud.plugins.module_utils.clients.image import ( CloudImageClient, @@ -33,8 +34,8 @@ from ansible_collections.gcore.cloud.plugins.module_utils.clients.router import ( CloudRouterClient, ) -from ansible_collections.gcore.cloud.plugins.module_utils.clients.servergroup import ( - CloudServerGroupClient, +from ansible_collections.gcore.cloud.plugins.module_utils.clients.secret import ( + CloudSecretClient, ) from ansible_collections.gcore.cloud.plugins.module_utils.clients.securitygroup import ( CloudSecurityGroupClient, @@ -42,8 +43,8 @@ from ansible_collections.gcore.cloud.plugins.module_utils.clients.securitygroup_rule import ( CloudSecurityGroupRuleClient, ) -from ansible_collections.gcore.cloud.plugins.module_utils.clients.secret import ( - CloudSecretClient, +from ansible_collections.gcore.cloud.plugins.module_utils.clients.servergroup import ( + CloudServerGroupClient, ) from ansible_collections.gcore.cloud.plugins.module_utils.clients.snapshot import ( CloudSnapshotClient, diff --git a/plugins/modules/image.py b/plugins/modules/image.py index 16d53f9..29e3bd4 100644 --- a/plugins/modules/image.py +++ b/plugins/modules/image.py @@ -300,6 +300,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.image import ( ImageManageAction, ) diff --git a/plugins/modules/image_info.py b/plugins/modules/image_info.py index 91aba70..5145cdc 100644 --- a/plugins/modules/image_info.py +++ b/plugins/modules/image_info.py @@ -247,6 +247,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/instance.py b/plugins/modules/instance.py index 3bfc49d..1b34d16 100644 --- a/plugins/modules/instance.py +++ b/plugins/modules/instance.py @@ -425,6 +425,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.instance import ( InstanceManageAction, ) diff --git a/plugins/modules/instance_info.py b/plugins/modules/instance_info.py index f68a36e..0d797c1 100644 --- a/plugins/modules/instance_info.py +++ b/plugins/modules/instance_info.py @@ -301,6 +301,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/instance_quota_info.py b/plugins/modules/instance_quota_info.py index c8e8346..4b2efec 100644 --- a/plugins/modules/instance_quota_info.py +++ b/plugins/modules/instance_quota_info.py @@ -199,6 +199,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/keypair.py b/plugins/modules/keypair.py index 651c69f..f92675b 100644 --- a/plugins/modules/keypair.py +++ b/plugins/modules/keypair.py @@ -153,6 +153,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.keypair import ( KeypairManageAction, ) diff --git a/plugins/modules/keypair_info.py b/plugins/modules/keypair_info.py index 2b03fb1..09d1d2a 100644 --- a/plugins/modules/keypair_info.py +++ b/plugins/modules/keypair_info.py @@ -107,6 +107,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/lifecycle_policy.py b/plugins/modules/lifecycle_policy.py index b8dcc8f..193f204 100644 --- a/plugins/modules/lifecycle_policy.py +++ b/plugins/modules/lifecycle_policy.py @@ -206,6 +206,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.lifecycle_policy import ( LifecyclePolicyManageAction, ) diff --git a/plugins/modules/loadbalancer.py b/plugins/modules/loadbalancer.py index fb78b43..5ce07dd 100644 --- a/plugins/modules/loadbalancer.py +++ b/plugins/modules/loadbalancer.py @@ -329,6 +329,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.loadbalancer import ( LoadbalancerManageAction, ) diff --git a/plugins/modules/loadbalancer_info.py b/plugins/modules/loadbalancer_info.py index e5562d3..04711d1 100644 --- a/plugins/modules/loadbalancer_info.py +++ b/plugins/modules/loadbalancer_info.py @@ -304,6 +304,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/loadbalancer_listener.py b/plugins/modules/loadbalancer_listener.py index f723966..175e921 100644 --- a/plugins/modules/loadbalancer_listener.py +++ b/plugins/modules/loadbalancer_listener.py @@ -224,6 +224,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.loadbalancer_listener import ( LbListenerManageAction, ) diff --git a/plugins/modules/loadbalancer_listener_info.py b/plugins/modules/loadbalancer_listener_info.py index 544f6cb..c278df0 100644 --- a/plugins/modules/loadbalancer_listener_info.py +++ b/plugins/modules/loadbalancer_listener_info.py @@ -152,6 +152,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/loadbalancer_member.py b/plugins/modules/loadbalancer_member.py index a80ff7a..2d7a379 100644 --- a/plugins/modules/loadbalancer_member.py +++ b/plugins/modules/loadbalancer_member.py @@ -228,6 +228,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.loadbalancer_member import ( LbPoolMemeberManageAction, ) diff --git a/plugins/modules/loadbalancer_pool.py b/plugins/modules/loadbalancer_pool.py index be1491e..b9b8337 100644 --- a/plugins/modules/loadbalancer_pool.py +++ b/plugins/modules/loadbalancer_pool.py @@ -274,6 +274,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.loadbalancer_pool import ( LbPoolManageAction, ) diff --git a/plugins/modules/loadbalancer_pool_info.py b/plugins/modules/loadbalancer_pool_info.py index 4d46e6d..44007e1 100644 --- a/plugins/modules/loadbalancer_pool_info.py +++ b/plugins/modules/loadbalancer_pool_info.py @@ -184,6 +184,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/network.py b/plugins/modules/network.py index 929cce1..e1bdbd1 100644 --- a/plugins/modules/network.py +++ b/plugins/modules/network.py @@ -184,6 +184,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.network import ( NetworkManageAction, ) diff --git a/plugins/modules/network_info.py b/plugins/modules/network_info.py index 1a3f84b..b438668 100644 --- a/plugins/modules/network_info.py +++ b/plugins/modules/network_info.py @@ -165,6 +165,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/reserved_fixed_ip.py b/plugins/modules/reserved_fixed_ip.py index 036a573..af926db 100644 --- a/plugins/modules/reserved_fixed_ip.py +++ b/plugins/modules/reserved_fixed_ip.py @@ -235,6 +235,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.reserved_fip import ( ReservedFipManageAction, ) diff --git a/plugins/modules/reserved_fixed_ip_info.py b/plugins/modules/reserved_fixed_ip_info.py index 21d2277..2e94327 100644 --- a/plugins/modules/reserved_fixed_ip_info.py +++ b/plugins/modules/reserved_fixed_ip_info.py @@ -202,6 +202,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/router.py b/plugins/modules/router.py index 1c96a47..8a5b1f6 100644 --- a/plugins/modules/router.py +++ b/plugins/modules/router.py @@ -202,6 +202,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.router import ( RouterManageAction, ) diff --git a/plugins/modules/router_info.py b/plugins/modules/router_info.py index 796cf4c..3dec255 100644 --- a/plugins/modules/router_info.py +++ b/plugins/modules/router_info.py @@ -138,6 +138,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/secret.py b/plugins/modules/secret.py index ddf168a..3bf6224 100644 --- a/plugins/modules/secret.py +++ b/plugins/modules/secret.py @@ -138,6 +138,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.secret import ( SecretManageAction, ) diff --git a/plugins/modules/secret_info.py b/plugins/modules/secret_info.py index 5561501..e21b2d9 100644 --- a/plugins/modules/secret_info.py +++ b/plugins/modules/secret_info.py @@ -104,6 +104,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/securitygroup.py b/plugins/modules/securitygroup.py index a64f691..11c412c 100644 --- a/plugins/modules/securitygroup.py +++ b/plugins/modules/securitygroup.py @@ -189,6 +189,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.securitygroup import ( SecurityGroupManageAction, ) diff --git a/plugins/modules/securitygroup_info.py b/plugins/modules/securitygroup_info.py index 3d7a24d..3204ec7 100644 --- a/plugins/modules/securitygroup_info.py +++ b/plugins/modules/securitygroup_info.py @@ -151,6 +151,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/securitygroup_rule.py b/plugins/modules/securitygroup_rule.py index 4500071..4204fb5 100644 --- a/plugins/modules/securitygroup_rule.py +++ b/plugins/modules/securitygroup_rule.py @@ -224,6 +224,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.schemas.securitygroup_rule import ( DirectionType, Ethertype, diff --git a/plugins/modules/servergroup.py b/plugins/modules/servergroup.py index 43be6ea..7b1cbfa 100644 --- a/plugins/modules/servergroup.py +++ b/plugins/modules/servergroup.py @@ -112,6 +112,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.schemas.servergroup import ( ServerGroupPolicy, ) diff --git a/plugins/modules/servergroup_info.py b/plugins/modules/servergroup_info.py index 90bd163..7b65ff6 100644 --- a/plugins/modules/servergroup_info.py +++ b/plugins/modules/servergroup_info.py @@ -89,6 +89,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/subnet.py b/plugins/modules/subnet.py index aaa10e5..6230014 100644 --- a/plugins/modules/subnet.py +++ b/plugins/modules/subnet.py @@ -255,6 +255,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.subnet import ( SubnetManageAction, ) diff --git a/plugins/modules/subnet_info.py b/plugins/modules/subnet_info.py index 3f9a75d..2497013 100644 --- a/plugins/modules/subnet_info.py +++ b/plugins/modules/subnet_info.py @@ -190,6 +190,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/volume.py b/plugins/modules/volume.py index f84c2bd..c7979c7 100644 --- a/plugins/modules/volume.py +++ b/plugins/modules/volume.py @@ -345,6 +345,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.schemas.volume import ( RetypableVolumeType, VolumeSource, diff --git a/plugins/modules/volume_info.py b/plugins/modules/volume_info.py index a5bb70c..219615d 100644 --- a/plugins/modules/volume_info.py +++ b/plugins/modules/volume_info.py @@ -235,6 +235,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/plugins/modules/volume_snapshot.py b/plugins/modules/volume_snapshot.py index 086a442..aa6322c 100644 --- a/plugins/modules/volume_snapshot.py +++ b/plugins/modules/volume_snapshot.py @@ -160,6 +160,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.clients.snapshot import ( SnapshotManageAction, ) diff --git a/plugins/modules/volume_snapshot_info.py b/plugins/modules/volume_snapshot_info.py index a2ed3f0..a2177d3 100644 --- a/plugins/modules/volume_snapshot_info.py +++ b/plugins/modules/volume_snapshot_info.py @@ -153,6 +153,7 @@ from traceback import format_exc from ansible.module_utils.basic import AnsibleModule, to_native + from ansible_collections.gcore.cloud.plugins.module_utils.cloud import ( AnsibleCloudClient, ) diff --git a/pyproject.toml b/pyproject.toml index 8d496d3..715ba64 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,8 @@ wrong-import-position, no-name-in-module, use-dict-literal, broad-exception-caught, +too-many-instance-attributes, +duplicate-code, """ [build-system] diff --git a/tests/unit/plugins/module_utils/test_api_client.py b/tests/unit/plugins/module_utils/test_api_client.py index d2c5793..b90bbac 100644 --- a/tests/unit/plugins/module_utils/test_api_client.py +++ b/tests/unit/plugins/module_utils/test_api_client.py @@ -1,8 +1,9 @@ import unittest -from ansible_collections.gcore.cloud.plugins.module_utils.api import CloudAPIClient from mock import MagicMock +from ansible_collections.gcore.cloud.plugins.module_utils.api import CloudAPIClient + def mock_module(params: dict): module = MagicMock()