class Blimpy::Livery::Puppet

Attributes

manifest_path[RW]
module_path[RW]
options[RW]

Public Class Methods

configure() { |instance| ... } click to toggle source
# File lib/blimpy/livery/puppet.rb, line 57
def self.configure(&block)
  if block.nil?
    raise Blimpy::InvalidLiveryException, "Puppet livery must be given a block in order to configure itself"
  end
  instance = self.new
  yield instance
  instance
end
new(*args) click to toggle source
Calls superclass method
# File lib/blimpy/livery/puppet.rb, line 9
def initialize(*args)
  super
  @module_path = './modules'
  @manifest_path = 'manifests/site.pp'
  @options = '--verbose'
  @puppet_exists = false
end

Public Instance Methods

bootstrap_script() click to toggle source
# File lib/blimpy/livery/puppet.rb, line 53
def bootstrap_script
  File.expand_path(File.dirname(__FILE__) + "/../../../scripts/#{script}")
end
flight(box) click to toggle source
Calls superclass method Blimpy::Livery::CWD#flight
# File lib/blimpy/livery/puppet.rb, line 35
def flight(box)
  unless @puppet_exists
    # This should get our puppet.sh bootstrap script run
    super(box)
  end

  # At this point we should be safe to actually invoke Puppet
  command = "puppet apply --modulepath=#{module_path} #{options} #{manifest_path}"

  run_sudo = ''
  run_sudo = 'sudo' if use_sudo?(box)

  box.ssh_into("cd #{dir_name} && chmod 755 ./gempath.sh && #{run_sudo} ./gempath.sh #{command}")
end
postflight(box) click to toggle source
# File lib/blimpy/livery/puppet.rb, line 50
def postflight(box)
end
preflight(box) click to toggle source
Calls superclass method Blimpy::Livery::CWD#preflight
# File lib/blimpy/livery/puppet.rb, line 21
def preflight(box)
  # If we find Puppet in our default path, we don't really need to send
  # the bootstrap script again
  @puppet_exists = box.ssh_into('which puppet > /dev/null')
  unless @puppet_exists
    super(box)
  end

  unless box.ssh_into("test -f #{dir_name}/gempath.sh")
    gemhelper = File.expand_path(File.dirname(__FILE__) + "/../../../scripts/gempath.sh")
    box.scp_file(gemhelper, dir_name)
  end
end
script() click to toggle source
# File lib/blimpy/livery/puppet.rb, line 17
def script
  'puppet.sh'
end