summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Mayer <eugen.mayer@kontextwork.de>2018-11-11 21:30:45 +0100
committerem <eugen.mayer@kontextwork.de>2018-11-12 08:24:06 +0100
commitb7a78c23307a3484405e082f5fc2b6363169a566 (patch)
treeb1cd14ef2460bfa53c8a7e2f9dcc16809500af1f
parenta97e5da2e9dc3218da8df80eb905013effc85ca9 (diff)
downloadchef-b7a78c23307a3484405e082f5fc2b6363169a566.tar.gz
use --no-tty during apt-keys for gpg
Signed-off-by: Eugen Mayer <eugen.mayer@kontextwork.de> Since debian 9.4+ (and probably other distros having a similar GPG path level) gpg complains about the missing tty - we use this to tell gpg that no tty will be available. I cannot think about a way how this should break anything - we simply have no tty and never had here. All we do is tell gpg upfront before it fails doing silly checks on it. Thinking twice, if gpg right now has tried to get tty it would have failed anyway, e.g. for ncurses questions or such. I think this strategy should be rather bullet proof. I tested this using `vagrant ssh` without `-i` and it worked, withtout `--no-tty` it was broken as expected
-rw-r--r--lib/chef/provider/apt_repository.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/provider/apt_repository.rb b/lib/chef/provider/apt_repository.rb
index 2062ac5a42..45cc40508c 100644
--- a/lib/chef/provider/apt_repository.rb
+++ b/lib/chef/provider/apt_repository.rb
@@ -225,7 +225,7 @@ class Chef
#
# @return [String] the full apt-key command to run
def keyserver_install_cmd(key, keyserver)
- cmd = "apt-key adv --recv"
+ cmd = "apt-key adv --no-tty --recv"
cmd << " --keyserver-options http-proxy=#{new_resource.key_proxy}" if new_resource.key_proxy
cmd << " --keyserver "
cmd << if keyserver.start_with?("hkp://")