Class: Vagrant::Smartos::Zones::Cap::ZoneGate::Install

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

Constant Summary collapse

LOCAL_FILES_FOLDER =
File.expand_path('../../../../../../../files', __FILE__)
LOCAL_ZONEGATE_FOLDER =
File.join(LOCAL_FILES_FOLDER, 'zonegate')
LOCAL_SMF_MANIFEST =
File.join(LOCAL_FILES_FOLDER, 'smf', 'zonegate.xml')
SMF_TMP_FOLDER =
'/usbkey/vagrant'
SMF_FOLDER =
'/opt/custom/smf'
ZONEGATE_FOLDER =
'/opt/custom/method'

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_zonegate_folderObject



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

def create_zonegate_folder
  machine.communicate.execute("#{sudo} mkdir -p %s/zonegate" % ZONEGATE_FOLDER)
  machine.communicate.execute("#{sudo} chown vagrant:other %s/zonegate" % ZONEGATE_FOLDER)
end

#executeObject



18
19
20
21
22
23
24
# File 'lib/vagrant/smartos/zones/cap/zone_gate/install.rb', line 18

def execute
  ui.info 'Installing ZoneGate'

  create_zonegate_folder
  upload_zonegate
  install_zonegate
end

#install_zonegateObject



37
38
39
40
41
# File 'lib/vagrant/smartos/zones/cap/zone_gate/install.rb', line 37

def install_zonegate
  machine.communicate.execute("#{sudo} mv %s/zonegate.xml %s/zonegate.xml" % [SMF_TMP_FOLDER, SMF_FOLDER])
  machine.communicate.execute("#{sudo} chown root:root %s/zonegate.xml" % SMF_FOLDER)
  machine.communicate.execute("#{sudo} svccfg import %s/zonegate.xml" % SMF_FOLDER)
end

#upload_zonegateObject



31
32
33
34
35
# File 'lib/vagrant/smartos/zones/cap/zone_gate/install.rb', line 31

def upload_zonegate
  machine.communicate.upload(LOCAL_ZONEGATE_FOLDER, ZONEGATE_FOLDER)
  machine.communicate.execute("#{sudo} chmod 0755 %s/zonegate/*" % ZONEGATE_FOLDER)
  machine.communicate.upload(LOCAL_SMF_MANIFEST, '%s/zonegate.xml' % SMF_TMP_FOLDER)
end