Skip to content

Commit c04e6b2

Browse files
author
jvazquez-r7
committed
Reduce code complexity on check_ipv6
1 parent f339510 commit c04e6b2

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

modules/post/windows/manage/portproxy.rb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,18 @@ def check_ipv6
9595
if ipv6_installed()
9696
print_status("IPv6 is already installed.")
9797
return true
98+
elsif not datastore['IPV6_XP']
99+
print_error("IPv6 is not installed. You need IPv6 to use portproxy.")
100+
return false
98101
else
99-
if not datastore['IPV6_XP']
100-
print_error("IPv6 is not installed. You need IPv6 to use portproxy.")
102+
print_status("Installing IPv6 ...")
103+
cmd_exec("netsh","interface ipv6 install",120)
104+
if not ipv6_installed
105+
print_error("IPv6 was not successfully installed. Run it again.")
101106
return false
102-
else
103-
print_status("Installing IPv6 ...")
104-
cmd_exec("netsh","interface ipv6 install",120)
105-
if not ipv6_installed
106-
print_error("IPv6 was not successfully installed. Run it again.")
107-
return false
108-
end
109-
print_good("IPv6 was successfully installed.")
110-
return true
111107
end
108+
print_good("IPv6 was successfully installed.")
109+
return true
112110
end
113111
end
114112

0 commit comments

Comments
 (0)