Class: Vagrant::Smartos::Zones::Util::Zones

Inherits:
Object
  • Object
show all
Includes:
GlobalZone::Helper
Defined in:
lib/vagrant/smartos/zones/util/zones.rb

Overview

Service object for creating zones

Wraps up creation of associated things within a zone

Constant Summary collapse

ROOT_PASSWORD =
'\$5\$90x8mAeX\$SKKNEjeztV.ruPBNf/E5y3xqGkwDv9A5KNP2S89GuB.'
VAGRANT_PASSWORD =
'\$5\$UzQ1rHU/\$o67DYOyHOOabzJt.6DwgZP2qCGoAO7aVel2bgkuIwL7'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from GlobalZone::Helper

included, #sudo, #with_gz

Constructor Details

#initialize(machine) ⇒ Zones

Returns a new instance of Zones.



25
26
27
# File 'lib/vagrant/smartos/zones/util/zones.rb', line 25

def initialize(machine)
  @machine = machine
end

Instance Attribute Details

#machineObject (readonly)

Returns the value of attribute machine.



20
21
22
# File 'lib/vagrant/smartos/zones/util/zones.rb', line 20

def machine
  @machine
end

Instance Method Details

#create(name) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/vagrant/smartos/zones/util/zones.rb', line 29

def create(name)
  machine.ui.info "Creating zone #{machine.config.zone.name} with image #{zone_json.image}"
  with_gz("echo '#{zone_json.to_json}' | #{sudo} vmadm create")
  with_zone(name) do |zone|
    create_zone_users(zone)
    configure_pkgsrc_mirror(zone)
  end
end

#update(name) ⇒ Object



38
39
40
41
42
43
# File 'lib/vagrant/smartos/zones/util/zones.rb', line 38

def update(name)
  with_zone(name) do |zone|
    machine.ui.info "Updating zone #{name}..."
    with_gz("echo '#{zone_json.to_json}' | #{sudo} vmadm update #{zone.uuid}")
  end
end