Class: Construqt::Flavour::HostDelegate

Inherits:
Object
  • Object
show all
Includes:
Delegate
Defined in:
lib/construqt/flavour/delegates.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Delegate

#address, #build_config, #cable, #cable=, #clazz, #default_name, #delegate, #delegate=, #description, #host, #ident, #name, #priority, #simple_name, #tags, #tags=, #template, #vrrp, #vrrp=

Constructor Details

#initialize(host) ⇒ HostDelegate

Returns a new instance of HostDelegate.



122
123
124
125
126
127
128
129
130
# File 'lib/construqt/flavour/delegates.rb', line 122

def initialize(host)
  #binding.pry
  #Construqt.logger.debug "HostDelegate.new(#{host.name})"
  self.delegate = host

  @ipsecs = []
  @bgps = []
  @users = host.users || host.region.users
end

Instance Attribute Details

#bgpsObject (readonly)

Returns the value of attribute bgps.



121
122
123
# File 'lib/construqt/flavour/delegates.rb', line 121

def bgps
  @bgps
end

#ipsecsObject (readonly)

Returns the value of attribute ipsecs.



121
122
123
# File 'lib/construqt/flavour/delegates.rb', line 121

def ipsecs
  @ipsecs
end

#usersObject (readonly)

Returns the value of attribute users.



121
122
123
# File 'lib/construqt/flavour/delegates.rb', line 121

def users
  @users
end

Instance Method Details

#_identObject



132
133
134
135
# File 'lib/construqt/flavour/delegates.rb', line 132

def _ident
  #binding.pry
  "Host_#{self.name}"
end

#add_bgp(bgp) ⇒ Object



173
174
175
# File 'lib/construqt/flavour/delegates.rb', line 173

def add_bgp(bgp)
  @bgps << bgp
end

#add_ipsec(ipsec) ⇒ Object



169
170
171
# File 'lib/construqt/flavour/delegates.rb', line 169

def add_ipsec(ipsec)
  @ipsecs << ipsec
end

#commitObject



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/construqt/flavour/delegates.rb', line 177

def commit
  #header_clazzes = {:host => self } # host class need also a header call
  #footer_clazzes = {:host => self } # host class need also a header call
  #self.interfaces.values.each do |iface|
  #  header_clazzes[iface.class.name] ||= iface if iface.delegate.respond_to? :header
  #  footer_clazzes[iface.class.name] ||= iface if iface.delegate.respond_to? :footer
  #end
  #binding.pry
  self.flavour.pre_clazzes do |key, clazz|
    Flavour.call_aspects("#{key}.header", self, nil)
    clazz.header(self) if clazz.respond_to? :header
  end
  Flavour.call_aspects("host.commit", self, nil)
  self.result.commit

  self.flavour.pre_clazzes do |key, clazz|
    Flavour.call_aspects("#{key}.footer", self, nil)
    clazz.footer(self) if clazz.respond_to? :footer
  end
end

#configipObject



165
166
167
# File 'lib/construqt/flavour/delegates.rb', line 165

def configip
  self.delegate.configip
end

#configip=(id) ⇒ Object



161
162
163
# File 'lib/construqt/flavour/delegates.rb', line 161

def configip=(id)
  self.delegate.configip = id
end

#flavourObject



145
146
147
# File 'lib/construqt/flavour/delegates.rb', line 145

def flavour
  self.delegate.flavour
end

#idObject



157
158
159
# File 'lib/construqt/flavour/delegates.rb', line 157

def id
  self.delegate.id
end

#id=(id) ⇒ Object



153
154
155
# File 'lib/construqt/flavour/delegates.rb', line 153

def id=(id)
  self.delegate.id = id
end

#interfacesObject



149
150
151
# File 'lib/construqt/flavour/delegates.rb', line 149

def interfaces
  self.delegate.interfaces
end

#regionObject



137
138
139
# File 'lib/construqt/flavour/delegates.rb', line 137

def region
  self.delegate.region
end

#resultObject



141
142
143
# File 'lib/construqt/flavour/delegates.rb', line 141

def result
  self.delegate.result
end