Module: Bosh::Agent::Platform

Defined in:
lib/bosh_agent/platform.rb

Defined Under Namespace

Modules: Centos, Linux, Ubuntu

Class Method Summary collapse

Class Method Details

.platform(platform_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bosh_agent/platform.rb', line 6

def self.platform(platform_name)
  case platform_name
    when 'ubuntu'
      template_dir = File.expand_path(File.join(File.dirname(__FILE__), 'platform/ubuntu/templates'))
      Platform::Linux::Adapter.new(Platform::Linux::Disk.new,
                                   Platform::Linux::Logrotate.new(template_dir),
                                   Platform::Linux::Password.new,
                                   Platform::Ubuntu::Network.new(template_dir))

    when 'centos'
      template_dir = File.expand_path(File.join(File.dirname(__FILE__), 'platform/centos/templates'))
      Platform::Linux::Adapter.new(Platform::Centos::Disk.new,
                                   Platform::Linux::Logrotate.new(template_dir),
                                   Platform::Linux::Password.new,
                                   Platform::Centos::Network.new(template_dir))
    else
      raise UnknownPlatform, "platform '#{platform_name}' not found"
  end
end