Class: Vagrant::Smartos::Zones::Cap::CreateGZVnic

Inherits:
Base
  • Object
show all
Defined in:
lib/vagrant/smartos/zones/cap/create_gz_vnic.rb

Instance Attribute Summary

Attributes inherited from Base

#machine

Instance Method Summary collapse

Methods inherited from Base

cap_method, #initialize, #sudo, #ui

Constructor Details

This class inherits a constructor from Vagrant::Smartos::Zones::Cap::Base

Instance Method Details

#create_vnic_scriptObject



30
31
32
# File 'lib/vagrant/smartos/zones/cap/create_gz_vnic.rb', line 30

def create_vnic_script
  File.join(local_files_folder, 'gz_vnic', 'create_gz_vnic')
end

#executeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/vagrant/smartos/zones/cap/create_gz_vnic.rb', line 10

def execute
  return unless machine.communicate.test('test -d %s' % vm_tmp_folder)

  ui.info 'Installing vnic in global zone'
  sudo = machine.config.smartos.suexec_cmd

  machine.communicate.upload(create_vnic_script, '%s/create_gz_vnic' % vm_tmp_folder)
  machine.communicate.upload(vnic_smf_manifest, '%s/create-gz-vnic.xml' % vm_tmp_folder)

  machine.communicate.execute("#{sudo} mv %s/create_gz_vnic /opt/custom/method" % vm_tmp_folder)
  machine.communicate.execute("#{sudo} mv %s/create-gz-vnic.xml /opt/custom/smf" % vm_tmp_folder)

  machine.communicate.execute("#{sudo} svccfg import /opt/custom/smf/create-gz-vnic.xml")
  machine.communicate.execute("#{sudo} svcadm enable -s create-gz-vnic")
end

#local_files_folderObject



26
27
28
# File 'lib/vagrant/smartos/zones/cap/create_gz_vnic.rb', line 26

def local_files_folder
  File.expand_path('../../../../../../files', __FILE__)
end

#vm_tmp_folderObject



38
39
40
# File 'lib/vagrant/smartos/zones/cap/create_gz_vnic.rb', line 38

def vm_tmp_folder
  '/usbkey/vagrant'
end

#vnic_smf_manifestObject



34
35
36
# File 'lib/vagrant/smartos/zones/cap/create_gz_vnic.rb', line 34

def vnic_smf_manifest
  File.join(local_files_folder, 'smf', 'create-gz-vnic.xml')
end