From 3b5ac77a16ce75e7b11632c3692bca414a477ed1 Mon Sep 17 00:00:00 2001 From: Manuel Molina Cuberos Date: Mon, 14 Jan 2019 21:38:54 +0100 Subject: [PATCH] Preventing '/dev/tty not found' problems (#49950) * Preventing '/dev/tty not found' problems when ' apt_repository` calls GPG in order to import keys. --- changelogs/fragments/apt_repository-no-tty.yaml | 2 ++ lib/ansible/modules/packaging/os/apt_repository.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/apt_repository-no-tty.yaml diff --git a/changelogs/fragments/apt_repository-no-tty.yaml b/changelogs/fragments/apt_repository-no-tty.yaml new file mode 100644 index 0000000000..891ba78c42 --- /dev/null +++ b/changelogs/fragments/apt_repository-no-tty.yaml @@ -0,0 +1,2 @@ +bugfixes: + - apt_repository - do not require a tty to prevent errors parsing GPG keys (https://github.com/ansible/ansible/issues/49949) diff --git a/lib/ansible/modules/packaging/os/apt_repository.py b/lib/ansible/modules/packaging/os/apt_repository.py index 86f6322147..e6fa46a1f6 100644 --- a/lib/ansible/modules/packaging/os/apt_repository.py +++ b/lib/ansible/modules/packaging/os/apt_repository.py @@ -430,7 +430,7 @@ class UbuntuSourcesList(SourcesList): if self.add_ppa_signing_keys_callback is not None: info = self._get_ppa_info(ppa_owner, ppa_name) if not self._key_already_exists(info['signing_key_fingerprint']): - command = ['apt-key', 'adv', '--recv-keys', '--keyserver', 'hkp://keyserver.ubuntu.com:80', info['signing_key_fingerprint']] + command = ['apt-key', 'adv', '--recv-keys', '--no-tty', '--keyserver', 'hkp://keyserver.ubuntu.com:80', info['signing_key_fingerprint']] self.add_ppa_signing_keys_callback(command) file = file or self._suggest_filename('%s_%s' % (line, self.codename))