|
1 | 1 | #! /opt/stack/bin/python |
2 | 2 | # |
3 | 3 | # @copyright@ |
4 | | -# Copyright (c) 2006 - 2019 Teradata |
| 4 | +# Copyright (c) 2006 - 2020 Teradata |
5 | 5 | # All rights reserved. Stacki(r) v5.x stacki.com |
6 | 6 | # https://github.com/Teradata/stacki/blob/master/LICENSE.txt |
7 | 7 | # @copyright@ |
|
16 | 16 | import socket |
17 | 17 | from xml.etree.ElementTree import Element, SubElement, ElementTree |
18 | 18 |
|
19 | | - |
20 | 19 | class Attr: |
21 | 20 | Info_FQDN = "" |
22 | 21 | Kickstart_Keyboard = "us" |
@@ -131,10 +130,11 @@ def setNetwork(self, interface, mac, addr, netmask): |
131 | 130 | if os.path.exists(ifDhcpFile): |
132 | 131 | os.remove(ifDhcpFile) |
133 | 132 | # Force network reconfiguration |
134 | | - cmd = ['/sbin/ifconfig', interface, addr, 'netmask', netmask] |
| 133 | + ip_mask = ipaddress.ip_interface(join(addr,'/',netmask)) |
| 134 | + cmd = ['/sbin/ip', 'addr', 'add', ip_mask.with_prefixlen, 'dev', interface] |
135 | 135 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE) |
136 | 136 | # Bring up network |
137 | | - cmd = ['/sbin/ifconfig', interface, 'up'] |
| 137 | + cmd = ['/sbin/ip', 'link', 'set', interface, 'up'] |
138 | 138 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE) |
139 | 139 |
|
140 | 140 | def setHostname(self, hostname): |
|
0 commit comments