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:
Pilou 2018-02-07 00:44:42 +01:00 committed by Dag Wieers
parent 417d11eeb9
commit 54882d4715
3 changed files with 5 additions and 23 deletions

View file

@ -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')