Class: RSpecSystem::Helpers::PuppetModuleInstall

Inherits:
RSpecSystem::Helper
  • Object
show all
Defined in:
lib/rspec-system-puppet/helpers/puppet_module_install.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts, clr, &block) ⇒ PuppetModuleInstall

Returns a new instance of PuppetModuleInstall.



7
8
9
10
11
12
13
14
15
# File 'lib/rspec-system-puppet/helpers/puppet_module_install.rb', line 7

def initialize(opts, clr, &block)
  opts = {
    :module_path => "/etc/puppet/modules",
  }.merge(opts)

  raise "Must provide :source and :module_name parameters" unless opts[:source] && opts[:module_name]

  super(opts, clr, &block)
end

Instance Method Details

#executeObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/rspec-system-puppet/helpers/puppet_module_install.rb', line 17

def execute
  source = opts[:source]
  module_name = opts[:module_name]
  module_path = opts[:module_path]
  node = opts[:node]

  log.info("Now transferring module onto node")
  result = rcp :sp => source, :d => node, :dp => File.join(module_path, module_name)
  result.to_hash
end