Ask Your Question
0

Custom provider: How can I upload file from 'files' folder of the module?

asked 2014-01-17 08:16:13 -0600

vyacheslav.artyukhov gravatar image

updated 2014-01-17 08:17:17 -0600

Good day! I am writing a custom type for puppet that should upload a file and then do some buiseness logic. How can I upload a file from 'files' folder of the module? I try following :

attr_writer :content
def create
  @content = Puppet::FileSystem.read(@resource[:file]) 
  puts @content   
end

But get an error:
Could not set 'present on ensure: undefined method `read' for Puppet::FileSystem:Module at /etc/puppetlabs/puppet/modules/glassfish/manifests/rootcertificate.pp:10

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-04-16 02:05:08 -0600

akshay gravatar image

Try this.

class class_name {
file {
"file_name":
ensure => present,
**source => "puppet:///modules/class_name/file_name",**
}
}

This source attribute can upload the files on agent machine. And this file can be present on your /etc/puppet/modules/module_name/files/ directory. So you can upload the files on your agent machine.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-01-17 08:16:13 -0600

Seen: 603 times

Last updated: Apr 16 '15