Skip to content

Commit

Permalink
Merge branch 'GCLOUD2-12819/fix-linters' into 'master'
Browse files Browse the repository at this point in the history
GCLOUD2-12819 Fix errors for linters

See merge request cloudapi/ansible-provider!30
  • Loading branch information
IsabellaMerkulova committed Feb 8, 2024
2 parents 7ef6602 + 471560f commit 1d23ffb
Show file tree
Hide file tree
Showing 38 changed files with 45 additions and 5 deletions.
2 changes: 2 additions & 0 deletions plugins/module_utils/clients/base.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
9 changes: 5 additions & 4 deletions plugins/module_utils/cloud.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -33,17 +34,17 @@
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,
)
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,
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/image_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/instance_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/instance_quota_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/keypair.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/keypair_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/lifecycle_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/loadbalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/loadbalancer_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/loadbalancer_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/loadbalancer_listener_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/loadbalancer_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/loadbalancer_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/loadbalancer_pool_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/network_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/reserved_fixed_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/reserved_fixed_ip_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/router_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/secret_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/securitygroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/securitygroup_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/securitygroup_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/servergroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/servergroup_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/subnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/subnet_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/volume_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/volume_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
1 change: 1 addition & 0 deletions plugins/modules/volume_snapshot_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/plugins/module_utils/test_api_client.py
Original file line number Diff line number Diff line change
@@ -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()
Expand Down

0 comments on commit 1d23ffb

Please sign in to comment.