Puppet 如何修复';无法分析环境产品';错误?

Puppet 如何修复';无法分析环境产品';错误?,puppet,Puppet,这是我的小木偶片段:当我执行这个片段时,我得到了以下错误: 错误:无法分析环境产品:无法在/home/test中匹配。pp:8 有人能帮忙指出一下吗?关于错误无法为环境产品解析,您可以查看url 对于疑难解答和验证清单(*.pp)文件,您可以运行: puppet parser validate test.pp 或者您也可以安装puppet lint()以获取帮助 第三,找出是否有隐藏的人物制造麻烦 错误: 错误:无法分析生产环境 始终后跟另一个错误,例如: “x”处的语法错误:清单处应为“

这是我的小木偶片段:当我执行这个片段时,我得到了以下错误:

错误:无法分析环境产品:无法在/home/test中匹配。pp:8


有人能帮忙指出一下吗?

关于错误
无法为环境产品解析
,您可以查看url

对于疑难解答和验证清单(*.pp)文件,您可以运行:

puppet parser validate test.pp
或者您也可以安装
puppet lint
()以获取帮助

第三,找出是否有隐藏的人物制造麻烦

错误:

错误:无法分析生产环境

始终后跟另一个错误,例如:

  • “x”处的语法错误:清单处应为“x”。pp:123

    这可能表示缺少逗号

  • 无法在清单上匹配。pp:123

    这可能表示缺少一个括号


因此,您应该检查报告错误的特定行的文件,查看前一行是否缺少任何逗号或括号(这是此类错误最常见的错误).

还应检查Puppet报告错误点之前是否缺少引号。

当主机在nodes.pp文件中有重复条目时,也会出现此错误。
如果文件中有多个主机,请确保一个主机有一个条目。

错误与粘贴的代码无关,也许您可以尝试运行
puppet apply--environment=production
我使用
puppet parser validate test.pp
检查代码,不会报告任何错误。您是否在此处粘贴所有代码?我在我的环境中复制/粘贴代码,并使用validate运行,没有收到任何错误。pp文件中是否有隐藏字符?能否删除第5行和第10行的
[
]
,然后重试?
Syntax Hints

Watch out for these common errors:

Don’t forget commas and colons! Forgetting them causes errors like Could not parse for environment production: Syntax error at 'mode'; expected '}' at /root/manifests/1.file.pp:6 on node learn.localdomain.

Capitalization matters! The resource type and the attribute names should always be lowercase.
The values used for titles and attribute values will usually be strings, which you should usually quote. Read more about Puppet’s data types here.

There are two kinds of quotes in Puppet: single (') and double ("). The main difference is that double quotes let you interpolate $variables, which we cover in another lesson.

Attribute names (like path, ensure, etc.) are special keywords, not strings. They shouldn’t be quoted.

Also, note that Puppet lets you use whatever whitespace makes your manifests more readable. We suggest visually lining up the => arrows, because it makes it easier to understand a manifest at a glance. (The Vim plugins on the Learning Puppet VM will do this automatically as you type.)
puppet parser validate test.pp