Class: Veewee::Command::Fusion

Inherits:
GroupBase
  • Object
show all
Defined in:
lib/veewee/command/fusion.rb

Instance Attribute Summary

Attributes inherited from GroupBase

#env

Instance Method Summary collapse

Methods inherited from GroupBase

#initialize, register

Methods included from Helpers

#initialize_environment

Constructor Details

This class inherits a constructor from Veewee::Command::GroupBase

Instance Method Details

#add_share(box_name, share_name, share_path) ⇒ Object



158
159
160
161
162
163
164
165
# File 'lib/veewee/command/fusion.rb', line 158

def add_share(box_name, share_name, share_path)
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
#          command="#{File.dirname().shellescape}/vmware-vdiskmanager -c -s #{definition.disk_size}M -a lsilogic -t #{disk_type} #{name}.vmdk"
#          shell_results=shell_exec("#{command}",{:mute => true})
  venv.providers["vmfusion"].get_box(box_name).add_share(share_name, share_path)

end

#build(box_name) ⇒ Object



17
18
19
20
21
# File 'lib/veewee/command/fusion.rb', line 17

def build(box_name)
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.providers["vmfusion"].get_box(box_name).build(options)
end

#copy(box_name, src, dst) ⇒ Object



70
71
72
73
74
# File 'lib/veewee/command/fusion.rb', line 70

def copy(box_name,src,dst)
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.providers["vmfusion"].get_box(box_name).copy_to_box(src,dst)
end

#define(definition_name, template_name) ⇒ Object



81
82
83
84
85
86
87
88
# File 'lib/veewee/command/fusion.rb', line 81

def define(definition_name, template_name)
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.definitions.define(definition_name,template_name,options)
  env.ui.info "The basebox '#{definition_name}' has been successfully created from the template '#{template_name}'"
  env.ui.info "You can now edit the definition files stored in definitions/#{definition_name} or build the box with:"
  env.ui.info "veewee fusion build '#{definition_name}'"
end

#destroy(box_name) ⇒ Object



27
28
29
30
31
# File 'lib/veewee/command/fusion.rb', line 27

def destroy(box_name)
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.providers["vmfusion"].get_box(box_name).destroy(options)
end

#export(box_name) ⇒ Object



127
128
129
130
131
# File 'lib/veewee/command/fusion.rb', line 127

def export(box_name)
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.providers["vmfusion"].get_box(box_name).export_ova(options)
end

#halt(box_name) ⇒ Object



36
37
38
39
40
# File 'lib/veewee/command/fusion.rb', line 36

def halt(box_name)
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.providers["vmfusion"].get_box(box_name).halt(options)
end

#listObject



147
148
149
150
151
152
153
154
# File 'lib/veewee/command/fusion.rb', line 147

def list
  env.ui.info "The following local definitions are available:",:prefix => false
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.definitions.each do |name,definition|
    env.ui.info "- #{name}"
  end
end

#ostypesObject



116
117
118
119
120
121
122
# File 'lib/veewee/command/fusion.rb', line 116

def ostypes
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.ostypes.each do |name|
    env.ui.info "- #{name}"
  end
end

#ssh(box_name, command = nil) ⇒ Object



53
54
55
56
57
# File 'lib/veewee/command/fusion.rb', line 53

def ssh(box_name,command=nil)
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.providers["vmfusion"].get_box(box_name).issh(command)
end

#templatesObject



136
137
138
139
140
141
142
143
# File 'lib/veewee/command/fusion.rb', line 136

def templates
  env.ui.info "The following templates are available:",:prefix => false
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.templates.each do |name,template|
    env.ui.info "veewee fusion define '<box_name>' '#{name}'",:prefix => false
  end
end

#undefine(definition_name) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/veewee/command/fusion.rb', line 92

def undefine(definition_name)
  env.ui.info "Removing definition #{definition_name}" , :prefix => false
  begin
    venv=Veewee::Environment.new(options)
    venv.ui=env.ui
    venv.definitions.undefine(definition_name,options)
    env.ui.info "Definition #{definition_name} successfully removed",:prefix => false
  rescue Error => ex
    env.ui.error "#{ex}" , :prefix => false
    exit -1
  end
end

#up(box_name) ⇒ Object



45
46
47
48
49
# File 'lib/veewee/command/fusion.rb', line 45

def up(box_name)
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.providers["vmfusion"].get_box(box_name).up(options)
end

#validate(box_name) ⇒ Object



108
109
110
111
112
# File 'lib/veewee/command/fusion.rb', line 108

def validate(box_name)
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.providers["vmfusion"].get_box(box_name).validate_vmfusion(options)
end

#winrm(box_name, command = nil) ⇒ Object



62
63
64
65
66
# File 'lib/veewee/command/fusion.rb', line 62

def winrm(box_name,command=nil)
  venv=Veewee::Environment.new(options)
  venv.ui=env.ui
  venv.providers["vmfusion"].get_box(box_name).winrm(command,{:exitcode => "*"})
end