Class: Host

Inherits:
Object
  • Object
show all
Defined in:
lib/open-dock/providers.rb

Instance Method Summary collapse

Constructor Details

#initialize(host_name) ⇒ Host

Returns a new instance of Host.



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/open-dock/providers.rb', line 48

def initialize(host_name)
  @host = host_name
  config_file = "#{Ops::HOSTS_DIR}/#{host_name}.yml"
  begin
    @config = YAML.load_file "#{config_file}"
    @config["name"]= host_name
  rescue
    raise "Please, create '#{config_file}' file with token value"
  end
  @provider = ProviderFactory.build @config["provider"]
end

Instance Method Details

#createObject



59
60
61
# File 'lib/open-dock/providers.rb', line 59

def create
  @provider.create @config
end

#deleteObject



62
63
64
# File 'lib/open-dock/providers.rb', line 62

def delete
  @provider.delete @host
end