[chef] Re: Installing a package from a password-protected UNC share


Chronological Thread 
  • From: Jesse Campbell < >
  • To: chef < >
  • Subject: [chef] Re: Installing a package from a password-protected UNC share
  • Date: Thu, 31 Jan 2013 11:07:10 -0500

what about using what you have there, but skipping the drive letter?
If i remember correctly you can leave that out, and it will assign it to a void mount, then you can access it using the original UNC path...
so to get a directory listing it would look like:
net use //myserver/myshare /user:me pass
dir //myserver/myshare/myfolder
net use //myserver/myshare /delete

or maybe you have to use \\ instead of //... again, been a few years ;)
-Jesse


On Thu, Jan 31, 2013 at 7:58 AM, Andrea Campi < " target="_blank"> > wrote:
Ohai Chefs,

I'm seeking help from those of you who have more Windows-fu than I.

I need to install some software from a Windows share.
Unfortunately there doesn't seem to be a way to specify username and password in a UNC path and give that to either the windows_service or remote_file resource. Or is there?


Failing that, we tried something like this:

execute "mount share #{drive}" do
  command "net use #{drive}: #{path} /user:#{username} #{password} /persistent:No"
end

windows_package "Symantec Anti-Virus" do
  source "#{drive}:\\#{node['symantec-antivirus']['installer']['arch_file']}"
  options "/qn ALLUSERS=1 REBOOT=ReallySuppress"

  action :install
end

execute "unmount share #{drive}" do
  command "net use /d #{drive}:"
end


This sucks in many ways (deciding which drive letter to use is tricky, any failure will leave mapped drives around, …).

Worse, it doesn't work when chef-client is run a service!

STDERR: System error 1312 has occurred.

A specified logon session does not exist. It may already have been terminated.


Googling about this stuff, it seems there is a way around this error by using a PSEXEC.EXE, but I would rather avoid that is possible.

Thoughts?

Andrea





Archive powered by MHonArc 2.6.16.

§