From 5f9592248a7e8dbd4f61f3cf4fc0025a5f0a1d8f Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 27 May 2015 07:03:29 -0700 Subject: [PATCH] Minor fixups found during review of #582 --- cloud/amazon/s3.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cloud/amazon/s3.py b/cloud/amazon/s3.py index 300461dc8c4..310bda3bfbc 100644 --- a/cloud/amazon/s3.py +++ b/cloud/amazon/s3.py @@ -235,7 +235,7 @@ def download_s3file(module, s3, bucket, obj, dest, retries): # more to get that count of loops. bucket = s3.lookup(bucket) key = bucket.lookup(obj) - for x in xrange(0, retries + 1): + for x in range(0, retries + 1): try: key.get_contents_to_filename(dest) module.exit_json(msg="GET operation complete", changed=True) @@ -243,7 +243,7 @@ def download_s3file(module, s3, bucket, obj, dest, retries): module.fail_json(msg= str(e)) except SSLError as e: # actually fail on last pass through the loop. - if x == retries: + if x >= retries: module.fail_json(msg="s3 download failed; %s" % e) # otherwise, try again, this may be a transient timeout. pass @@ -295,7 +295,7 @@ def main(): s3_url = dict(aliases=['S3_URL']), overwrite = dict(aliases=['force'], default='always'), metadata = dict(type='dict'), - retries = dict(aliases=['retry'], type='str', default=0), + retries = dict(aliases=['retry'], type='int', default=0), ), ) module = AnsibleModule(argument_spec=argument_spec) @@ -313,7 +313,7 @@ def main(): s3_url = module.params.get('s3_url') overwrite = module.params.get('overwrite') metadata = module.params.get('metadata') - retries = int(module.params.get('retries')) + retries = module.params.get('retries') if overwrite not in ['always', 'never', 'different']: if module.boolean(overwrite):