Preventing '/dev/tty not found' problems (#49950)

* Preventing '/dev/tty not found' problems when ' apt_repository` calls GPG in order to import keys.
This commit is contained in:
Manuel Molina Cuberos 2019-01-14 21:38:54 +01:00 committed by Sam Doran
parent 91522bd9c4
commit 3b5ac77a16
2 changed files with 3 additions and 1 deletions

View file

@ -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)

View file

@ -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))