我正在运行此cmd:
puppet apply --environment split4 -l C:\Puppet_logs\log.log C:\ProgramData\PuppetLabs\code\environments\split4\manifests\bl.pp
这是正在运行的代码:
service {
$name :
ensure => stopped,
enable => true;
} ->
tidy { $bl_deployment_folder :
rmdirs => true,
recurse => 1,
# notify => Service[$name],
matches => ['*.dll','*.jar','*.exe','*.test','*.utd'];
# subscribe => File[$bl_deployment_folder];
} ->
file {
#set the BL run time folder and update it according to the source folder
$bl_deployment_folder :
ensure => directory,
source => $bl_source_folder,
recurse => true,
ignore => "AlisConfig.ini";
}
根据此代码,我想:
不幸的是,当我运行它时,它引发了此错误:
+0300 Puppet (err): Found 1 dependency cycle:
(File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll] => Tidy[\\my-server\C$\BL\ALIS_PUPPET] => File[\\my-server\C$\BL\ALIS_PUPPET] => File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll])
Cycle graph written to C:/ProgramData/PuppetLabs/puppet/cache/state/graphs/cycles.dot.
Puppet (err): Failed to apply catalog: One or more resource dependency cycles detected in graph
circles.dot文件已附加:
digraph Resource_Cycles { label = "Resource Cycles" "File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll]" "File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll]"
-> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[//my-server/C$/BL/ALIS_PUPPET/obj_data_client.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" "File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]"
-> "File[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[//my-server/C$/BL/ALIS_PUPPET/obj_data_policy.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" "File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[\\my-server\C$\BL\ALIS_PUPPET]"
-> "File[//my-server/C$/BL/ALIS_PUPPET/obj_exceptions.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" "File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[//my-server/C$/BL/ALIS_PUPPET/obj_metadata.dll]"
-> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" "File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[//my-server/C$/BL/ALIS_PUPPET/obj_metadata_product.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]"
"File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[//my-server/C$/BL/ALIS_PUPPET/obj_services.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" "File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll]"
-> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[//my-server/C$/BL/ALIS_PUPPET/objects.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" "File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]"
-> "File[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[//my-server/C$/BL/ALIS_PUPPET/xerces-c_2_6.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" "File[//my-server/C$/BL/ALIS_PUPPET/AAppData.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" -> "File[\\my-server\C$\BL\ALIS_PUPPET]"
-> "File[//my-server/C$/BL/ALIS_PUPPET/xmltools.dll]" -> "Tidy[\\my-server\C$\BL\ALIS_PUPPET]" }
我该怎么做才能解决此问题?
感谢您的帮助!
谢谢!
答案 0 :(得分:0)
这里的问题是$bl_deployment_folder
中的tidy
resource deletes files by creating file
resources。这些file
资源中的每一个都将自动需要其父目录file
资源,在这种情况下为$bl_deployment_folder
。 ->
和目录tidy
之间的file
意味着$bl_deployment_folder
需要其中的tidy
file
资源,因此您有一个循环
不幸的是,结果是您不能在同一目录中拥有file
要求tidy
。
在这种情况下,我建议您删除依赖关系,让整洁的程序在自己的时间内运行。
我还要指出,这个木偶清单感觉很程序化。木偶确实非常不擅长“先执行,然后执行,然后执行”类型的脚本。它希望以声明式的方式“告诉我最终状态是什么,我将对其进行整理”。尝试以程序方式使用它很痛苦,不建议这样做。