ZMan007
ZMan007

Reputation: 21

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? 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. 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

Upvotes: 0

Views: 300

Answers (1)

codewario
codewario

Reputation: 21518

Since you're installing a package, it's safe to assume you are running chef-client with elevated permissions. 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
  • Map the drive during the Chef run (required if the full UNC path would exceed 255 characters)

If you opt for the latter approach, you can use the mount resource to map a network drive.

Upvotes: 1

Related Questions