Class: Hubcap::Server

Inherits:
Group
  • Object
show all
Defined in:
lib/hubcap/server.rb

Instance Attribute Summary collapse

Attributes inherited from Group

#children, #name, #parent

Instance Method Summary collapse

Methods inherited from Group

#absorb, #cap_attribute, #cap_attributes, #cap_roles, #cap_set, #collectable?, #history, #hub, #param, #params, #processable?, #puppet_roles, #role, #tree

Constructor Details

#initialize(parent, name, options = {}, &blk) ⇒ Server

Returns a new instance of Server.



6
7
8
9
# File 'lib/hubcap/server.rb', line 6

def initialize(parent, name, options = {}, &blk)
  @address = options[:address] || name
  super(parent, name, &blk)
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



3
4
5
# File 'lib/hubcap/server.rb', line 3

def address
  @address
end

Instance Method Details

#application(*args) ⇒ Object



12
13
14
# File 'lib/hubcap/server.rb', line 12

def application(*args)
  raise(Hubcap::ServerSubgroupDisallowed, 'application')
end

#application_parentObject



27
28
29
30
31
32
33
# File 'lib/hubcap/server.rb', line 27

def application_parent
  p = self
  while p && p != hub
    return p  if p.kind_of?(Hubcap::Application)
    p = p.instance_variable_get(:@parent)
  end
end

#group(*args) ⇒ Object



22
23
24
# File 'lib/hubcap/server.rb', line 22

def group(*args)
  raise(Hubcap::ServerSubgroupDisallowed, 'group')
end

#server(*args) ⇒ Object



17
18
19
# File 'lib/hubcap/server.rb', line 17

def server(*args)
  raise(Hubcap::ServerSubgroupDisallowed, 'server')
end

#yamlObject



36
37
38
39
40
41
# File 'lib/hubcap/server.rb', line 36

def yaml
  {
    'classes' => puppet_roles.collect(&:to_s),
    'parameters' => params
  }.to_yaml
end