【发布时间】:2023-03-19 13:50:02
【问题描述】:
背景
Puppet Newbie,试图在盒子上维护一些旧的 puppet 版本。目的是使用它的旧 plist 文件卸载旧程序并启动新程序。
问题
我在 .pp 文件中有以下代码
$old_launch_agent_path = "${home}/Library/LaunchAgents/com.company.program.plist"
exec {
'stop-old-program':
command => "/bin/launchctl unload ${old_launch_agent_path}",
refreshonly => true,
subscribe => [ File[$old_launch_agent_path] ];
}
Puppet 拒绝这样做:
错误:找不到依赖项 文件[/Users/execute/Library/LaunchAgents/com.company.program.plist] 对于 Exec [停止旧程序] 在 /private/tmp/mobile-puppet-manifests/puppet-manifests-test/modules/program/manifests/init.pp:51
更改在 git 分支上并正在应用 sudo puppet-apply -d -f -b mac-upgrade
ls -l /Users/executer/Library/LaunchAgents/com.company.program.plist`
-rw-r--r-- 1 executer staff 999 May 19 14:36 /Users/executer/Library/LaunchAgents/com.company.program.plist
【问题讨论】:
-
您是否在该目录中声明了标题为
/Users/executer/Library/LaunchAgents/com.company.program.plist的file资源? -
没有。我只是有变量声明,如图所示。
-
如果你指定从一个资源到另一个资源的依赖映射,那么这两个资源都必须存在于编译目录中。