木偶(err):找到1个依赖周期+ Cycles.dot文件

时间:2018-08-16 21:25:19

标签: puppet devops

我正在运行此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";
     }

根据此代码,我想:

  • 停止tomcat服务
  • 清理我提到的特定文件
  • 将文件从源文件复制到我的目录($ bl_deployment_folder)

不幸的是,当我运行它时,它引发了此错误:

+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]" }

我该怎么做才能解决此问题?

感谢您的帮助!

谢谢!

1 个答案:

答案 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

在这种情况下,我建议您删除依赖关系,让整洁的程序在自己的时间内运行。

我还要指出,这个木偶清单感觉很程序化。木偶确实非常不擅长“先执行,然后执行,然后执行”类型的脚本。它希望以声明式的方式“告诉我最终状态是什么,我将对其进行整理”。尝试以程序方式使用它很痛苦,不建议这样做。