First fix didn't work correctly.
Now, the ip address will be removed, if there (from dhcp) and re-configured with the given value.
This commit is contained in:
parent
5036326319
commit
fe3a380823
|
@ -19,9 +19,10 @@ module VagrantPlugins
|
|||
#machine.communicate.execute("#{ifconfig_cmd} up")
|
||||
#machine.communicate.execute("#{su_cmd} sh -c \"echo '#{network[:ip]}' > /etc/hostname.#{device}\"")
|
||||
# ipadm create-addr -T static -a local=172.16.10.15/24 net2/v4
|
||||
if not machine.communicate.test("ipadm | grep #{network[:ip]} | tr -s ' ' | cut -d ' ' -f 4")
|
||||
machine.communicate.execute("#{su_cmd} ipadm create-addr -T static -a #{network[:ip]}/#{cidr} #{device}/v4")
|
||||
if machine.communicate.test("ipadm | grep net1/v4")
|
||||
machine.communicate.execute("#{su_cmd} ipadm delete-addr net1/v4")
|
||||
end
|
||||
machine.communicate.execute("#{su_cmd} ipadm create-addr -T static -a #{network[:ip]}/#{cidr} #{device}/v4")
|
||||
elsif network[:type].to_sym == :dhcp
|
||||
#machine.communicate.execute("#{ifconfig_cmd} dhcp start")
|
||||
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