Class: Circus::Profiles::ChefStack
- Defined in:
- lib/circus/profiles/chef_stack.rb
Overview
A Chef Stack provides the ability to trigger deployment of system packages and configuration.
Constant Summary collapse
- CHEF_STACK_PROPERTY =
'chef-stack'
Class Method Summary collapse
-
.accepts?(name, dir, props) ⇒ Boolean
Checks if this is a chef stack applcation.
Instance Method Summary collapse
- #deploy_run_script_content ⇒ Object
- #dev_run_script_content ⇒ Object
-
#initialize(name, dir, props) ⇒ ChefStack
constructor
A new instance of ChefStack.
- #mark_for_persistent_run? ⇒ Boolean
-
#name ⇒ Object
The name of this profile.
- #prepare_for_deploy(logger, overlay_dir) ⇒ Object
- #requirements ⇒ Object
-
#supported_for_development? ⇒ Boolean
Stacks are not useful in development.
Methods inherited from Base
#cleanup_after_deploy, #extra_dirs, #package_base_dir?, #package_for_deploy, #package_for_dev
Constructor Details
#initialize(name, dir, props) ⇒ ChefStack
Returns a new instance of ChefStack.
16 17 18 19 20 |
# File 'lib/circus/profiles/chef_stack.rb', line 16 def initialize(name, dir, props) super(name, dir, props) @stack_script = props[CHEF_STACK_PROPERTY] || "stack.yaml" end |
Class Method Details
.accepts?(name, dir, props) ⇒ Boolean
Checks if this is a chef stack applcation. Will accept the application if it has a file named stack.yaml, or has a ‘chef-stack’ property describing the entry point.
11 12 13 14 |
# File 'lib/circus/profiles/chef_stack.rb', line 11 def self.accepts?(name, dir, props) return true if props.include? CHEF_STACK_PROPERTY return File.exists?(File.join(dir, "stack.yaml")) end |
Instance Method Details
#deploy_run_script_content ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/circus/profiles/chef_stack.rb', line 64 def deploy_run_script_content shell_run_script do <<-EOT exec chef-solo -c solo-stack.rb -j stack.json EOT end end |
#dev_run_script_content ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/circus/profiles/chef_stack.rb', line 42 def dev_run_script_content shell_run_script do <<-EOT cd #{@dir} exec echo "Stacks cannot be run in development" EOT end end |
#mark_for_persistent_run? ⇒ Boolean
33 34 35 |
# File 'lib/circus/profiles/chef_stack.rb', line 33 def mark_for_persistent_run? false end |
#name ⇒ Object
The name of this profile
23 24 25 |
# File 'lib/circus/profiles/chef_stack.rb', line 23 def name "chef-stack" end |
#prepare_for_deploy(logger, overlay_dir) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/circus/profiles/chef_stack.rb', line 51 def prepare_for_deploy(logger, ) # Generate a chef configuration file stack_config = YAML::load(File.read(File.join(@dir, @stack_script))) File.open(File.join(, 'stack.json'), 'w') do |f| f.write(stack_config.to_json) end File.open(File.join(, 'solo-stack.rb'), 'w') do |f| f << "cookbook_path File.expand_path('../cookbooks', __FILE__)" end true end |
#requirements ⇒ Object
27 28 29 30 31 |
# File 'lib/circus/profiles/chef_stack.rb', line 27 def requirements reqs = super reqs['execution-user'] = 'root' reqs end |
#supported_for_development? ⇒ Boolean
Stacks are not useful in development
38 39 40 |
# File 'lib/circus/profiles/chef_stack.rb', line 38 def supported_for_development? false end |