简体   繁体   English

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

[英]Chef - Installing a Windows Package from a Mapped Drive

I am trying to install a package from a mapped drive.我正在尝试从映射驱动器安装软件包。 However, chef says my source path is an invalid location even though I know it is the correct location.然而,厨师说我的源路径是一个无效的位置,即使我知道它是正确的位置。 Do I need to map the drive first, before Chef recognizes the source path?在 Chef 识别源路径之前,我是否需要先映射驱动器? I looked online in a couple places and could not find an answer.我在网上看了几个地方,找不到答案。

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

The error that I get when the chef client runs is that the source location is in invalid source, even though I can get to the source location by typing it in on the server itself. Chef 客户端运行时遇到的错误是源位置在无效源中,即使我可以通过在服务器上输入它来到达源位置。 Any help would be appreciated.任何帮助,将不胜感激。 Thank you.谢谢你。 Error That I receive is below.我收到的错误如下。


   * 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

Since you're installing a package, it's safe to assume you are running chef-client with elevated permissions.由于您正在安装一个软件包,因此可以安全地假设您正在使用提升的权限运行chef-client Any network drives you map that are visible in Explorer, will not be usable in an elevated process.您映射的在资源管理器中可见的任何网络驱动器将无法在提升的进程中使用。 You will either need to:您将需要:

  • Use the UNC path in place of a letter drive使用 UNC 路径代替字母驱动器
  • Map the drive during the Chef run (required if the full UNC path would exceed 255 characters)在 Chef 运行期间映射驱动器(如果完整 UNC 路径超过 255 个字符,则需要)

If you opt for the latter approach, you can use the mount resource to map a network drive .如果您选择后一种方法,则可以使用mount资源映射网络驱动器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM