Update for modules which import json.

Some do not use the json module directly so don't need import json.
Some needed to fallback to simplejson with no traceback if neither was installed

Fixes #1298
This commit is contained in:
Toshio Kuratomi 2016-01-11 12:47:21 -08:00 committed by Matt Clay
commit ad0d2c1747
22 changed files with 85 additions and 37 deletions

View file

@ -95,7 +95,6 @@ task:
sample: "TODO: include sample"
'''
try:
import json
import boto
import botocore
HAS_BOTO = True
@ -120,7 +119,7 @@ class EcsExecManager:
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)
except boto.exception.NoAuthHandlerFound, e:
self.module.fail_json(msg=str(e))
module.fail_json(msg="Can't authorize connection - "+str(e))
def list_tasks(self, cluster_name, service_name, status):
response = self.ecs.list_tasks(

View file

@ -93,7 +93,6 @@ taskdefinition:
type: dict inputs plus revision, status, taskDefinitionArn
'''
try:
import json
import boto
import botocore
HAS_BOTO = True
@ -118,7 +117,7 @@ class EcsTaskManager:
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)
except boto.exception.NoAuthHandlerFound, e:
self.module.fail_json(msg=str(e))
module.fail_json(msg="Can't authorize connection - "+str(e))
def describe_task(self, task_name):
try:

View file

@ -160,7 +160,6 @@ EXAMPLES = '''
'''
try:
import json
import boto
import botocore
HAS_BOTO = True

View file

@ -130,7 +130,6 @@ EXAMPLES = '''
'''
import time
import json
import xmltodict
VALID_RULE_KEYS = ['rule_type', 'original_ip', 'original_port',