Chef策略组设置:Policyfile不支持在json数据中设置run_list [英] chef policy group setting: Policyfile does not support setting the run_list in json data

查看:129
本文介绍了Chef策略组设置:Policyfile不支持在json数据中设置run_list的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照以下文章
中的步骤操作,并且遇到了以下错误

I have followed the steps in below article I am getting following error


意外错误:
- ---------------- Chef :: PolicyBuilder :: Policyfile :: UnsupportedFeature:Policyfile不支持在json数据中设置run_list。

Unexpected Error: ----------------- Chef::PolicyBuilder::Policyfile::UnsupportedFeature: Policyfile does not support setting the run_list in json data.

这是我遵循的步骤

include_recipe 'basecookbook::default'

directory 'C:/ProgramData/ChefFiles' do
   inherits true
   action :create 
end

更新了Cooksbooks元数据以指定对基础的依赖性

Updated cooksbooks metadata to specify dependency on base

策略文件如下
cookbooks / test01 / Policyfile.rb
将策略文件更改为

The policy file is as follows cookbooks/test01/Policyfile.rb Changed the policy file to

name 'test01'
    run_list 'test01::default'
    cookbook 'test01', path: '.'
    cookbook 'basecookbook', path: '../basecookbook'

policyfile.lock.json文件如下

the policyfile.lock.json file is as follows

"name": "test01",
"run_list": [
  "recipe[test01::default]"
],
"included_policy_locks": [
],
"cookbook_locks": {
  "test01": {

我将策略推送到Chef并将节点设置为策略组和策略

I pushed the policy to chef and set the node to policy group and policy

chef push test01 .\cookbooks\test01\Policyfile.lock.json
knife node policy set NodeName 'test01' 'test01'

在节点上运行Chef客户端时,出现以下错误

When I run the chef client on the node, I am getting following error


意外错误:Chef :: PolicyBuilder :: Policyfile :: UnsupportedFeature:
Policyfile不支持在json数据中设置run_list 。

Unexpected Error: Chef::PolicyBuilder::Policyfile::UnsupportedFeature: Policyfile does not support setting the run_list in json data.


推荐答案

您没有显示如何在节点上运行Chef-client命令。您可能正在做的是在包含 run_list 命令的JSON文件中包含 -j 选项。该错误消息中引用的JSON是 -j 参数,与 PolicyFile.lock.json 内容。要么,要么直接在命令行上使用 -r 选项指定一个run_list(错误消息可能会引起误解,但这肯定是指命令行参数)

You do not show how you are running the chef-client command on the node. What you are probably doing is including a -j option to a JSON file which contains a run_list command. The JSON being referred to in that error message is that -j argument, and has nothing to do with the PolicyFile.lock.json contents. Either that or you may be specifying a run_list directly with a -r option on the command line (and the error message might be slightly misleading -- but it is certainly referring to the command line arguments)

在进行基于PolicyFile的部署时,客户端无法通过设计来生成食谱的依赖项,因此不支持将任意run_lists传递给客户端,并且run_list必须来自PolicyFile.lock.json和仅该文件(通过 chef push 被推送到服务器后)。

When doing PolicyFile-based deployment the client has no capability to do dependency generation of cookbooks by design, so arbitrary run_lists being passed to the client is not supported, and the run_list has to come from the PolicyFile.lock.json and only that file (after being pushed up to the server with chef push).

这篇关于Chef策略组设置:Policyfile不支持在json数据中设置run_list的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆