- FIX for #10594 (more logical flow)
This commit is contained in:
parent
d565f628fd
commit
2d9ba0e906
|
@ -14,12 +14,12 @@ module VagrantPlugins
|
||||||
cidr = mask.split(".").map { |e| e.to_i.to_s(2).rjust(8, "0") }.join.count("1").to_s
|
cidr = mask.split(".").map { |e| e.to_i.to_s(2).rjust(8, "0") }.join.count("1").to_s
|
||||||
|
|
||||||
if network[:type].to_sym == :static
|
if network[:type].to_sym == :static
|
||||||
if machine.communicate.test("ipadm | grep #{device}/v4")
|
|
||||||
machine.communicate.execute("#{su_cmd} ipadm delete-addr #{device}/v4")
|
|
||||||
end
|
|
||||||
unless machine.communicate.test("ipadm show-if #{device}")
|
unless machine.communicate.test("ipadm show-if #{device}")
|
||||||
machine.communicate.execute("#{su_cmd} ipadm create-ip #{device}")
|
machine.communicate.execute("#{su_cmd} ipadm create-ip #{device}")
|
||||||
end
|
end
|
||||||
|
if machine.communicate.test("ipadm | grep #{device}/v4")
|
||||||
|
machine.communicate.execute("#{su_cmd} ipadm delete-addr #{device}/v4")
|
||||||
|
end
|
||||||
machine.communicate.execute("#{su_cmd} ipadm create-addr -T static -a #{network[:ip]}/#{cidr} #{device}/v4")
|
machine.communicate.execute("#{su_cmd} ipadm create-addr -T static -a #{network[:ip]}/#{cidr} #{device}/v4")
|
||||||
elsif network[:type].to_sym == :dhcp
|
elsif network[:type].to_sym == :dhcp
|
||||||
if machine.communicate.test("ipadm show-if -o all | grep #{device} | tr -s ' ' | cut -d ' ' -f 6 | grep '4\|6'")
|
if machine.communicate.test("ipadm show-if -o all | grep #{device} | tr -s ' ' | cut -d ' ' -f 6 | grep '4\|6'")
|
||||||
|
|
Loading…
Reference in New Issue