From f4625a3dd104e245a80ff547deb75f0de880d24f Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 12 Dec 2014 11:22:20 -0800 Subject: [PATCH] Fixup the directory name at a higher level so it can be used by both conditional branches Fixes #500 --- cloud/google/gc_storage.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cloud/google/gc_storage.py b/cloud/google/gc_storage.py index 1963a148da2..28beea05783 100644 --- a/cloud/google/gc_storage.py +++ b/cloud/google/gc_storage.py @@ -319,11 +319,12 @@ def handle_create(module, gs, bucket, obj): else: module.exit_json(msg="Bucket created successfully", changed=create_bucket(module, gs, bucket)) if bucket and obj: + if obj.endswith('/'): + dirobj = obj + else: + dirobj = obj + "/" + if bucket_check(module, gs, bucket): - if obj.endswith('/'): - dirobj = obj - else: - dirobj = obj + "/" if key_check(module, gs, bucket, dirobj): module.exit_json(msg="Bucket %s and key %s already exists."% (bucket, obj), changed=False) else: