Class: Veewee::Command::Fusion

Inherits:
GroupBase
  • Object
show all
Defined in:
lib/veewee/command/fusion.rb,
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



8
9
10
11
12
13
14
15
# File 'lib/veewee/command/fusion.rb', line 8

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



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

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



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

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



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

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 succesfully 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



38
39
40
41
42
# File 'lib/veewee/command/fusion.rb', line 38

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



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

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



47
48
49
50
51
# File 'lib/veewee/command/fusion.rb', line 47

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

#listObject



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

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



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

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



64
65
66
67
68
# File 'lib/veewee/command/fusion.rb', line 64

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



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

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



103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/veewee/command/fusion.rb', line 103

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} succesfully removed",:prefix => false
  rescue Error => ex
    env.ui.error "#{ex}" , :prefix => false
    exit -1
  end
end

#up(box_name) ⇒ Object



56
57
58
59
60
# File 'lib/veewee/command/fusion.rb', line 56

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



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

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



73
74
75
76
77
# File 'lib/veewee/command/fusion.rb', line 73

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