Class: Mccloud::Provider::Host::Provider

Inherits:
Core::Provider show all
Includes:
ProviderCommand
Defined in:
lib/mccloud/provider/host/provider.rb

Instance Attribute Summary collapse

Attributes inherited from Core::Provider

#env, #namespace

Instance Method Summary collapse

Methods included from ProviderCommand

#status

Methods inherited from Core::Provider

#check_gem_availability, #filter, #get_component, #hosts, #method_missing, #on_selected_components

Constructor Details

#initialize(name, options, env) ⇒ Provider

Returns a new instance of Provider.



20
21
22
23
24
25
26
27
28
29
# File 'lib/mccloud/provider/host/provider.rb', line 20

def initialize(name,options,env)

  super(name,options,env)

  @vms=Hash.new

  @options=options
  @flavor=self.class.to_s.split("::")[-2]
  @name=name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Mccloud::Provider::Core::Provider

Instance Attribute Details

#flavorObject

Returns the value of attribute flavor.



11
12
13
# File 'lib/mccloud/provider/host/provider.rb', line 11

def flavor
  @flavor
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/mccloud/provider/host/provider.rb', line 10

def name
  @name
end

#optionsObject

Returns the value of attribute options.



13
14
15
# File 'lib/mccloud/provider/host/provider.rb', line 13

def options
  @options
end

#vmsObject

Returns the value of attribute vms.



15
16
17
# File 'lib/mccloud/provider/host/provider.rb', line 15

def vms
  @vms
end

Instance Method Details

#bootstrap(selection, script, options) ⇒ Object



41
42
43
44
45
46
# File 'lib/mccloud/provider/host/provider.rb', line 41

def bootstrap(selection,script,options)
  on_selected_components("vm",selection) do |id,vm|
    vm._bootstrap(script,options)
  end

end

#destroy(selection, options) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/mccloud/provider/host/provider.rb', line 48

def destroy(selection,options)

  on_selected_components("vm",selection) do |id,vm|
    vm.destroy(options)
  end

end

#halt(selection, options) ⇒ Object



74
75
76
77
78
79
80
# File 'lib/mccloud/provider/host/provider.rb', line 74

def halt(selection,options)
  on_selected_components("vm",selection) do |id,vm|
    env.ui.info "Matched #{vm.name}"
    vm.halt(options)
  end

end

#provision(selection, options) ⇒ Object



66
67
68
69
70
71
72
# File 'lib/mccloud/provider/host/provider.rb', line 66

def provision(selection,options)

  on_selected_components("vm",selection) do |id,vm|
    vm._provision(options)
  end

end

#rawObject



31
32
33
34
# File 'lib/mccloud/provider/host/provider.rb', line 31

def raw
  # We don't use this
  @raw=nil
end

#ssh(selection, command, options) ⇒ Object



56
57
58
59
60
61
62
# File 'lib/mccloud/provider/host/provider.rb', line 56

def ssh(selection,command,options)

  on_selected_components("vm",selection) do |id,vm|
    vm.ssh(command,options)
  end

end

#up(selection, options) ⇒ Object



35
36
37
38
39
# File 'lib/mccloud/provider/host/provider.rb', line 35

def up(selection,options)
  on_selected_components("vm",selection) do |id,vm|
    vm.up(options)
  end
end