Class: Blimpy::Livery::Puppet
- Inherits:
-
CWD
- Object
- Base
- CWD
- Blimpy::Livery::Puppet
show all
- Defined in:
- lib/blimpy/livery/puppet.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from CWD
#use_sudo?
Methods inherited from Base
#can_rsync?, #dir_name, #livery_root, #rsync_command, #rsync_excludes, #setup_on, #sync_to
Constructor Details
#initialize(*args) ⇒ Puppet
Returns a new instance of Puppet.
9
10
11
12
13
14
15
|
# 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
|
Instance Attribute Details
#manifest_path ⇒ Object
Returns the value of attribute manifest_path.
7
8
9
|
# File 'lib/blimpy/livery/puppet.rb', line 7
def manifest_path
@manifest_path
end
|
#module_path ⇒ Object
Returns the value of attribute module_path.
7
8
9
|
# File 'lib/blimpy/livery/puppet.rb', line 7
def module_path
@module_path
end
|
#options ⇒ Object
Returns the value of attribute options.
7
8
9
|
# File 'lib/blimpy/livery/puppet.rb', line 7
def options
@options
end
|
Class Method Details
57
58
59
60
61
62
63
64
|
# 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
|
Instance Method Details
#bootstrap_script ⇒ Object
53
54
55
|
# File 'lib/blimpy/livery/puppet.rb', line 53
def bootstrap_script
File.expand_path(File.dirname(__FILE__) + "/../../../scripts/#{script}")
end
|
#flight(box) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/blimpy/livery/puppet.rb', line 35
def flight(box)
unless @puppet_exists
super(box)
end
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) ⇒ Object
50
51
|
# File 'lib/blimpy/livery/puppet.rb', line 50
def postflight(box)
end
|
#preflight(box) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/blimpy/livery/puppet.rb', line 21
def preflight(box)
@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 ⇒ Object
17
18
19
|
# File 'lib/blimpy/livery/puppet.rb', line 17
def script
'puppet.sh'
end
|