嘗試使用puppet在rpi上創建自動啓動目錄。它只能在mkdir
的位置不存在。如何檢查傀儡中是否存在目錄
下面是當前的代碼:
exec { "mkdir_autostart":
command => "mkdir /home/pi/.config/autostart",
unless => "[ -d /home/pi/.config/autostart ]",
path => "/usr/local/bin/:/bin/",
}
這裏是我所得到的:
err: Failed to apply catalog: Parameter unless failed on Exec[mkdir_autostart]:
'[ -d /home/pi/.config/autostart ]' is not qualified and no path was specified.
Please qualify the command or specify a path.
與onlyif聲明也嘗試過,但產生同樣的錯誤。我究竟做錯了什麼?
編輯:
添加的路徑(path => "/usr/local/bin/:/bin/",
),現在得到:
err: /Stage[main]/auto::Sign/Exec[mkdir_autostart]: Could not evaluate: Could not find command '['
可能很好鏈接到[文件 - >確保文檔](http://docs.puppetlabs.com/references/latest/type.html#file-attribute-ensure),值得注意的是這是冪等的。 – steveax