mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
dimensiondata: fix broken import (#35634)
* Fix broken import * Remove never reached statements exit_json and fail_json methods call sys.exit, subsequent statements can not be executed.
This commit is contained in:
@@ -71,8 +71,6 @@ class DimensionDataModule(object):
|
||||
if not HAS_LIBCLOUD:
|
||||
self.module.fail_json(msg='libcloud is required for this module.')
|
||||
|
||||
return
|
||||
|
||||
# Credentials are common to all Dimension Data modules.
|
||||
credentials = self.get_credentials()
|
||||
self.user_id = credentials['user_id']
|
||||
@@ -125,8 +123,6 @@ class DimensionDataModule(object):
|
||||
if not HAS_LIBCLOUD:
|
||||
self.module.fail_json(msg='libcloud is required for this module.')
|
||||
|
||||
return None
|
||||
|
||||
user_id = None
|
||||
key = None
|
||||
|
||||
@@ -137,8 +133,6 @@ class DimensionDataModule(object):
|
||||
msg='"mcp_user" parameter was specified, but not "mcp_password" (either both must be specified, or neither).'
|
||||
)
|
||||
|
||||
return None
|
||||
|
||||
user_id = self.module.params['mcp_user']
|
||||
key = self.module.params['mcp_password']
|
||||
|
||||
|
||||
@@ -110,17 +110,14 @@ network:
|
||||
'''
|
||||
import traceback
|
||||
|
||||
try:
|
||||
from libcloud.compute.base import NodeLocation
|
||||
|
||||
HAS_LIBCLOUD = True
|
||||
except ImportError:
|
||||
HAS_LIBCLOUD = False
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.dimensiondata import DimensionDataModule, DimensionDataAPIException
|
||||
from ansible.module_utils.dimensiondata import HAS_LIBCLOUD, DimensionDataModule
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
if HAS_LIBCLOUD:
|
||||
from libcloud.compute.base import NodeLocation
|
||||
from libcloud.common.dimensiondata import DimensionDataAPIException
|
||||
|
||||
|
||||
class DimensionDataNetworkModule(DimensionDataModule):
|
||||
"""
|
||||
@@ -159,8 +156,6 @@ class DimensionDataNetworkModule(DimensionDataModule):
|
||||
network=self._network_to_dict(network)
|
||||
)
|
||||
|
||||
return
|
||||
|
||||
network = self._create_network()
|
||||
|
||||
self.module.exit_json(
|
||||
@@ -179,8 +174,6 @@ class DimensionDataNetworkModule(DimensionDataModule):
|
||||
network=self._network_to_dict(network)
|
||||
)
|
||||
|
||||
return
|
||||
|
||||
self._delete_network(network)
|
||||
|
||||
def _get_network(self):
|
||||
@@ -226,8 +219,6 @@ class DimensionDataNetworkModule(DimensionDataModule):
|
||||
msg='service_plan required when creating network and location is MCP 2.0'
|
||||
)
|
||||
|
||||
return None
|
||||
|
||||
# Create network
|
||||
try:
|
||||
if self.mcp_version == '1.0':
|
||||
@@ -249,8 +240,6 @@ class DimensionDataNetworkModule(DimensionDataModule):
|
||||
msg="Failed to create new network: %s" % to_native(e), exception=traceback.format_exc()
|
||||
)
|
||||
|
||||
return None
|
||||
|
||||
if self.module.params['wait'] is True:
|
||||
network = self._wait_for_network_state(network.id, 'NORMAL')
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
lib/ansible/modules/cloud/dimensiondata/dimensiondata_network.py
|
||||
lib/ansible/modules/cloud/webfaction/webfaction_app.py
|
||||
lib/ansible/modules/cloud/webfaction/webfaction_db.py
|
||||
lib/ansible/modules/cloud/webfaction/webfaction_domain.py
|
||||
|
||||
Reference in New Issue
Block a user