summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Mayer <eugen.mayer@kontextwork.de>2018-11-11 21:30:45 +0100
committerTim Smith <tsmith@chef.io>2018-11-20 14:13:31 -0800
commitbb6bddaaa96713ff8663d472258e0ce205ff47cf (patch)
tree79311f014514a7327f3f0f9caee06a383b814476
parentabdfa74d7f34114a3584efa6f8aabe337be8d80f (diff)
downloadchef-bb6bddaaa96713ff8663d472258e0ce205ff47cf.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://")