Class: ClassifyCluster::Configurator::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/classify_cluster/configurator/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#classesObject (readonly)

Returns the value of attribute classes.



4
5
6
# File 'lib/classify_cluster/configurator/node.rb', line 4

def classes
  @classes
end

#clusterObject (readonly)

Returns the value of attribute cluster.



4
5
6
# File 'lib/classify_cluster/configurator/node.rb', line 4

def cluster
  @cluster
end

#defaultObject (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

#resourcesObject (readonly)

Returns the value of attribute resources.



4
5
6
# File 'lib/classify_cluster/configurator/node.rb', line 4

def resources
  @resources
end

#rolesObject (readonly)

Returns the value of attribute roles.



4
5
6
# File 'lib/classify_cluster/configurator/node.rb', line 4

def roles
  @roles
end

#variablesObject (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

Returns:

  • (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='', options={}, &block)
  @roles << ClassifyCluster::Configurator::Role.new(self, type, options, &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