Class: Vagrant::Smartos::Zones::Cap::CreateGZVnic
- Inherits:
-
Base
- Object
- Base
- Vagrant::Smartos::Zones::Cap::CreateGZVnic
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
Instance Method Details
#create_vnic_script ⇒ Object
34
35
36
|
# File 'lib/vagrant/smartos/zones/cap/create_gz_vnic.rb', line 34
def create_vnic_script
File.join(local_files_folder, 'gz_vnic', 'create_gz_vnic')
end
|
#execute ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/vagrant/smartos/zones/cap/create_gz_vnic.rb', line 11
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, tmp_script)
machine.communicate.execute('sed -i -e \'s@<gz_addr>@%s@\' %s' % [network.gz_addr, tmp_script])
machine.communicate.execute('sed -i -e \'s@<zone_network>@%s@\' %s' % [network.zone_network, tmp_script])
machine.communicate.execute('sed -i -e \'s@<gz_ip>@%s@\' %s' % [network.gz_stub_ip, tmp_script])
machine.communicate.upload(vnic_smf_manifest, '%s/create-gz-vnic.xml' % vm_tmp_folder)
machine.communicate.execute("#{sudo} mv %s /opt/custom/method" % tmp_script)
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_folder ⇒ Object
30
31
32
|
# File 'lib/vagrant/smartos/zones/cap/create_gz_vnic.rb', line 30
def local_files_folder
File.expand_path('../../../../../../files', __FILE__)
end
|
#network ⇒ Object
38
39
40
|
# File 'lib/vagrant/smartos/zones/cap/create_gz_vnic.rb', line 38
def network
@network ||= Models::Network.new(machine.env)
end
|
#tmp_script ⇒ Object
42
43
44
|
# File 'lib/vagrant/smartos/zones/cap/create_gz_vnic.rb', line 42
def tmp_script
'%s/create_gz_vnic' % vm_tmp_folder
end
|
#vm_tmp_folder ⇒ Object
50
51
52
|
# File 'lib/vagrant/smartos/zones/cap/create_gz_vnic.rb', line 50
def vm_tmp_folder
'/usbkey/vagrant'
end
|
#vnic_smf_manifest ⇒ Object
46
47
48
|
# File 'lib/vagrant/smartos/zones/cap/create_gz_vnic.rb', line 46
def vnic_smf_manifest
File.join(local_files_folder, 'smf', 'create-gz-vnic.xml')
end
|