Chef-从映射驱动器安装Windows软件包

Chef-从映射驱动器安装Windows软件包,windows,powershell,chef-infra,Windows,Powershell,Chef Infra,我正在尝试从映射驱动器安装程序包。但是,chef说我的源路径是无效的位置,即使我知道它是正确的位置。在Chef识别源路径之前,是否需要先映射驱动器?我在网上找了几个地方,都找不到答案 case node['platform'] when 'windows' windows_package 'QualysCloudAgent' do source '\\Server#\Location1\Qualys_agent\QualysCloudAgent.exe' options '-

我正在尝试从映射驱动器安装程序包。但是,chef说我的源路径是无效的位置,即使我知道它是正确的位置。在Chef识别源路径之前,是否需要先映射驱动器?我在网上找了几个地方,都找不到答案

case node['platform']
when 'windows'
  windows_package 'QualysCloudAgent' do
    source '\\Server#\Location1\Qualys_agent\QualysCloudAgent.exe'
    options '-argumentlist "CustomerId={etc...etc...etc..} ActivationId={etc...etc..etc...}"'
    installer_type :custom
    action :install
  end
end
当chef客户端运行时,我得到的错误是源位置位于无效源中,即使我可以通过在服务器本身上键入来访问源位置。任何帮助都将不胜感激。非常感谢。我收到的错误如下


   * Source for package QualysCloudAgent does not exist
   ================================================================================
   Error executing action `install` on resource 'windows_package[QualysCloudAgent]'
   ================================================================================

   Chef::Exceptions::Package
   -------------------------
   Source for package QualysCloudAgent does not exist

   Resource Declaration:
   ---------------------
   # In c:/chef/cache/cookbooks/qualys/recipes/qualys_configure.rb

    18:   windows_package 'QualysCloudAgent' do
    19:     source '\\Server#\Location1\Qualys_agent\QualysCloudAgent.exe'
    20:     options '-argumentlist "CustomerId={etc...etc...etc...} ActivationId={etc...etc...etc...}"'
    21:     installer_type :custom
    22:     action :install
    23:   end
    24: end

   Compiled Resource:
   ------------------
   # Declared in c:/chef/cache/cookbooks/qualys/recipes/qualys_configure.rb:18:in `from_file'

   windows_package("QualysCloudAgent") do
     package_name "QualysCloudAgent"
     action [:install]
     default_guard_interpreter :default
     declared_type :windows_package
     cookbook_name "qualys"
     recipe_name "qualys_configure"
     source "p:\\Server#\\Location1\\qualys_agent\\qualyscloudagent.exe"
     options "-argumentlist \"CustomerId={etc...etc...etc...} ActivationId={etc...etc...etc...}\""
     installer_type :custom
   end

   System Info:
   ------------
   chef_version=14.14.25
   platform=windows
   platform_version=6.3.9600
   ruby=ruby 2.5.7p206 (2019-10-01 revision 67816) [x64-mingw32]
   program_name=C:/opscode/chef/bin/chef-client
   executable=C:/opscode/chef/bin/chef-client

2020-01-12T22:21:50-08:00] INFO: Running queued delayed notifications before re-raising exception

unning handlers:
2020-01-12T22:21:50-08:00] ERROR: Running exception handlers
unning handlers complete
2020-01-12T22:21:50-08:00] ERROR: Exception handlers complete
hef Client failed. 0 resources updated in 14 seconds
2020-01-12T22:21:51-08:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
2020-01-12T22:21:51-08:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
2020-01-12T22:21:51-08:00] FATAL: Chef::Exceptions::Package: windows_package[QualysCloudAgent] (qualys::qualys_configur
 line 18) had an error: Chef::Exceptions::Package: Source for package QualysCloudAgent does not exist


由于您正在安装软件包,因此可以安全地假设您正在使用提升的权限运行
chef-client
。您映射的任何在资源管理器中可见的网络驱动器在提升的进程中将不可用。您需要:

  • 使用UNC路径代替字母驱动器
  • 在Chef运行期间映射驱动器(如果完整UNC路径将超过255个字符,则需要此选项)
如果您选择后一种方法,则可以使用to