diff --git a/roles/generate-zuul-manifest/library/generate_manifest.py b/roles/generate-zuul-manifest/library/generate_manifest.py index 5e1240a2a..40f5eb35c 100644 --- a/roles/generate-zuul-manifest/library/generate_manifest.py +++ b/roles/generate-zuul-manifest/library/generate_manifest.py @@ -23,7 +23,9 @@ import sys from ansible.module_utils.basic import AnsibleModule -mimetypes.init() +if not mimetypes.inited: + # We don't want to reinit and override any previously added types. + mimetypes.init() def path_in_tree(root, path): diff --git a/roles/test-upload-logs-swift/library/zuul_swift_upload.py b/roles/test-upload-logs-swift/library/zuul_swift_upload.py index fc2220a56..b2df12c39 100755 --- a/roles/test-upload-logs-swift/library/zuul_swift_upload.py +++ b/roles/test-upload-logs-swift/library/zuul_swift_upload.py @@ -60,7 +60,9 @@ try: except ImportError: from collections import Sequence -mimetypes.init() +if not mimetypes.inited: + # We don't want to reinit and override any previously inited types. + mimetypes.init() mimetypes.add_type('text/plain', '.yaml') MAX_UPLOAD_THREADS = 24 diff --git a/roles/upload-logs-base/module_utils/zuul_jobs/upload_utils.py b/roles/upload-logs-base/module_utils/zuul_jobs/upload_utils.py index 9b6353f83..51e551785 100644 --- a/roles/upload-logs-base/module_utils/zuul_jobs/upload_utils.py +++ b/roles/upload-logs-base/module_utils/zuul_jobs/upload_utils.py @@ -47,7 +47,9 @@ try: except ImportError: from collections import Sequence -mimetypes.init() +if not mimetypes.inited: + # We don't want to reinit and override any previously added types. + mimetypes.init() mimetypes.add_type('text/plain', '.yaml') MAX_UPLOAD_THREADS = 24