last day (15 days later) » 

5:46 PM
0
Q: Cannot access remote files with puppet

DeronganI can not seem to get puppet to happily grab a file from a network share file { "installerfile": ensure => file, source => '\\drivename\installer.msi', path => 'C:/puppetstuff/installer.msi', } Fails with a bad URI error. It says that the drive name is a bad h...

 
Does \\potatodrive open the share in Windows Explorer? Is that the server name? If not, what is the server's name?
 
Potato drive is of course not actually the name of the drive, but the drive does open in the explorer happily. The account puppet is running as should have full access to it. In fact if I simply change the resource type to a package with the same source it works fine.
 
Your post is anonymised beyond recognition. Consider publishing some information that is not vital, or substituting names coherently rather than at random. - For what it's worth, this is likely a problem from URI.parse. I don't see a clear solution yet.
 
Updated with better naming
 
Either I'm completely off track or this is a case of Works On Unix. Trying irb(main):006:0> require 'uri'; URI.parse(URI.escape('\\drivename\installer.msi')) yields #<URI::Generic:0x000000026088b0 URL:%5Cdrivename%5Cinstaller.msi> without exception. Can you try this on Windows?
 
5:46 PM
How do I try this on windows? This looks like ruby and I havn't gone that deep into puppet yet. Is there a way to have puppet parse this on the command line like there is with normal puppet DSL?
 
Puppet on Windows comes with or requires Ruby. I'm not sure how it works. There should be an irb command somewhere. What I pasted is its prompt. Just run it (it's interactive) and paste require 'uri'; URI.parse(URI.escape('\\drivename\installer.msi'))
 
6:02 PM
I did not know that stack overflow had a chat
 
\o/
 
okay I will try that, thankyou
That runs without fail
 
6:41 PM
Huh.
It would appear that the \\drivename part gets lost somewhere in Puppet. The error just indicates the file name...
Have you tried forward slashes? //drivename/file/ ?
 
well it still knows the drive name- the end of the error states "bad component(expected host component): drivename"
Ill check, I probably did but never hurts to try again
same error
 
guess I'm barking up the wrong tree after all
Ah, it happens in munge
URI.unescape(Puppet::Util.path_to_uri('\\drivename\installer.msi'))
although forward slashes give me another funky error
irb(main):012:0> URI.unescape(Puppet::Util.path_to_uri('//drivename/installer.msi'))
NoMethodError: undefined method `gsub' for #<URI::Generic:0x00000002257860>
 
Any idea why it would be working fine for package resources but not file resources? Wouldn't both be calling the same path_to_uri method?
 
this may be a Puppet bug
and no, I suspect packages don't try to get smart about URIs and URL
 
So I guess I am going to have to use powershell to grab the files then. Was hoping to avoid that. Thank you again, you show up a lot on puppet questions, and its always useful!
 
6:56 PM
thanks - still staring at that method. perhaps i'll see how it's supposed to work :)
 
7:14 PM
FWIW - this won't throw an error for me
URI.unescape(Puppet::Util.path_to_uri('//drivename/installer.msi').to_s)
so forward slashes look safe from here - but path_to_uri works differently on windows :(
can you try this in IRB? Puppet::Util.path_to_uri('//drivename/installer.msi').to_s
 
 
1 hour later…
8:32 PM
Puppet isnt initialized
In ruby
 

last day (15 days later) »