diff --git a/pavelib/utils/db_utils.py b/pavelib/utils/db_utils.py index 7d238e7512bab71871b6b6927891c2852359ac3d..bf3f3e82f3d1ad75b3575df49b8ded6af0c14043 100644 --- a/pavelib/utils/db_utils.py +++ b/pavelib/utils/db_utils.py @@ -125,11 +125,17 @@ def does_fingerprint_on_disk_match(fingerprint): def is_fingerprint_in_bucket(fingerprint, bucket_name): """ - Test if a zip file matching the given fingerprint is present within an s3 bucket + Test if a zip file matching the given fingerprint is present within an s3 bucket. + If there is any issue reaching the bucket, show the exception but continue by + returning False """ zipfile_name = '{}.tar.gz'.format(fingerprint) - conn = boto.connect_s3(anon=True) - bucket = conn.get_bucket(bucket_name) + try: + conn = boto.connect_s3(anon=True) + bucket = conn.get_bucket(bucket_name) + except Exception as e: # pylint: disable=broad-except + print("Exception caught trying to reach S3 bucket {}: {}".format(bucket_name, e)) + return False key = boto.s3.key.Key(bucket=bucket, name=zipfile_name) return key.exists() diff --git a/pavelib/utils/test/suites/bokchoy_suite.py b/pavelib/utils/test/suites/bokchoy_suite.py index 6a750baac8e7856dd306ddbecdb4c9456cdb8437..7630284befb89e5a4c437783cec157d6e0309c5a 100644 --- a/pavelib/utils/test/suites/bokchoy_suite.py +++ b/pavelib/utils/test/suites/bokchoy_suite.py @@ -136,14 +136,9 @@ def reset_test_database(): """ Reset the database used by the bokchoy tests. - If the tests are being run on Jenkins, use the database cache automation - defined in pavelib/database.py - If not, reset the test database and apply migrations + Use the database cache automation defined in pavelib/database.py """ - if os.environ.get('USER', None) == 'jenkins': - update_local_bokchoy_db_from_s3() # pylint: disable=no-value-for-parameter - else: - sh("{}/scripts/reset-test-db.sh --migrations".format(Env.REPO_ROOT)) + update_local_bokchoy_db_from_s3() # pylint: disable=no-value-for-parameter @task