Sha256: 64c3edeae38119964da382083b9f0c7f7d1a0160f24f88449be97de5022a920b

Contents?: true

Size: 1.33 KB

Versions: 9

Compression:

Stored size: 1.33 KB

Contents

module PoolParty    
  module Resources
        
=begin rdoc

== Remote File

The remotefile resource is used to describe a file that is hosted on the master instance and propagated to the other instances

== Usage

  has_remotefile(:name => '...') do
    # More options. 
    # This block is optional
  end

== Options

* <tt>name</tt> Describe the location of the file with the name
* <tt>mode</tt> Describe the mode of the file (default: 644)
* <tt>owner</tt> The owner of the file (default: poolparty user)
* <tt>content</tt> The contents of the file
* <tt>source</tt> Used to describe a file that is hosted on the master instance.
* <tt>template</tt> The file contents are described with the template. The location given must be readable
  
To write a file to the template directory, use:

    copy_template_to_storage_directory(filepath)

== Example
  has_remotefile(:name => "/etc/haproxy.cfg") do
    mode 644
    template File.join(File.dirname(__FILE__), "..", "templates/haproxy.conf")
  end
=end
    class Remotefile < Resource
      
      default_options({
        :ensures => "present",
        :mode => 644,
        # :owner => "#{Default.user}",
        :source => nil
      })
      
      def source(arg=nil)
        arg ? dsl_options[:source] = arg : "#{Default.fileserver_base}/#{::File.basename(name)}"
      end
      
    end
    
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
auser-poolparty-1.2.10 lib/poolparty/resources/remote_file.rb
auser-poolparty-1.2.11 lib/poolparty/resources/remote_file.rb
auser-poolparty-1.2.12 lib/poolparty/resources/remote_file.rb
auser-poolparty-1.2.3 lib/poolparty/resources/remote_file.rb
auser-poolparty-1.2.4 lib/poolparty/resources/remote_file.rb
auser-poolparty-1.2.7 lib/poolparty/resources/remote_file.rb
auser-poolparty-1.2.8 lib/poolparty/resources/remote_file.rb
auser-poolparty-1.2.9 lib/poolparty/resources/remote_file.rb
fairchild-poolparty-1.2.12 lib/poolparty/resources/remote_file.rb