* Do not require TTY for 'apt-key' operations (#48580)
The 'gpg' command supports the '--no-tty' option, which disables any use
of a TTY during its execution. This parameter is sometimes required for
non-interactive operation to avoid any questions for the user.
The 'apt-key adv' command can pass additional parameters to the
underlying 'gpg' command. This patch adds the '--no-tty' option to avoid
issues with APT key imports when Ansible pipelining active, which
disables the use of a dedicated TTY.
(cherry picked from commit c7e22260355b4c08b6563fb98ebb6bf12dae5ff8)
* Add changelog fragment about 'apt_key' no TTY fix
(cherry picked from commit 7033e1dfc022fc09c006ac48c306810350308ce4)
... | ... |
@@ -213,9 +213,9 @@ def download_key(module, url): |
213 | 213 |
|
214 | 214 |
def import_key(module, keyring, keyserver, key_id): |
215 | 215 |
if keyring: |
216 |
- cmd = "%s --keyring %s adv --keyserver %s --recv %s" % (apt_key_bin, keyring, keyserver, key_id) |
|
216 |
+ cmd = "%s --keyring %s adv --no-tty --keyserver %s --recv %s" % (apt_key_bin, keyring, keyserver, key_id) |
|
217 | 217 |
else: |
218 |
- cmd = "%s adv --keyserver %s --recv %s" % (apt_key_bin, keyserver, key_id) |
|
218 |
+ cmd = "%s adv --no-tty --keyserver %s --recv %s" % (apt_key_bin, keyserver, key_id) |
|
219 | 219 |
for retry in range(5): |
220 | 220 |
lang_env = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C') |
221 | 221 |
(rc, out, err) = module.run_command(cmd, environ_update=lang_env) |