0

我正在研究一些chefspec教程并遇到了一个问题。

我的代码库中有两本食谱,其中食谱 B 是其他食谱使用的常用方法/库的集合。CookbookA 依赖于 CookbookB 并已将其定义为元数据。

配方按预期运行并达到预期结果。

chef exec rspec spec在 cookbookA上运行时,我收到此错误:

    C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-4.3.5/lib/berkshelf/resolver.rb:85:in `rescue in resolve': Unable to satisfy constraints on packag
e sc_common, which does not exist, due to solution constraint (steve-solr = 0.1.1). Solution constraints that may result in a constraint on sc_common: [(steve-s
olr = 0.1.1) -> (sc_common >= 0.0.0)] (Berkshelf::NoSolutionError)
Missing artifacts: sc_common
Demand that cannot be met: (steve-solr = 0.1.1)
Unable to find a solution for demands: steve-solr (0.1.1)
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-4.3.5/lib/berkshelf/resolver.rb:75:in `resolve'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-4.3.5/lib/berkshelf/installer.rb:175:in `install_from_universe'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-4.3.5/lib/berkshelf/installer.rb:39:in `run'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-4.3.5/lib/berkshelf/berksfile.rb:421:in `install'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-4.3.5/lib/berkshelf/berksfile.rb:630:in `block in vendor'
        from C:/opscode/chefdk/embedded/lib/ruby/2.1.0/tmpdir.rb:88:in `mktmpdir'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-4.3.5/lib/berkshelf/berksfile.rb:628:in `vendor'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chefspec-4.7.0/lib/chefspec/berkshelf.rb:39:in `block in setup!'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/shell/basic.rb:20:in `mute'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chefspec-4.7.0/lib/chefspec/berkshelf.rb:35:in `setup!'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chefspec-4.7.0/lib/chefspec/berkshelf.rb:61:in `block (2 levels) in <top (required)>'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:425:in `instance_exec'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:425:in `instance_exec'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/hooks.rb:357:in `run'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1724:in `block in run_hooks_with'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1724:in `each'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1724:in `run_hooks_with'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1679:in `with_suite_hooks'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:118:in `block in run_specs'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/reporter.rb:77:in `report'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:117:in `run_specs'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:93:in `run'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:78:in `run'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:45:in `invoke'
        from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rspec-core-3.4.4/exe/rspec:4:in `<top (required)>'
        from C:/Users/Steve/AppData/Local/chefdk/gem/ruby/2.1.0/bin/rspec:22:in `load'
        from C:/Users/Steve/AppData/Local/chefdk/gem/ruby/2.1.0/bin/rspec:22:in `<main>'
PS C:\Users\steve\Dev\steve-solr-restartcores\chef-repos\chef-test\cookbooks\steve-solr> chef exec rspec spec
C:/opscode/chefdk/embedded/lib/ruby/2.1.0/i386-mingw32/dl.so: warning: already initialized constant DL::RUBY_FREE
C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.1.1/lib/net/ssh/authentication/pageant.rb:16: warning: previous definition of RUBY_FREE was here
DL is deprecated, please use Fiddle

到目前为止,我的 google-fu 让我失望了,感谢您提供任何帮助。谢谢。

4

1 回答 1

2

sc_common从 Berkshelf 找不到这本食谱。这不应该与 ChefSpec 具体相关,如果你运行berks install你应该看到同样的错误。如果您的默认来源中没有该食谱,您可能需要为该食谱指定一个明确的来源。

于 2017-06-26T20:17:53.467 回答