mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Don't raise or catch StandardError in amazon modules
This commit is contained in:
committed by
Matt Clay
parent
5fbc5cb529
commit
5bd1bcaa2d
@@ -24,7 +24,8 @@ notes:
|
||||
description:
|
||||
- Creates or terminates ecs clusters.
|
||||
version_added: "2.0"
|
||||
requirements: [ json, time, boto, boto3 ]
|
||||
author: Mark Chance(@Java1Guy)
|
||||
requirements: [ boto, boto3 ]
|
||||
options:
|
||||
state:
|
||||
description:
|
||||
@@ -97,8 +98,9 @@ status:
|
||||
returned: ACTIVE
|
||||
type: string
|
||||
'''
|
||||
import time
|
||||
|
||||
try:
|
||||
import json, time
|
||||
import boto
|
||||
HAS_BOTO = True
|
||||
except ImportError:
|
||||
@@ -144,7 +146,7 @@ class EcsClusterManager:
|
||||
c = self.find_in_array(response['clusters'], cluster_name)
|
||||
if c:
|
||||
return c
|
||||
raise StandardError("Unknown problem describing cluster %s." % cluster_name)
|
||||
raise Exception("Unknown problem describing cluster %s." % cluster_name)
|
||||
|
||||
def create_cluster(self, clusterName = 'default'):
|
||||
response = self.ecs.create_cluster(clusterName=clusterName)
|
||||
@@ -167,12 +169,10 @@ def main():
|
||||
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True, required_together=required_together)
|
||||
|
||||
if not HAS_BOTO:
|
||||
module.fail_json(msg='boto is required.')
|
||||
module.fail_json(msg='boto is required.')
|
||||
|
||||
if not HAS_BOTO3:
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
|
||||
cluster_name = module.params['name']
|
||||
module.fail_json(msg='boto3 is required.')
|
||||
|
||||
cluster_mgr = EcsClusterManager(module)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user