通过 aws cookbook 7.2.1 安装 aws-sigv4 (1.0.2) 时出错

Error installing aws-sigv4 (1.0.2) via aws cookbook 7.2.1

我正在尝试使用 aws cookbook 版本 7.2.1,以便我可以使用 cloudformation_stack 资源的 named_iam_capability 选项。这样我就可以为启动的实例分配一个 IAM 角色。这是 运行 Ubuntu 14.04 LTS with Chef 12.19.36 但我收到以下错误。

有什么办法可以解决这个错误吗?

31-Oct-2017 10:47:14    [2017-10-30T23:47:14+00:00] ERROR: Running exception handlers
31-Oct-2017 10:47:14    [2017-10-30T23:47:14+00:00] ERROR: Exception handlers complete
31-Oct-2017 10:47:14    [2017-10-30T23:47:14+00:00] FATAL: Stacktrace dumped to /home/bamboo/.chef/cache/chef-stacktrace.out
31-Oct-2017 10:47:14    [2017-10-30T23:47:14+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
31-Oct-2017 10:47:14    [2017-10-30T23:47:14+00:00] ERROR: Expected process to exit with [0], but received '5'
31-Oct-2017 10:47:14    ---- Begin output of bundle install ----
31-Oct-2017 10:47:14    STDOUT: Fetching gem metadata from https://rubygems.org/
31-Oct-2017 10:47:14    Fetching version metadata from https://rubygems.org/
31-Oct-2017 10:47:14    Resolving dependencies...
31-Oct-2017 10:47:14    
31-Oct-2017 10:47:14    Bundler::GemspecError: Could not read gem at /opt/chefdk/embedded/lib/ruby/gems/2.3.0/cache/aws-sigv4-1.0.2.gem. It may be corrupted.
31-Oct-2017 10:47:14    Using jmespath 1.3.1
31-Oct-2017 10:47:14    Using bundler 1.12.5
31-Oct-2017 10:47:14    An error occurred while installing aws-sigv4 (1.0.2), and Bundler cannot
31-Oct-2017 10:47:14    continue.
31-Oct-2017 10:47:14    Make sure that `gem install aws-sigv4 -v '1.0.2'` succeeds before bundling.
31-Oct-2017 10:47:14    STDERR: sudo: no tty present and no askpass program specified
31-Oct-2017 10:47:14    sudo: no tty present and no askpass program specified
31-Oct-2017 10:47:14    ---- End output of bundle install ----
31-Oct-2017 10:47:14    Ran bundle install returned 5
31-Oct-2017 10:47:14    [2017-10-30T23:47:14+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

您需要 运行 chef-client 作为 root 才能正常使用某些功能,包括 gem 安装。在大多数 Linux-y 系统上使用 sudo chef-client