Class: Bosh::Bootstrap::Network

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh-bootstrap/network.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider_name, cyoi_provider_client, settings) ⇒ Network

Returns a new instance of Network.



10
11
12
13
14
# File 'lib/bosh-bootstrap/network.rb', line 10

def initialize(provider_name, cyoi_provider_client, settings)
  @provider_name = provider_name
  @cyoi_provider_client = cyoi_provider_client
  @settings = settings
end

Instance Attribute Details

#cyoi_provider_clientObject (readonly)

Returns the value of attribute cyoi_provider_client.



7
8
9
# File 'lib/bosh-bootstrap/network.rb', line 7

def cyoi_provider_client
  @cyoi_provider_client
end

#provider_nameObject (readonly)

Returns the value of attribute provider_name.



6
7
8
# File 'lib/bosh-bootstrap/network.rb', line 6

def provider_name
  @provider_name
end

#settingsObject (readonly)

Returns the value of attribute settings.



8
9
10
# File 'lib/bosh-bootstrap/network.rb', line 8

def settings
  @settings
end

Instance Method Details

#deployObject



16
17
18
# File 'lib/bosh-bootstrap/network.rb', line 16

def deploy
  network_provider.perform(settings)
end

#network_providerObject

Attempt to load and instantiate a NetworkProviders class Else return NetworkProviders::Dummy which does nothing



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/bosh-bootstrap/network.rb', line 22

def network_provider
  @network_provider ||= begin
    begin
      require "bosh-bootstrap/network_providers/#{provider_name}"
      klass = Bosh::Bootstrap::NetworkProviders.provider_class(provider_name)
    rescue LoadError
      klass = Bosh::Bootstrap::NetworkProviders.provider_class("dummy")
    end
    klass.new(cyoi_provider_client)
  end
end