【问题标题】:Chef-solo on Windows, Win32APIError when running windows_packageWindows 上的 Chef-solo,运行 windows_package 时出现 Win32APIError
【发布时间】:2023-03-31 04:55:02
【问题描述】:

在 Windows Server 2008 R2 - Datacentre 核心(从 vagrantbox.es 下载))由 Vagrant 配置的 VM 上,我运行 chef-solo 来测试我的食谱。我无法运行 windows_package 而不收到 Win32APIError。

运行以下配方步骤:

windows_package ".NET 4.0" do
  package_name "Microsoft .NET Framework 4 Extended"
  source "http://download.microsoft.com/download/3/6/1/361DAE4E-E5B9-4824-B47F-6421A6C59227/dotNetFx40_Full_x86_x64_SC.exe"
  options "/q"
  installer_type :inno
  action :install
end

产生以下错误:

Chef::Exceptions::Win32APIError: windows_package[.NET 4.0] (<my recipe> line 10) had an error: 
 Chef::Exceptions::Win32APIError: remote_file[C:/vagrant/cache/dotNetFx40_Full_x86_x64_SC.exe] (dynamically defined) had an error: 
 Chef::Exceptions::Win32APIError: Incorrect function.
get_named_security_info(C:/vagrant/cache/dotNetFx40_Full_x86_x64_SC.exe, SE_FILE_OBJECT, 7)
 ---- Begin Win32 API output ----
System Error Code: 1
System Error Message: Incorrect function.
---- End Win32 API output ----

安装文件已正确下载,我可以在厨师错误后从 VM 控制台手动运行它,所以我猜这是一些 Ruby/Chef 权限错误...

尝试安装 Opscode SQL Server recipe 会产生相同的 get_named_security_info 错误。

知道有什么问题吗?

--
使用 厨师版本 11.4.4-2

【问题讨论】:

    标签: chef-infra vagrant chef-solo


    【解决方案1】:

    知道了。事实证明,该错误是由于缓存文件夹(下载安装程序的位置)位于 Vagrant“网络共享文件夹”(c:\vagrant\cache\)中。例如,将其更改为 c:\temp\cache 可以解决 get_named_security_info() 错误。

    所以在我的 chef-solo 配置文件中:

    file_cache_path "C:/temp/cache"
    

    【讨论】:

    • 谢谢,这是因为缺乏对 Windows Server 2003 的官方支持。对于人们在谷歌上搜索,同样的错误可以用Chef::Exceptions::WindowsNotAdmin: file[/vagrant/foo.txt] (foo::default line 10) had an error: Chef::Exceptions::WindowsNotAdmin: can not get the security information for '/vagrant/foo.txt' due to missing Administrator privilages. 来掩盖,例如当您将content "bar" 添加到file "/vagrant/foo.txt" 时。
    猜你喜欢
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 2023-03-04
    • 2015-02-06
    • 2013-02-24
    • 2013-01-17
    • 1970-01-01
    • 2015-09-16
    相关资源
    最近更新 更多