Skip to content

Commit

Permalink
fix: vtype
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkProminic committed Jan 6, 2023
1 parent 819916c commit 3169e95
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/vagrant-zones/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ def boot(uii)
end

# This filters the VM usage for VNIC Naming Purposes
def vtype(_uii)
config = @machine.provider_config
def vtype(config)
case config.vm_type
when /template/
'1'
Expand Down Expand Up @@ -253,7 +252,7 @@ def allowedaddress(uii, opts)
# This Sanitizes the VNIC Name
def vname(uii, opts)
config = @machine.provider_config
vnic_name = "vnic#{nictype(opts)}#{vtype(uii)}_#{config.partition_id}_#{opts[:nic_number]}"
vnic_name = "vnic#{nictype(opts)}#{vtype(config)}_#{config.partition_id}_#{opts[:nic_number]}"
uii.info(I18n.t('vagrant_zones.vnic_name') + vnic_name) if config.debug
vnic_name
end
Expand All @@ -266,7 +265,7 @@ def get_ip_address(_function)
responses = []
nic_type = nictype(opts)
if opts[:dhcp4] && opts[:managed]
vnic_name = "vnic#{nic_type}#{vtype}_#{config.partition_id}_#{opts[:nic_number]}"
vnic_name = "vnic#{nic_type}#{vtype(config)}_#{config.partition_id}_#{opts[:nic_number]}"
PTY.spawn("pfexec zlogin -C #{name}") do |zlogin_read, zlogin_write, pid|
command = "ip -4 addr show dev #{vnic_name} | head -n -1 | tail -1 | awk '{ print $2 }' | cut -f1 -d\"/\" \n"
zlogin_read.expect(/\n/) { zlogin_write.printf(command) }
Expand Down

0 comments on commit 3169e95

Please sign in to comment.