Class: Inception::InceptionServerCookbook
- Inherits:
-
Object
- Object
- Inception::InceptionServerCookbook
- Includes:
- FileUtils
- Defined in:
- lib/inception/inception_server_cookbook.rb
Overview
Perform converge chef cookbooks upon inception server
Defined Under Namespace
Classes: InvalidTarget
Instance Attribute Summary collapse
-
#project_dir ⇒ Object
readonly
Returns the value of attribute project_dir.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
-
#converge ⇒ Object
To be invoked within the settings_dir.
- #ignore_chef_preparations? ⇒ Boolean
-
#initialize(inception_server, settings, project_dir) ⇒ InceptionServerCookbook
constructor
A new instance of InceptionServerCookbook.
- #key_path ⇒ Object
- #knife_solo(command) ⇒ Object
- #prepare ⇒ Object
- #user_host ⇒ Object
Constructor Details
#initialize(inception_server, settings, project_dir) ⇒ InceptionServerCookbook
Returns a new instance of InceptionServerCookbook.
10 11 12 13 14 |
# File 'lib/inception/inception_server_cookbook.rb', line 10 def initialize(inception_server, settings, project_dir) @server = inception_server @settings = settings @project_dir = project_dir end |
Instance Attribute Details
#project_dir ⇒ Object (readonly)
Returns the value of attribute project_dir.
6 7 8 |
# File 'lib/inception/inception_server_cookbook.rb', line 6 def project_dir @project_dir end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
6 7 8 |
# File 'lib/inception/inception_server_cookbook.rb', line 6 def server @server end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
6 7 8 |
# File 'lib/inception/inception_server_cookbook.rb', line 6 def settings @settings end |
Instance Method Details
#converge ⇒ Object
To be invoked within the settings_dir
24 25 26 27 28 |
# File 'lib/inception/inception_server_cookbook.rb', line 24 def converge FileUtils.chdir(project_dir) do knife_solo :cook end end |
#ignore_chef_preparations? ⇒ Boolean
30 31 32 |
# File 'lib/inception/inception_server_cookbook.rb', line 30 def ignore_chef_preparations? @settings.exists?("cookbook.prepared") end |
#key_path ⇒ Object
35 |
# File 'lib/inception/inception_server_cookbook.rb', line 35 def key_path; server.private_key_path; end |
#knife_solo(command) ⇒ Object
37 38 39 40 |
# File 'lib/inception/inception_server_cookbook.rb', line 37 def knife_solo(command) attributes = cookbook_attributes_for_inception.to_json sh %Q{knife solo #{command} #{user_host} -i #{key_path} -j '#{attributes}' -r 'bosh_inception'} end |
#prepare ⇒ Object
16 17 18 19 20 21 |
# File 'lib/inception/inception_server_cookbook.rb', line 16 def prepare FileUtils.chdir(project_dir) do prepare_project_dir knife_solo :prepare unless ignore_chef_preparations? end end |
#user_host ⇒ Object
34 |
# File 'lib/inception/inception_server_cookbook.rb', line 34 def user_host; server.user_host; end |