所以我有一個單行bash命令來檢查一個目錄是否存在。如果確實如此,它會拉動,否則會克隆存儲庫。我在我的Windows中運行Cygwin的,當我在Cygwin中運行此命令時,它完美的作品:Windows + Cygwin +單行如果其他+ Puppet
if [ -d C:/repo ]; then cd C:/repo && "C:/Program Files (x86)/Git/bin/git.exe" pull; else "C:/Program Files (x86)/Git/bin/git.exe" clone -b develop https://repo.git C:/repo; fi
當我從木偶運行相同的命令,雖然是這樣的:
exec {'checkout repository':
command => "if [ -d C:/repo ]; then cd C:/repo && "C:/Program Files (x86)/Git/bin/git.exe" pull; else "C:/Program Files (x86)/Git/bin/git.exe" clone -b develop https://repo.git C:/repo; fi"
}
我得到錯誤:
Error: ' if [ -d C:/repo ]; then cd C:/repo && "C:/Program Files (x86)/Git/bin/git.exe" pull; else "C:/Program Files (x86)/Git/bin/git.exe" clone -b develop https://repo.git C:/repo; fi' is not qualified and no path was specified. Please qualify the command or specify a path.
任何想法爲什麼?
它可能是你的報價?嘗試將整個命令封裝爲「而不是」,並將可執行文件路徑包裹在「中」。 – dennmat
我試過了,同樣的錯誤。 –
發現這個,因爲我相信你有︰https://github.com/camptocamp/puppet-sudo/issues/10這個問題似乎來自不正確的文件路徑,如果你在同一臺機器上運行這應該不應該這不是一個問題。但是,當涉及到窗口風格的路徑時,木偶可能會做些時髦的事情? – dennmat