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


Chronological Thread 
  • From: Andrea Campi < >
  • To: " " < >
  • Subject: [chef] Installing a package from a password-protected UNC share
  • Date: Thu, 31 Jan 2013 13:58:51 +0100

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.

§