mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02: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:
parent
417d11eeb9
commit
54882d4715
3 changed files with 5 additions and 23 deletions
|
@ -71,8 +71,6 @@ class DimensionDataModule(object):
|
||||||
if not HAS_LIBCLOUD:
|
if not HAS_LIBCLOUD:
|
||||||
self.module.fail_json(msg='libcloud is required for this module.')
|
self.module.fail_json(msg='libcloud is required for this module.')
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
# Credentials are common to all Dimension Data modules.
|
# Credentials are common to all Dimension Data modules.
|
||||||
credentials = self.get_credentials()
|
credentials = self.get_credentials()
|
||||||
self.user_id = credentials['user_id']
|
self.user_id = credentials['user_id']
|
||||||
|
@ -125,8 +123,6 @@ class DimensionDataModule(object):
|
||||||
if not HAS_LIBCLOUD:
|
if not HAS_LIBCLOUD:
|
||||||
self.module.fail_json(msg='libcloud is required for this module.')
|
self.module.fail_json(msg='libcloud is required for this module.')
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
user_id = None
|
user_id = None
|
||||||
key = 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).'
|
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']
|
user_id = self.module.params['mcp_user']
|
||||||
key = self.module.params['mcp_password']
|
key = self.module.params['mcp_password']
|
||||||
|
|
||||||
|
|
|
@ -110,17 +110,14 @@ network:
|
||||||
'''
|
'''
|
||||||
import traceback
|
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.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
|
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):
|
class DimensionDataNetworkModule(DimensionDataModule):
|
||||||
"""
|
"""
|
||||||
|
@ -159,8 +156,6 @@ class DimensionDataNetworkModule(DimensionDataModule):
|
||||||
network=self._network_to_dict(network)
|
network=self._network_to_dict(network)
|
||||||
)
|
)
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
network = self._create_network()
|
network = self._create_network()
|
||||||
|
|
||||||
self.module.exit_json(
|
self.module.exit_json(
|
||||||
|
@ -179,8 +174,6 @@ class DimensionDataNetworkModule(DimensionDataModule):
|
||||||
network=self._network_to_dict(network)
|
network=self._network_to_dict(network)
|
||||||
)
|
)
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
self._delete_network(network)
|
self._delete_network(network)
|
||||||
|
|
||||||
def _get_network(self):
|
def _get_network(self):
|
||||||
|
@ -226,8 +219,6 @@ class DimensionDataNetworkModule(DimensionDataModule):
|
||||||
msg='service_plan required when creating network and location is MCP 2.0'
|
msg='service_plan required when creating network and location is MCP 2.0'
|
||||||
)
|
)
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
# Create network
|
# Create network
|
||||||
try:
|
try:
|
||||||
if self.mcp_version == '1.0':
|
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()
|
msg="Failed to create new network: %s" % to_native(e), exception=traceback.format_exc()
|
||||||
)
|
)
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
if self.module.params['wait'] is True:
|
if self.module.params['wait'] is True:
|
||||||
network = self._wait_for_network_state(network.id, 'NORMAL')
|
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_app.py
|
||||||
lib/ansible/modules/cloud/webfaction/webfaction_db.py
|
lib/ansible/modules/cloud/webfaction/webfaction_db.py
|
||||||
lib/ansible/modules/cloud/webfaction/webfaction_domain.py
|
lib/ansible/modules/cloud/webfaction/webfaction_domain.py
|
||||||
|
|
Loading…
Add table
Reference in a new issue