Class: ClassifyCluster::Configurator::Node
- Inherits:
-
Object
- Object
- ClassifyCluster::Configurator::Node
- Defined in:
- lib/classify_cluster/configurator/node.rb
Instance Attribute Summary collapse
-
#classes ⇒ Object
readonly
Returns the value of attribute classes.
-
#cluster ⇒ Object
readonly
Returns the value of attribute cluster.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#fqdn(value = nil) ⇒ Object
readonly
Returns the value of attribute fqdn.
-
#private_ip(value = nil) ⇒ Object
readonly
Returns the value of attribute private_ip.
-
#public_ip(value = nil) ⇒ Object
readonly
Returns the value of attribute public_ip.
-
#resources ⇒ Object
readonly
Returns the value of attribute resources.
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Instance Method Summary collapse
- #default? ⇒ Boolean
-
#initialize(*args, &block) ⇒ Node
constructor
A new instance of Node.
- #klass(name) ⇒ Object
- #resource(&block) ⇒ Object
- #role(type = '', options = {}, &block) ⇒ Object
- #variable(name, value) ⇒ Object
Constructor Details
#initialize(*args, &block) ⇒ Node
Returns a new instance of Node.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/classify_cluster/configurator/node.rb', line 5 def initialize(*args, &block) @cluster = args[2] @variables = {} @resources = [] @classes = [] @roles = [] @fqdn = (args.first.to_s == 'default' ? '' : args.first) @private_ip = (args[1].to_s == 'default' ? '' : args[1]) @default = args.first.to_s == 'default' block.call(self) end |
Instance Attribute Details
#classes ⇒ Object (readonly)
Returns the value of attribute classes.
4 5 6 |
# File 'lib/classify_cluster/configurator/node.rb', line 4 def classes @classes end |
#cluster ⇒ Object (readonly)
Returns the value of attribute cluster.
4 5 6 |
# File 'lib/classify_cluster/configurator/node.rb', line 4 def cluster @cluster end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
4 5 6 |
# File 'lib/classify_cluster/configurator/node.rb', line 4 def default @default end |
#fqdn(value = nil) ⇒ Object (readonly)
Returns the value of attribute fqdn.
4 5 6 |
# File 'lib/classify_cluster/configurator/node.rb', line 4 def fqdn @fqdn end |
#private_ip(value = nil) ⇒ Object (readonly)
Returns the value of attribute private_ip.
4 5 6 |
# File 'lib/classify_cluster/configurator/node.rb', line 4 def private_ip @private_ip end |
#public_ip(value = nil) ⇒ Object (readonly)
Returns the value of attribute public_ip.
4 5 6 |
# File 'lib/classify_cluster/configurator/node.rb', line 4 def public_ip @public_ip end |
#resources ⇒ Object (readonly)
Returns the value of attribute resources.
4 5 6 |
# File 'lib/classify_cluster/configurator/node.rb', line 4 def resources @resources end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
4 5 6 |
# File 'lib/classify_cluster/configurator/node.rb', line 4 def roles @roles end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
4 5 6 |
# File 'lib/classify_cluster/configurator/node.rb', line 4 def variables @variables end |
Instance Method Details
#default? ⇒ Boolean
16 17 18 |
# File 'lib/classify_cluster/configurator/node.rb', line 16 def default? return @default end |
#klass(name) ⇒ Object
40 41 42 |
# File 'lib/classify_cluster/configurator/node.rb', line 40 def klass(name) @classes << name end |
#resource(&block) ⇒ Object
37 38 39 |
# File 'lib/classify_cluster/configurator/node.rb', line 37 def resource(&block) @resources << ClassifyCluster::Configurator::Resource.new(&block) end |
#role(type = '', options = {}, &block) ⇒ Object
31 32 33 |
# File 'lib/classify_cluster/configurator/node.rb', line 31 def role(type='', ={}, &block) @roles << ClassifyCluster::Configurator::Role.new(self, type, , &block) end |
#variable(name, value) ⇒ Object
34 35 36 |
# File 'lib/classify_cluster/configurator/node.rb', line 34 def variable(name, value) @variables[name] = value end |