【发布时间】:2019-05-23 01:26:49
【问题描述】:
运行 packer build 时,它会挂在 chefdk 下载上,python 也会发生同样的事情,但它会安装多个其他应用程序。有谁知道为什么?
最初都是从一个脚本运行的,即安装 choco 然后安装应用程序
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”然后在配置器中调用它,但它说密码错误!?
Packer 的输出:
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'
打包器供应商是:
"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 上似乎没有太多关于 packer 的内容,这表明它可以正常工作!
【问题讨论】:
标签: windows azure chef-infra packer chocolatey