Class: Mccloud::Provider::Vagrant::Provider
Defined Under Namespace
Classes: LogEnvironment
Instance Attribute Summary collapse
#env, #namespace
Instance Method Summary
collapse
-
#bootstrap(selection, command, options) ⇒ Object
-
#destroy(selection, options) ⇒ Object
-
#halt(selection, options) ⇒ Object
-
#initialize(name, options, env) ⇒ Provider
constructor
A new instance of Provider.
-
#provision(selection, options) ⇒ Object
-
#raw ⇒ Object
-
#reload(selection, options) ⇒ Object
-
#ssh(selection, command, options) ⇒ Object
-
#suspend(selection, options) ⇒ Object
-
#up(selection, options) ⇒ Object
#status
#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
30
31
32
33
34
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 20
def initialize(name,options,env)
super(name,options,env)
@options=options
@flavor=self.class.to_s.split("::")[-2]
@name=name
@vms=Hash.new
required_gems=%w{vagrant}
check_gem_availability(required_gems)
require 'vagrant'
require 'vagrant/cli'
end
|
Instance Attribute Details
#flavor ⇒ Object
Returns the value of attribute flavor.
11
12
13
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 11
def flavor
@flavor
end
|
#name ⇒ Object
Returns the value of attribute name.
10
11
12
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 10
def name
@name
end
|
#options ⇒ Object
Returns the value of attribute options.
13
14
15
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 13
def options
@options
end
|
#vms ⇒ Object
Returns the value of attribute vms.
15
16
17
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 15
def vms
@vms
end
|
Instance Method Details
#bootstrap(selection, command, options) ⇒ Object
72
73
74
75
76
77
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 72
def bootstrap(selection,command,options)
on_selected_components("vm",selection) do |id,vm|
vm.bootstrap(command,options)
end
end
|
#destroy(selection, options) ⇒ Object
79
80
81
82
83
84
85
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 79
def destroy(selection,options)
on_selected_components("vm",selection) do |id,vm|
vm.destroy(options)
end
end
|
#halt(selection, options) ⇒ Object
119
120
121
122
123
124
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 119
def halt(selection,options)
on_selected_components("vm",selection) do |id,vm|
vm.halt(options)
end
end
|
#provision(selection, options) ⇒ Object
111
112
113
114
115
116
117
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 111
def provision(selection,options)
on_selected_components("vm",selection) do |id,vm|
vm._provision(options)
end
end
|
#raw ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 43
def raw
if @raw.nil?
begin
@raw=LogEnvironment.new(:cwd => ".",:ui_class => ::Vagrant::UI::Colored)
require 'logger'
vlogger=::Logger.new(STDOUT)
vlogger.formatter=Proc.new do |severity, datetime, progname, msg|
"#{datetime} - #{progname} - #{msg}\n"
end
@raw.logger=vlogger
@raw.load!
rescue ArgumentError => e
env.ui.error "Error loading raw provider : #{e.to_s} #{$!}"
@raw=nil
end
end
return @raw
end
|
#reload(selection, options) ⇒ Object
87
88
89
90
91
92
93
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 87
def reload(selection,options)
on_selected_components("vm",selection) do |id,vm|
vm.reload(options)
end
end
|
#ssh(selection, command, options) ⇒ Object
103
104
105
106
107
108
109
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 103
def ssh(selection,command,options)
on_selected_components("vm",selection) do |id,vm|
vm.ssh(command,options)
end
end
|
#suspend(selection, options) ⇒ Object
95
96
97
98
99
100
101
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 95
def suspend(selection,options)
on_selected_components("vm",selection) do |id,vm|
vm.suspend(options)
end
end
|
#up(selection, options) ⇒ Object
66
67
68
69
70
|
# File 'lib/mccloud/provider/vagrant/provider.rb', line 66
def up(selection,options)
on_selected_components("vm",selection) do |id,vm|
vm.up(options)
end
end
|