fix docs, enhance fail msgs

This commit is contained in:
Mark Chance 2015-09-10 08:02:24 -06:00 committed by Matt Clay
parent aa4cecdcf5
commit 495e029c75
2 changed files with 9 additions and 14 deletions

View file

@ -23,14 +23,9 @@ notes:
- It will also wait for a cluster to have instances registered to it. - It will also wait for a cluster to have instances registered to it.
description: description:
- Creates or terminates ecs clusters. - Creates or terminates ecs clusters.
version_added: "1.9" version_added: "2.0"
requirements: [ json, time, boto, boto3 ] requirements: [ json, time, boto, boto3 ]
options: options:
state=dict(required=True, choices=['present', 'absent', 'has_instances'] ),
name=dict(required=True, type='str' ),
delay=dict(required=False, type='int', default=10),
repeat=dict(required=False, type='int', default=10)
state: state:
description: description:
- The desired state of the cluster - The desired state of the cluster
@ -43,11 +38,11 @@ options:
delay: delay:
description: description:
- Number of seconds to wait - Number of seconds to wait
required: true required: false
name: repeat:
description: description:
- The cluster name - The number of times to wait for the cluster to have an instance
required: true required: false
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -128,7 +123,7 @@ class EcsClusterManager:
module.fail_json(msg="Region must be specified as a parameter, in EC2_REGION or AWS_REGION environment variables or in boto configuration file") module.fail_json(msg="Region must be specified as a parameter, in EC2_REGION or AWS_REGION environment variables or in boto configuration file")
self.ecs = boto3_conn(module, conn_type='client', resource='ecs', region=region, endpoint=ec2_url, **aws_connect_kwargs) self.ecs = boto3_conn(module, conn_type='client', resource='ecs', region=region, endpoint=ec2_url, **aws_connect_kwargs)
except boto.exception.NoAuthHandlerFound, e: except boto.exception.NoAuthHandlerFound, e:
self.module.fail_json(msg=str(e)) self.module.fail_json(msg="Can't authorize connection - "+str(e))
def find_in_array(self, array_of_clusters, cluster_name, field_name='clusterArn'): def find_in_array(self, array_of_clusters, cluster_name, field_name='clusterArn'):
for c in array_of_clusters: for c in array_of_clusters:
@ -183,7 +178,7 @@ def main():
try: try:
existing = cluster_mgr.describe_cluster(module.params['name']) existing = cluster_mgr.describe_cluster(module.params['name'])
except Exception, e: except Exception, e:
module.fail_json(msg=str(e)) module.fail_json(msg="Exception describing cluster '"+module.params['name']+"': "+str(e))
results = dict(changed=False) results = dict(changed=False)
if module.params['state'] == 'present': if module.params['state'] == 'present':

View file

@ -20,7 +20,7 @@ module: ecs_cluster_facts
short_description: list or describe clusters or their instances in ecs short_description: list or describe clusters or their instances in ecs
description: description:
- Lists or describes clusters or cluster instances in ecs. - Lists or describes clusters or cluster instances in ecs.
version_added: 1.9 version_added: "2.0"
options: options:
details: details:
description: description:
@ -94,7 +94,7 @@ class EcsClusterManager:
module.fail_json(msg="Region must be specified as a parameter, in EC2_REGION or AWS_REGION environment variables or in boto configuration file") module.fail_json(msg="Region must be specified as a parameter, in EC2_REGION or AWS_REGION environment variables or in boto configuration file")
self.ecs = boto3_conn(module, conn_type='client', resource='ecs', region=region, endpoint=ec2_url, **aws_connect_kwargs) self.ecs = boto3_conn(module, conn_type='client', resource='ecs', region=region, endpoint=ec2_url, **aws_connect_kwargs)
except boto.exception.NoAuthHandlerFound, e: except boto.exception.NoAuthHandlerFound, e:
self.module.fail_json(msg=str(e)) self.module.fail_json(msg="Can't authorize connection - "+str(e))
def list_container_instances(self, cluster): def list_container_instances(self, cluster):
response = self.ecs.list_container_instances(cluster=cluster) response = self.ecs.list_container_instances(cluster=cluster)