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, #firewalls, #host, #ident, #ipsec, #mtu, #name, #priority, #simple_name, #tags, #tags=, #template, #vrrp, #vrrp=

Constructor Details

#initialize(host) ⇒ HostDelegate

Returns a new instance of HostDelegate.



135
136
137
138
139
140
141
142
143
# File 'lib/construqt/flavour/delegates.rb', line 135

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.



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

def bgps
  @bgps
end

#ipsecsObject (readonly)

Returns the value of attribute ipsecs.



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

def ipsecs
  @ipsecs
end

#usersObject (readonly)

Returns the value of attribute users.



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

def users
  @users
end

Instance Method Details

#_identObject



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

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

#add_bgp(bgp) ⇒ Object



186
187
188
# File 'lib/construqt/flavour/delegates.rb', line 186

def add_bgp(bgp)
  @bgps << bgp
end

#add_ipsec(ipsec) ⇒ Object



182
183
184
# File 'lib/construqt/flavour/delegates.rb', line 182

def add_ipsec(ipsec)
  @ipsecs << ipsec
end

#commitObject



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/construqt/flavour/delegates.rb', line 190

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



178
179
180
# File 'lib/construqt/flavour/delegates.rb', line 178

def configip
  self.delegate.configip
end

#configip=(id) ⇒ Object



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

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

#flavourObject



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

def flavour
  self.delegate.flavour
end

#idObject



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

def id
  self.delegate.id
end

#id=(id) ⇒ Object



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

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

#interfacesObject



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

def interfaces
  self.delegate.interfaces
end

#regionObject



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

def region
  self.delegate.region
end

#resultObject



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

def result
  self.delegate.result
end