当运行packer build时,它挂在chefdk下载上,同样的事情也发生在python上,但它会安装多个其他应用程序。有人知道为什么吗?
我只需要一个脚本就可以运行,即先安装巧克力,再安装应用
if (!(Get-Package -Name *choco*))
{
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
choco install visualstudiocode -y
choco install chefdk -y我已经尝试将它们分离到内联代码中,但我仍然得到相同的问题。
为了确保这一点,我还手动运行了该脚本,并且一切正常(没有提示响应)。
我尝试过添加"winrm_password“,然后在配置器中调用它,但它显示密码错误!?
打包程序的输出:
azure-arm: vscode v1.34.0 [Approved]
azure-arm: vscode package files install completed. Performing other installation steps.
azure-arm: Merge Tasks: !runCode, desktopicon, quicklaunchicon, addcontextmenufiles, addcontextmenufolders, addtopath
azure-arm: Downloading vscode 64 bit
azure-arm: from 'https://az764295.vo.msecnd.net/stable/a622c65b2c713c890fcf4fbf07cf34049d5fe758/VSCodeSetup-x64-1.34.0.exe'
Progress: 100% - Completed download of C:\Users\packer\AppData\Local\Temp\chocolatey\vscode\1.34.0\VSCodeSetup-x64-1.34.0.exe (47.85 MB).
azure-arm: Download of VSCodeSetup-x64-1.34.0.exe (47.85 MB) completed.
azure-arm: Hashes match.
azure-arm: Installing vscode...
azure-arm: vscode has been installed.
azure-arm: vscode can be automatically uninstalled.
azure-arm: Environment Vars (like PATH) have changed. Close/reopen your shell to
azure-arm: see the changes (or in powershell/cmd.exe just type `refreshenv`).
azure-arm: The install of vscode was successful.
azure-arm: Software installed to 'C:\Program Files\Microsoft VS Code\'
azure-arm: VisualStudioCode v1.23.1.20180730 [Approved]
azure-arm: visualstudiocode package files install completed. Performing other installation steps.
azure-arm: This package is deprecated due to name change to vscode
azure-arm: The install of visualstudiocode was successful.
azure-arm: Software install location not explicitly set, could be in package or
azure-arm: default install location if installer.
azure-arm: Chocolatey installed 4/4 packages.
azure-arm: See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
azure-arm: Chocolatey v0.10.13
azure-arm: Installing the following packages:
azure-arm: chefdk
azure-arm: By installing you accept licenses for the packages.
Progress: Downloading chefdk 3.7.23... 100%
azure-arm: chefdk v3.7.23 [Approved]
azure-arm: chefdk package files install completed. Performing other installation steps.
azure-arm: Downloading chefdk 64 bit
azure-arm: from 'https://packages.chef.io/stable/windows/2012r2/chefdk-3.7.23-1-x64.msi'packer provisioners是:
"provisioners": [
{
"type": "powershell",
"script": "choco.ps1"
},
{
"type": "powershell",
"inline": [
"choco install vscode -y",
"choco install chefdk -y",
"& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit",
"while($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 10 } else { break } }"
],
"pause_before": "1m"
}
]有什么办法解决这个问题吗?在google for packer上似乎没有太多的内容,这表明它只是工作!
发布于 2019-05-23 01:26:49
您是否尝试过使用powershell provisioner通过chef文档安装chefdk:https://docs.chef.io/install_omnibus.html
在最底层:. { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install -channel current -project chefdk
包装器片段看起来像这样:
"provisioners": [{
"type": "powershell",
"inline": ". { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install -channel current -project chefdk"
}]https://stackoverflow.com/questions/56228304
复制相似问题