Chef WebPI 说明书在 Azure 中安装失败

Chef WebPI cookbook fails install in Azure

我使用 Chef 插件在 Azure 中设置了一个新的 Win2012 VM,并将其连接到 manage.chef.io。添加了一本使用 WebPi 说明书安装 ServiceBus 及其依赖项的说明书。安装失败并出现以下错误:

“Error opening installation log file. Verify that the specified log file location exists and is writable.”

根据这篇 2013 年的博客 post - https://nemetht.wordpress.com/2013/02/27/web-platform-installer-in-windows-azure-startup-tasks/

,经过一些搜索,这似乎在 Azure 中并不新鲜

它提供了暂时禁用文件夹安全性的破解方法,但我正在寻找更好的解决方案。

有什么想法吗?

更多日志输出 -

Started installing: 'Microsoft Windows Fabric V1 RTM'

 .  

Install completed (Failure): 'Microsoft Windows Fabric V1 RTM'

 .  

WindowsFabric_1_0_960_0 : Failed.
Error opening installation log file. Verify that the specified log file location exists and is writable.


DependencyFailed: Microsoft Windows Fabric V1 CU1


DependencyFailed: Windows Azure Pack: Service Bus 1.1

 .  
 .. 




Verifying successful installation...


Microsoft Visual C++ 2012 SP1 Redistributable Package (x64) True


Microsoft Windows Fabric V1 RTM                    False


    Log Location: C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\Web Platform Installer\logs\install15-05-11T14.15.51\WindowsFabric.txt


Microsoft Windows Fabric V1 CU1                    False


Windows Azure Pack: Service Bus 1.1                False


Install of Products: FAILURE
STDERR: 
---- End output of "WebpiCmd.exe" /Install /products:ServiceBus_1_1 /suppressreboot /accepteula /Log:c:/chef/cache/WebPI.log ----
Ran "WebpiCmd.exe" /Install /products:ServiceBus_1_1 /suppressreboot /accepteula /Log:c:/chef/cache/WebPI.log returned -1

Chef 联系人(感谢 Bryan!)帮助我更好地理解了这个问题。一些 WebPI 包不遵守提供给 WebPIcmd.exe 的显式日志路径。作者应该修复包以在设置时使用提供的日志路径。所以选项变成了:

  • 请作者修复包
  • 运行 Chef 在新的计划任务中作为具有访问权限的不同用户 到 AppData 文件夹
  • 将说明书编辑为 perform/unperform 注册表编辑以临时将 AppData 文件夹移动到系统无法访问的位置 用户有访问权限。在我的自定义食谱中或分叉 WebPI 食谱。

显然,等待作者(在本例中为 Microsoft)修复软件包不会很快发生。

改变 Azure VM 运行 Chef 的方式没有意义,因为整个想法是在配置时提供配置并且它只是工作。此外,更改默认设置可能会产生意想不到的后果,并使我们处于非标准环境中。

短期内,我决定更改我的自定义食谱中的注册表。

registry_key 'HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders' do
    values [{
        :name => "Local AppData",
        :type => :expand_string,
        :data => "%~dp0appdata"
        }]
        action :create
end
webpi_product 'ServiceBus_1_1' do
    accept_eula true
    action :install
end
webpi_product 'ServiceBus_1_1_CU1' do
    accept_eula true
    action :install
end
registry_key 'HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders' do
    values [{
        :name => "Local AppData",
        :type => :expand_string,
        :data => '%%USERPROFILE%%\AppData\Local'
        }]
end

此更改也可以在 WebPI 说明书中完成,以解决所有相关说明书的此问题。在 WebPI 团队响应框架的功能请求以验证包是否遵守日志路径之前,我决定不处理这个问题。

http://forums.iis.net/t/1225061.aspx?WebPI+Feature+Request+Validate+product+package+log+path+usage

请去回复这个帖子,让团队帮助防止这个常见的包裹问题。

这是 POWERSHELL

的解决方案

我在创建 VMSS VM 期间安装“Service Fabric SDK”时遇到了同样的错误。也用了系统用户。

问题:当我用我的“admin”用户连接 RDP 时 运行 同样,它起作用了。

解决方法:如上更改注册表项,安装并重置回来

这是我使用“powershell”的解决方案

我在 %TEMP% 文件夹中安装了 2 个 .reg 文件。内容是

的新旧导出键/值
  • 插件-sf-SDK-temp.reg
Windows Registry Editor Version 5.00

[HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]
"Local AppData"=hex(2):25,00,54,00,45,00,4d,00,50,00,25,00,00,00
  • 插件-sf-SDK-orig.reg
Windows Registry Editor Version 5.00

[HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]
"Local AppData"=hex(2):25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,\
  49,00,4c,00,45,00,25,00,5c,00,41,00,70,00,70,00,44,00,61,00,74,00,61,00,5c,\
  00,4c,00,6f,00,63,00,61,00,6c,00,00,00

将以下代码集成到您的自定义 powershelgl 脚本中:

Write-Output "Reset LocalApp Folder to TEMP"
Start-Process "$($env:windir)\regedit.exe" `
   -ArgumentList "/s", "$($env:TEMP)\plugin-sf-SDK-temp.reg"


## replace the following lines with your installation - here my SF SDK installation via WebWPIcmd
Write-Output "Installing /Products:MicrosoftAzure-ServiceFabric-CoreSDK"
Start-Process "$($env:programfiles)\microsoft\web platform installer\WebPICMD.exe" `
    -ArgumentList '/Install', `
       '/Products:"MicrosoftAzure-ServiceFabric-CoreSDK"', `
       '/AcceptEULA', "/Log:$($env:TEMP)\WebPICMD-install-service-fabric-sdk.log" `
    -NoNewWindow -Wait `
    -RedirectStandardOutput "$($env:TEMP)\WebPICMD.log" `
    -RedirectStandardError "$($env:TEMP)\WebPICMD.error.log" 


Write-Output "Reset LocalApp Folder to ORIG"
Start-Process "$($env:windir)\regedit.exe" `
   -ArgumentList "/s", "$($env:TEMP)\plugin-sf-SDK-orig.reg"