aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Copeland <ben.copeland@linaro.org>2016-09-12 10:49:22 +0100
committerBen Copeland <ben.copeland@linaro.org>2016-09-21 13:34:17 +0000
commit928b25fb16efa922326a0ddae06564b4b13c71c5 (patch)
tree0b465115cb484642e635ac8e52972db828ee012f
parent76ffeec3c98b46f2884ae37bb8621786ba74d16d (diff)
s3_latest_link: fix digit bug
Because releases are 16.04 etc, it caused Python script to break on checking for max number to determine latest_link. Change-Id: I643baaa497c31e3bb70ae0ca949a34ab02e05e66 Reviewed-on: https://review.linaro.org/14250 Reviewed-by: Andy Doan <andy.doan@linaro.org>
-rw-r--r--license_protected_downloads/management/commands/s3_latest_link.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/license_protected_downloads/management/commands/s3_latest_link.py b/license_protected_downloads/management/commands/s3_latest_link.py
index 2bf5364..7fff45a 100644
--- a/license_protected_downloads/management/commands/s3_latest_link.py
+++ b/license_protected_downloads/management/commands/s3_latest_link.py
@@ -7,6 +7,7 @@ from boto.s3.connection import S3Connection
logging.getLogger().setLevel(logging.INFO)
+
class Command(BaseCommand):
help = 'Ensure the hidden dotfile is created in the latest_link folder'
conn = S3Connection(settings.AWS_ACCESS_KEY_ID,
@@ -24,9 +25,13 @@ class Command(BaseCommand):
list2 = []
for i in set(paths):
for key in self.bucket.list(prefix=os.path.split(i)[0]):
- if os.path.split(os.path.dirname(key.name))[1].isdigit():
- list1.append(os.path.split(os.path.dirname(key.name))[1])
- list2.append(os.path.split(os.path.dirname(key.name))[0])
+ # Need to replace "." for releases folder e.g. 15.06,16.06 etc
+ build_no = os.path.split(os.path.dirname(key.name))[1]\
+ .replace(".", "", 1)
+ parent_dir = os.path.split(os.path.dirname(key.name))[0]
+ if build_no.isdigit():
+ list1.append(build_no)
+ list2.append(parent_dir)
key_name = '.s3_linked_from'
file_content = '%s/%s' % (', '.join(set(list2)), max(list1,
key=int))