class Hubcap::Server

Attributes

address[R]

Public Class Methods

new(parent, name, options = {}, &blk) click to toggle source
Calls superclass method Hubcap::Group::new
# File lib/hubcap/server.rb, line 6
def initialize(parent, name, options = {}, &blk)
  super(parent, name, &blk)
  hist = history.join('.')

  # only set the server_name if it's not already set
  param('server_name' => hist) if params['server_name'].nil?

  # If name is an IP, or is not in hosts hash, use name as address
  # Otherwise, dereference it from the hash and assign it
  unless @address = options[:address]
    @address = lookup(hist)
    @address = lookup(name)  if @address == hist
  end
end

Public Instance Methods

application(*args) click to toggle source
# File lib/hubcap/server.rb, line 22
def application(*args)
  raise(Hubcap::ServerSubgroupDisallowed, 'application')
end
application_parent() click to toggle source
# File lib/hubcap/server.rb, line 37
def application_parent
  p = self
  while p && p != hub
    return p  if p.kind_of?(Hubcap::Application)
    p = p.instance_variable_get(:@parent)
  end
  nil
end
group(*args) click to toggle source
# File lib/hubcap/server.rb, line 32
def group(*args)
  raise(Hubcap::ServerSubgroupDisallowed, 'group')
end
server(*args) click to toggle source
# File lib/hubcap/server.rb, line 27
def server(*args)
  raise(Hubcap::ServerSubgroupDisallowed, 'server')
end
yaml() click to toggle source
# File lib/hubcap/server.rb, line 47
def yaml
  { 'classes' => puppet_roles, 'parameters' => params }.to_yaml
end