Клиент chef, использующий файл политики: не удалось найти рецепт по умолчанию для поваренной книги
Я использую Chef с открытым исходным кодом версии 13.6.4 и застрял на проблеме, которую не могу решить с помощью Policyfile. Я создал один простой файл политики, основанный на простейшей из возможных кулинарной книги, приведенной ниже (cookbooks\test_prospero\default.rb)
root_install_path = 'e:\\prospero'.freeze
node_fqdn = node['fqdn'].to_s.downcase
Chef::Log.info "Detected node : #{node_fqdn}"
Policyfile.rb - это:
name "test_prospero"
default_source :chef_repo, '../'
run_list "test_prospero::default"
cookbook "test_prospero"
Я установил файл политики со следующим результатом:
Microsoft Windows [Version 10.0.16299.192]
(c) 2017 Microsoft Corporation. All rights reserved.
c:\chef-data\chef-repo\policies>chef install
Building policy test_prospero
Expanded run list: recipe[test_prospero::default]
Caching Cookbooks...
Installing test_prospero 0.1.2
Lockfile written to c:/chef-data/chef-repo/policies/Policyfile.lock.json
Policy revision id: 4e4b44089fe5a4ccd6656d419153e6d642d21c3392be2f74126b69f477c59118
И толкнул его на сервер:
Uploading policy to policy group build-group
Using test_prospero 0.1.2 (8232678b)
c: \ chef-data \ chef-repo \icies>chef show-policy
test_prospero
=============
* build-group: 4e4b44089f
После запуска на одном уже загруженном узле со следующей конфигурацией client.rb:
chef_server_url "https://chef.sage.ch/organizations/sage-system"
validation_client_name "sage-system-validator"
file_cache_path "c:/chef/cache"
file_backup_path "c:/chef/backup"
cache_options ({:path => "c:/chef/cache/checksums", :skip_expires => true})
node_name "Prospero-9.9.9-RELEASE-Deploy-S1VW1730"
log_level :info
log_location STDOUT
trusted_certs_dir "c:/chef/trusted_certs"
policy_name "test_prospero"
policy_group "build-group"
use_policyfile true
policy_document_native_api true
current_version = Gem::Version.new(Chef::VERSION)
unless Gem::Requirement.new(">= 12.7").satisfied_by?(current_version)
puts("!" * 80)
puts(<<-MESSAGE)
This Chef Repo requires features introduced in Chef 12.7, but you are using
Chef #{Chef::VERSION}. Please upgrade to Chef 12.7 or later.
MESSAGE
puts("!" * 80)
exit!(1)
end
Запустив chef-client в командной строке, я получил следующую ошибку:
c:\>chef-client
Starting Chef Client, version 13.6.4
[2018-01-29T16:48:48+01:00] INFO: *** Chef 13.6.4 ***
[2018-01-29T16:48:48+01:00] INFO: Platform: x64-mingw32
[2018-01-29T16:48:48+01:00] INFO: Chef-client pid: 3288
[2018-01-29T16:48:48+01:00] INFO: The plugin path C:\chef\ohai\plugins does not exist. Skipping...
Using policy 'test_prospero' at revision '4e4b44089fe5a4ccd6656d419153e6d642d21c3392be2f74126b69f477c59118'
[2018-01-29T16:48:55+01:00] INFO: Run List is [["recipe[test_prospero::default]"]]
[2018-01-29T16:48:55+01:00] INFO: Run List expands to [test_prospero::default@0.1.2 (8232678)]
[2018-01-29T16:48:55+01:00] INFO: Starting Chef Run for Prospero-9.9.9-RELEASE-Deploy-S1VW1730
[2018-01-29T16:48:55+01:00] INFO: Running start handlers
[2018-01-29T16:48:55+01:00] INFO: Start handlers complete.
[2018-01-29T16:48:55+01:00] INFO: Error while reporting run start to Data Collector. URL: https://chef.sage.ch/organizations/sage-system/data-collector Exception: 404 -- 404 "Not Found" (This is n
al if you do not have Chef Automate)
resolving cookbooks for run list: ["test_prospero::default@0.1.2 (8232678)"]
[2018-01-29T16:48:55+01:00] INFO: Loading cookbooks [test_prospero@0.1.2]
Synchronizing Cookbooks:
Installing Cookbook Gems:
Compiling Cookbooks...
================================================================================
Recipe Compile Error
================================================================================
Chef::Exceptions::RecipeNotFound
--------------------------------
could not find recipe default for cookbook test_prospero
System Info:
------------
chef_version=13.6.4
platform=windows
platform_version=6.3.9600
ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x64-mingw32]
program_name=C:/opscode/chef/bin/chef-client
executable=C:/opscode/chef/bin/chef-client
Running handlers:
[2018-01-29T16:48:55+01:00] ERROR: Running exception handlers
Running handlers complete
[2018-01-29T16:48:55+01:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 06 seconds
[2018-01-29T16:48:55+01:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
[2018-01-29T16:48:55+01:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-01-29T16:48:55+01:00] FATAL: Chef::Exceptions::RecipeNotFound: could not find recipe default for cookbook test_prospero
Я попробовал различные конфигурации default_source, а также запустил его с нулем chef, используя экспорт, без проблем, прочитал документацию и другие сайты (например, YoloVer), и, похоже, ни у кого не было такой ситуации.
Одна и та же кулинарная книга, запущенная без использования policyfile, не выдает никакой ошибки!
c:\>chef-client -o test_prospero
Starting Chef Client, version 13.6.4
[2018-01-29T17:19:55+01:00] INFO: *** Chef 13.6.4 ***
[2018-01-29T17:19:55+01:00] INFO: Platform: x64-mingw32
[2018-01-29T17:19:55+01:00] INFO: Chef-client pid: 816
[2018-01-29T17:19:55+01:00] INFO: The plugin path C:\chef\ohai\plugins does not exist. Skipping...
[2018-01-29T17:20:01+01:00] WARN: Run List override has been provided.
[2018-01-29T17:20:01+01:00] WARN: Original Run List: []
[2018-01-29T17:20:01+01:00] WARN: Overridden Run List: [recipe[test_prospero]]
[2018-01-29T17:20:01+01:00] INFO: Run List is [recipe[test_prospero]]
[2018-01-29T17:20:01+01:00] INFO: Run List expands to [test_prospero]
[2018-01-29T17:20:01+01:00] INFO: Starting Chef Run for Prospero-9.9.9-RELEASE-Deploy-S1VW1730
[2018-01-29T17:20:01+01:00] INFO: Running start handlers
[2018-01-29T17:20:01+01:00] INFO: Start handlers complete.
[2018-01-29T17:20:02+01:00] INFO: Error while reporting run start to Data Collector. URL: https://chef.sage.ch/organizations/sage-system/data-collector Exception: 404 -- 404 "Not Found" (This is norm
al if you do not have Chef Automate)
resolving cookbooks for run list: ["test_prospero"]
[2018-01-29T17:20:02+01:00] INFO: Loading cookbooks [test_prospero@0.1.2]
[2018-01-29T17:20:02+01:00] INFO: Skipping removal of obsoleted cookbooks from the cache
Synchronizing Cookbooks:
[2018-01-29T17:20:02+01:00] INFO: Storing updated cookbooks/test_prospero/metadata.rb in the cache.
[2018-01-29T17:20:02+01:00] INFO: Storing updated cookbooks/test_prospero/README.md in the cache.
[2018-01-29T17:20:02+01:00] INFO: Storing updated cookbooks/test_prospero/chefignore in the cache.
[2018-01-29T17:20:02+01:00] INFO: Storing updated cookbooks/test_prospero/recipes/default.rb in the cache.
- test_prospero (0.1.2)
Installing Cookbook Gems:
Compiling Cookbooks...
[2018-01-29T17:20:02+01:00] INFO: Detected node : s1vw1730.sage.ch
Converging 0 resources
[2018-01-29T17:20:02+01:00] WARN: Skipping final node save because override_runlist was given
[2018-01-29T17:20:02+01:00] INFO: Chef Run complete in 0.896052 seconds
[2018-01-29T17:20:02+01:00] INFO: Skipping removal of unused files from the cache
Running handlers:
[2018-01-29T17:20:02+01:00] INFO: Running report handlers
Running handlers complete
[2018-01-29T17:20:02+01:00] INFO: Report handlers complete
Chef Client finished, 0/0 resources updated in 07 seconds
У вас есть ключ или решение этой проблемы? Большое спасибо за вашу помощь.
1 ответ
Рецепты должны быть в recipes/
подпапка в кулинарной книге, так cookbooks\test_prospero\recipes\default.rb
,