Class: Solid::Chef
Constant Summary
Constants included
from Constants
Solid::Constants::APT_GET, Solid::Constants::CHEF_GEMS, Solid::Constants::RUBYGEMS_DIR, Solid::Constants::RUBYGEMS_FILE, Solid::Constants::RUBYGEMS_URL
Instance Method Summary
collapse
Methods included from SSH
#ssh_exec
Constructor Details
#initialize(server, dna, logger = Logger.new(STDOUT), &block) ⇒ Chef
Returns a new instance of Chef.
7
8
9
10
11
12
13
14
15
|
# File 'lib/solid/chef.rb', line 7
def initialize(server, dna, logger=Logger.new(STDOUT), &block)
@server = server
@dna = dna
@logger = logger
@level = "info"
@user = @dna["user"]
@cookbooks = @dna["cookbooks"]
self.instance_eval(&block) if block_given?
end
|
Instance Method Details
#install ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/solid/chef.rb', line 17
def install
unless installed?
@logger.info "installing..."
install_chef_prereqs
install_chef_gems
build_solo_rb
end
end
|
#installed? ⇒ Boolean
26
27
28
29
30
31
32
33
|
# File 'lib/solid/chef.rb', line 26
def installed?
result = false
@logger.info "checking if installed"
Net::SSH.start(@server, @user, self.options) do |ssh|
result = ssh.exec!("which chef-solo")
end
result =~ /chef-solo/
end
|
#run_solo ⇒ Object
35
36
37
38
39
|
# File 'lib/solid/chef.rb', line 35
def run_solo
@logger.info "deploying..."
build_json
run_chef_solo
end
|