Fix AttributeError when providing file via --conn-password-file (#76534)

Fixes #76530
pull/76568/head
Martin Krizek 3 years ago committed by GitHub
parent 8a562ea14a
commit ac2bdd6834
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- Fix ``AttributeError`` when providing password file via ``--connection-password-file`` (https://github.com/ansible/ansible/issues/76530)

@ -52,6 +52,7 @@ from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError
from ansible.inventory.manager import InventoryManager from ansible.inventory.manager import InventoryManager
from ansible.module_utils.six import string_types from ansible.module_utils.six import string_types
from ansible.module_utils._text import to_bytes, to_text from ansible.module_utils._text import to_bytes, to_text
from ansible.module_utils.common.file import is_executable
from ansible.parsing.dataloader import DataLoader from ansible.parsing.dataloader import DataLoader
from ansible.parsing.vault import PromptVaultSecret, get_file_vault_secret from ansible.parsing.vault import PromptVaultSecret, get_file_vault_secret
from ansible.plugins.loader import add_all_plugin_dirs from ansible.plugins.loader import add_all_plugin_dirs
@ -540,7 +541,7 @@ class CLI(ABC):
elif not os.path.exists(b_pwd_file): elif not os.path.exists(b_pwd_file):
raise AnsibleError("The password file %s was not found" % pwd_file) raise AnsibleError("The password file %s was not found" % pwd_file)
elif os.path.is_executable(b_pwd_file): elif is_executable(b_pwd_file):
display.vvvv(u'The password file %s is a script.' % to_text(pwd_file)) display.vvvv(u'The password file %s is a script.' % to_text(pwd_file))
cmd = [b_pwd_file] cmd = [b_pwd_file]

Loading…
Cancel
Save