首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行exec时的inspec-aws错误

运行exec时的inspec-aws错误
EN

Stack Overflow用户
提问于 2021-04-25 22:09:53
回答 1查看 253关注 0票数 1

你知道我做错了什么吗?我安装了chef工作站:

代码语言:javascript
复制
$ chef -v
Chef Workstation version: 21.4.365
Chef Infra Client version: 16.12.3
Chef InSpec version: 4.29.3
Chef CLI version: 4.0.0
Chef Habitat version: 1.6.288
Test Kitchen version: 2.11.2
Cookstyle version: 7.10.0

安装了aws cli,我已经设置了一个正在工作的默认凭据(通过部署一些tf代码来确认)。

创建一个文件夹并运行

代码语言:javascript
复制
inspec init profile --platform aws tftest

2.7.3安装aws(使用rbenv)并捆绑以安装sdk

Gemfile

代码语言:javascript
复制
source 'https://rubygems.org/' do
    gem 'aws-sdk', '~> 3'
end

然后我跑:

代码语言:javascript
复制
inspec exec tftest -t aws://

并获得以下错误:

代码语言:javascript
复制
$ inspec exec tftest -t aws://
Traceback (most recent call last):
        30: from /usr/bin/inspec:354:in `<main>'
        29: from /usr/bin/inspec:354:in `load'
        28: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-bin-4.29.3/bin/inspec:11:in `<top (required)>'
        27: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/base_cli.rb:35:in `start'
        26: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'
        25: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        24: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        23: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        22: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/cli.rb:281:in `exec'
        21: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/runner.rb:135:in `run'
        20: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/runner.rb:101:in `load'
        19: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/runner.rb:101:in `each'
        18: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/runner.rb:107:in `block in load'
        17: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/profile.rb:259:in `load_libraries'
        16: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/profile.rb:259:in `each_with_index'
        15: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/profile.rb:259:in `each'
        14: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/profile.rb:278:in `block in load_libraries'
        13: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/profile.rb:285:in `load_libraries'
        12: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/profile_context.rb:143:in `load_libraries'
        11: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/profile_context.rb:143:in `each'
        10: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/profile_context.rb:144:in `block in load_libraries'
         9: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/profile_context.rb:159:in `load_library_file'
         8: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/profile_context.rb:170:in `load_with_context'
         7: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/profile_context.rb:170:in `instance_eval'
         6: from libraries/aws_alb.rb:3:in `load_with_context'
         5: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/dsl_shared.rb:47:in `require'
         4: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/dsl_shared.rb:47:in `eval'
         3: from libraries/aws_backend.rb:13:in `create'
         2: from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-4.29.3/lib/inspec/dsl_shared.rb:33:in `require'
         1: from /opt/chef-workstation/embedded/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
/opt/chef-workstation/embedded/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require': cannot load such file -- aws-sdk-ecrpublic (LoadError)

我尝试更新我的Gemfile以包含gem‘aws ecrpublic’,但是我仍然得到相同的错误。

文件夹布局是:

代码语言:javascript
复制
.
├── Gemfile
├── Gemfile.lock
├── README.md
├── .ruby-version
└── tftest
    ├── controls
    │   └── example.rb
    ├── inspec.lock
    ├── inspec.yml
    └── README.md

你知道怎么回事吗?

EN

回答 1

Stack Overflow用户

发布于 2022-02-11 11:14:27

这是一个很晚的回答这个问题,但inspec有依赖列车-aws,需要安装。https://github.com/inspec/train-aws

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67258715

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档