gpg called without no-tty
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Unassigned |
Bug Description
I am running cloud-init on a libvirt/virsh with this image: https:/
the relevant lines are:
apt:
sources:
docker:
source: 'deb [arch=amd64] https:/
keyserver: keyserver.
keyid: 0EBFCD88
sorry for not attaching any bugs, but the triggered command just does not find "/dev/tty")
The gpg wrapper should have the "no-tty" argument for receiving key at least on debian systems.
Otherwise cloudinit fails when specifying key-ids on debian cloudimages (with manually added dirmngr and apt-transport-
I would naively propose the following patch:
diff --git a/cloudinit/gpg.py b/cloudinit/gpg.py
index 7fe17a2..21d598e 100644
--- a/cloudinit/gpg.py
+++ b/cloudinit/gpg.py
@@ -42,7 +42,7 @@ def recv_key(key, keyserver, retries=(1, 1)):
@param retries: an iterable of sleep lengths for retries.
LOG.
- cmd = ["gpg", "--keyserver=%s" % keyserver, "--recv-keys", key]
+ cmd = ["gpg", "--no-tty", "--keyserver=%s" % keyserver, "--recv-keys", key]
if retries is None:
retries = []
trynum = 0
BR
Till
summary: |
- no-tty + gpg called without no-tty |
Hi, thanks for reporting the bug. I suspect cloud-init can check if there's a tty and if not append the --no-tty flag.