diff --git a/roles/generate-zuul-manifest/library/generate_manifest.py b/roles/generate-zuul-manifest/library/generate_manifest.py index 81fed2c9a..5e1240a2a 100644 --- a/roles/generate-zuul-manifest/library/generate_manifest.py +++ b/roles/generate-zuul-manifest/library/generate_manifest.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# # Copyright 2019 Red Hat, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -131,7 +129,10 @@ def cli_main(): if __name__ == '__main__': - if sys.stdin.isatty(): - cli_main() - else: + # The zip/ansible/modules check is required for Ansible 5 because + # stdin may be a tty, but does not work in ansible 2.8. The tty + # check works on versions 2.8, 2.9, and 6. + if ('.zip/ansible/modules' in sys.argv[0] or not sys.stdin.isatty()): ansible_main() + else: + cli_main() diff --git a/roles/golangci-lint/library/golangci_lint_parse_output.py b/roles/golangci-lint/library/golangci_lint_parse_output.py index c1209630b..62efc0771 100644 --- a/roles/golangci-lint/library/golangci_lint_parse_output.py +++ b/roles/golangci-lint/library/golangci_lint_parse_output.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - # Copyright 2020 VEXXHOST, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/roles/htmlify-logs/library/htmlify.py b/roles/htmlify-logs/library/htmlify.py index 90629c7f8..f354a6b17 100644 --- a/roles/htmlify-logs/library/htmlify.py +++ b/roles/htmlify-logs/library/htmlify.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 # Copyright 2018 Red Hat, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -137,8 +136,10 @@ def cli_main(): if __name__ == '__main__': - - if sys.stdin.isatty(): - cli_main() - else: + # The zip/ansible/modules check is required for Ansible 5 because + # stdin may be a tty, but does not work in ansible 2.8. The tty + # check works on versions 2.8, 2.9, and 6. + if ('.zip/ansible/modules' in sys.argv[0] or not sys.stdin.isatty()): ansible_main() + else: + cli_main() diff --git a/roles/multi-node-known-hosts/library/generate_all_known_hosts.py b/roles/multi-node-known-hosts/library/generate_all_known_hosts.py index fb5961b52..3cfee8dad 100644 --- a/roles/multi-node-known-hosts/library/generate_all_known_hosts.py +++ b/roles/multi-node-known-hosts/library/generate_all_known_hosts.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - # Copyright (c) 2017 Red Hat # # This module is free software: you can redistribute it and/or modify diff --git a/roles/remove-zuul-sshkey/library/sshagent_remove_keys.py b/roles/remove-zuul-sshkey/library/sshagent_remove_keys.py index b4f6ea699..f26322059 100644 --- a/roles/remove-zuul-sshkey/library/sshagent_remove_keys.py +++ b/roles/remove-zuul-sshkey/library/sshagent_remove_keys.py @@ -120,7 +120,10 @@ def cli_main(): if __name__ == '__main__': - if sys.stdin.isatty(): - cli_main() - else: + # The zip/ansible/modules check is required for Ansible 5 because + # stdin may be a tty, but does not work in ansible 2.8. The tty + # check works on versions 2.8, 2.9, and 6. + if ('.zip/ansible/modules' in sys.argv[0] or not sys.stdin.isatty()): ansible_main() + else: + cli_main() diff --git a/roles/sphinx/library/sphinx_check_warning_is_error.py b/roles/sphinx/library/sphinx_check_warning_is_error.py index 275d8c0a7..c057dab67 100644 --- a/roles/sphinx/library/sphinx_check_warning_is_error.py +++ b/roles/sphinx/library/sphinx_check_warning_is_error.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - # Copyright (c) 2017 Red Hat # # This module is free software: you can redistribute it and/or modify diff --git a/roles/stage-output/library/stage_output_renames.py b/roles/stage-output/library/stage_output_renames.py index 7e318f1b3..1233a6f7f 100644 --- a/roles/stage-output/library/stage_output_renames.py +++ b/roles/stage-output/library/stage_output_renames.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at diff --git a/roles/stage-output/library/test_stage_output_renames.py b/roles/stage-output/library/test_stage_output_renames.py index 67b414e8e..7fba88cb8 100644 --- a/roles/stage-output/library/test_stage_output_renames.py +++ b/roles/stage-output/library/test_stage_output_renames.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at diff --git a/roles/test-upload-logs-swift/library/delete_container.py b/roles/test-upload-logs-swift/library/delete_container.py index 31e768ff7..6833936f5 100644 --- a/roles/test-upload-logs-swift/library/delete_container.py +++ b/roles/test-upload-logs-swift/library/delete_container.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# # Copyright 2019 Red Hat, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); you may 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 8a1b68abd..fc2220a56 100755 --- a/roles/test-upload-logs-swift/library/zuul_swift_upload.py +++ b/roles/test-upload-logs-swift/library/zuul_swift_upload.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# # Copyright 2014 Rackspace Australia # Copyright 2018 Red Hat, Inc # @@ -945,7 +943,10 @@ if __name__ == '__main__': requestsexceptions.squelch_warnings( requestsexceptions.InsecureRequestWarning) - if sys.stdin.isatty(): - cli_main() - else: + # The zip/ansible/modules check is required for Ansible 5 because + # stdin may be a tty, but does not work in ansible 2.8. The tty + # check works on versions 2.8, 2.9, and 6. + if ('.zip/ansible/modules' in sys.argv[0] or not sys.stdin.isatty()): ansible_main() + else: + cli_main() diff --git a/roles/tox/library/tox_install_sibling_packages.py b/roles/tox/library/tox_install_sibling_packages.py index fc78b69ea..86ad5eec2 100644 --- a/roles/tox/library/tox_install_sibling_packages.py +++ b/roles/tox/library/tox_install_sibling_packages.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - # Copyright (c) 2017 Red Hat # # This module is free software: you can redistribute it and/or modify diff --git a/roles/tox/library/tox_parse_output.py b/roles/tox/library/tox_parse_output.py index 3a6d77c44..af5ccc1e8 100644 --- a/roles/tox/library/tox_parse_output.py +++ b/roles/tox/library/tox_parse_output.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - # Copyright (c) 2018 Red Hat # # This module is free software: you can redistribute it and/or modify diff --git a/roles/upload-afs-roots/library/zuul_afs.py b/roles/upload-afs-roots/library/zuul_afs.py index 56f1e14b1..ccd67a50c 100644 --- a/roles/upload-afs-roots/library/zuul_afs.py +++ b/roles/upload-afs-roots/library/zuul_afs.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - # Copyright (c) 2016 Red Hat # # This module is free software: you can redistribute it and/or modify diff --git a/roles/upload-forge/library/forge_upload.py b/roles/upload-forge/library/forge_upload.py index d477c8ef6..424b8a1a1 100644 --- a/roles/upload-forge/library/forge_upload.py +++ b/roles/upload-forge/library/forge_upload.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - # Copyright (c) 2019 Binero # Author: Tobias Urdin # diff --git a/roles/upload-forge/library/test_forge_upload.py b/roles/upload-forge/library/test_forge_upload.py index d3b0d5de3..643c49422 100644 --- a/roles/upload-forge/library/test_forge_upload.py +++ b/roles/upload-forge/library/test_forge_upload.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - # Copyright (c) 2019 Binero # Author: Tobias Urdin # diff --git a/roles/upload-logs-base/library/delete_swift_container.py b/roles/upload-logs-base/library/delete_swift_container.py index 31e768ff7..6833936f5 100644 --- a/roles/upload-logs-base/library/delete_swift_container.py +++ b/roles/upload-logs-base/library/delete_swift_container.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# # Copyright 2019 Red Hat, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/roles/upload-logs-base/library/zuul_azure_upload.py b/roles/upload-logs-base/library/zuul_azure_upload.py index 61defaf24..cc36b494a 100644 --- a/roles/upload-logs-base/library/zuul_azure_upload.py +++ b/roles/upload-logs-base/library/zuul_azure_upload.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# # Copyright 2014 Rackspace Australia # Copyright 2018-2019 Red Hat, Inc # Copyright 2021 Acme Gating, LLC @@ -311,7 +309,10 @@ def cli_main(): if __name__ == '__main__': - if sys.stdin.isatty(): - cli_main() - else: + # The zip/ansible/modules check is required for Ansible 5 because + # stdin may be a tty, but does not work in ansible 2.8. The tty + # check works on versions 2.8, 2.9, and 6. + if ('.zip/ansible/modules' in sys.argv[0] or not sys.stdin.isatty()): ansible_main() + else: + cli_main() diff --git a/roles/upload-logs-base/library/zuul_google_storage_upload.py b/roles/upload-logs-base/library/zuul_google_storage_upload.py index 91bdf4e2f..443f8baab 100755 --- a/roles/upload-logs-base/library/zuul_google_storage_upload.py +++ b/roles/upload-logs-base/library/zuul_google_storage_upload.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# # Copyright 2014 Rackspace Australia # Copyright 2018-2019 Red Hat, Inc # @@ -332,7 +330,10 @@ def cli_main(): if __name__ == '__main__': - if sys.stdin.isatty(): - cli_main() - else: + # The zip/ansible/modules check is required for Ansible 5 because + # stdin may be a tty, but does not work in ansible 2.8. The tty + # check works on versions 2.8, 2.9, and 6. + if ('.zip/ansible/modules' in sys.argv[0] or not sys.stdin.isatty()): ansible_main() + else: + cli_main() diff --git a/roles/upload-logs-base/library/zuul_ibm_upload.py b/roles/upload-logs-base/library/zuul_ibm_upload.py index 07215fd30..fadc44a19 100755 --- a/roles/upload-logs-base/library/zuul_ibm_upload.py +++ b/roles/upload-logs-base/library/zuul_ibm_upload.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# # Copyright 2014 Rackspace Australia # Copyright 2018-2019 Red Hat, Inc # Copyright 2021-2022 Acme Gating, LLC @@ -362,7 +360,10 @@ def cli_main(): if __name__ == '__main__': - if sys.stdin.isatty(): - cli_main() - else: + # The zip/ansible/modules check is required for Ansible 5 because + # stdin may be a tty, but does not work in ansible 2.8. The tty + # check works on versions 2.8, 2.9, and 6. + if ('.zip/ansible/modules' in sys.argv[0] or not sys.stdin.isatty()): ansible_main() + else: + cli_main() diff --git a/roles/upload-logs-base/library/zuul_s3_upload.py b/roles/upload-logs-base/library/zuul_s3_upload.py index 89e383b20..1d0ffd8ff 100755 --- a/roles/upload-logs-base/library/zuul_s3_upload.py +++ b/roles/upload-logs-base/library/zuul_s3_upload.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# # Copyright 2014 Rackspace Australia # Copyright 2018 Red Hat, Inc # @@ -306,7 +304,10 @@ def cli_main(): if __name__ == '__main__': - if sys.stdin.isatty(): - cli_main() - else: + # The zip/ansible/modules check is required for Ansible 5 because + # stdin may be a tty, but does not work in ansible 2.8. The tty + # check works on versions 2.8, 2.9, and 6. + if ('.zip/ansible/modules' in sys.argv[0] or not sys.stdin.isatty()): ansible_main() + else: + cli_main() diff --git a/roles/upload-logs-base/library/zuul_swift_upload.py b/roles/upload-logs-base/library/zuul_swift_upload.py index 203f7db8f..d93998161 100755 --- a/roles/upload-logs-base/library/zuul_swift_upload.py +++ b/roles/upload-logs-base/library/zuul_swift_upload.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# # Copyright 2014 Rackspace Australia # Copyright 2018 Red Hat, Inc # @@ -418,7 +416,10 @@ if __name__ == '__main__': requestsexceptions.squelch_warnings( requestsexceptions.InsecureRequestWarning) - if sys.stdin.isatty(): - cli_main() - else: + # The zip/ansible/modules check is required for Ansible 5 because + # stdin may be a tty, but does not work in ansible 2.8. The tty + # check works on versions 2.8, 2.9, and 6. + if ('.zip/ansible/modules' in sys.argv[0] or not sys.stdin.isatty()): ansible_main() + else: + cli_main() diff --git a/roles/validate-host/library/zuul_debug_info.py b/roles/validate-host/library/zuul_debug_info.py index 405ea6d8a..3b6543c9c 100644 --- a/roles/validate-host/library/zuul_debug_info.py +++ b/roles/validate-host/library/zuul_debug_info.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - # Copyright (c) 2017 Red Hat # # This module is free software: you can redistribute it and/or modify diff --git a/roles/write-inventory/library/write_inventory.py b/roles/write-inventory/library/write_inventory.py index abe707639..8784a75b1 100755 --- a/roles/write-inventory/library/write_inventory.py +++ b/roles/write-inventory/library/write_inventory.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python3 -# # Copyright 2018 Red Hat, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); you may