Class: MotherBrain::Bootstrap::Routine::Task Private

Inherits:
Object
  • Object
show all
Defined in:
lib/mb/bootstrap/routine.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Container for a bootstrap task defined in a bootstrap routine

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(group_name, options = {}) ⇒ Task

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Task.

Parameters:

  • group_name (String)


45
46
47
48
49
# File 'lib/mb/bootstrap/routine.rb', line 45

def initialize(group_name, options = {})
  @group_name      = group_name
  @run_list        = options[:run_list] || Array.new
  @chef_attributes = options[:chef_attributes] || Hashie::Mash.new
end

Instance Attribute Details

#chef_attributesHashie::Mash (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Hashie::Mash)


42
43
44
# File 'lib/mb/bootstrap/routine.rb', line 42

def chef_attributes
  @chef_attributes
end

#group_nameString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


38
39
40
# File 'lib/mb/bootstrap/routine.rb', line 38

def group_name
  @group_name
end

#run_listArray (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Array)


40
41
42
# File 'lib/mb/bootstrap/routine.rb', line 40

def run_list
  @run_list
end

Class Method Details

.from_group(group_path, group) ⇒ Routine::Task

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • group_path (#to_s)

    a string representing the path to a group in a component (“nginx::master”)

  • group (MB::Group)

Returns:



32
33
34
# File 'lib/mb/bootstrap/routine.rb', line 32

def from_group(group_path, group)
  new(group_path, run_list: group.run_list, chef_attributes: group.chef_attributes)
end

.from_group_path(plugin, group_path) ⇒ Routine::Task

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Create a new bootstrap routine task from a group path

Parameters:

  • plugin (MB::Plugin)

    the plugin to find the group in

  • group_path (#to_s)

    a string representing the path to a group in a component (“nginx::master”)

Returns:

Raises:



19
20
21
22
23
24
25
# File 'lib/mb/bootstrap/routine.rb', line 19

def from_group_path(plugin, group_path)
  component_id, group_id = group_path.to_s.split('::')
  group                  = plugin.component!(component_id).group!(group_id)
  from_group(group_path, group)
rescue ComponentNotFound, GroupNotFound => ex
  raise PluginSyntaxError, ex
end