Skip to content

Commit 387bd31

Browse files
author
Meg M Kido
committed
FEATURE: STACKI-1631 no more ifconfig
1 parent 11e8d25 commit 387bd31

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

common/src/stack/pylib/stack/wizard.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#! /opt/stack/bin/python
22
#
33
# @copyright@
4-
# Copyright (c) 2006 - 2019 Teradata
4+
# Copyright (c) 2006 - 2020 Teradata
55
# All rights reserved. Stacki(r) v5.x stacki.com
66
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
77
# @copyright@
@@ -15,7 +15,7 @@
1515
import ipaddress
1616
import socket
1717
from xml.etree.ElementTree import Element, SubElement, ElementTree
18-
18+
import ipaddress
1919

2020
class Attr:
2121
Info_FQDN = ""
@@ -131,10 +131,11 @@ def setNetwork(self, interface, mac, addr, netmask):
131131
if os.path.exists(ifDhcpFile):
132132
os.remove(ifDhcpFile)
133133
# Force network reconfiguration
134-
cmd = ['/sbin/ifconfig', interface, addr, 'netmask', netmask]
134+
ip_mask = ipaddress.ip_interface(join(addr,'/',netmask))
135+
cmd = ['/sbin/ip', 'addr', 'add', ip_mask.with_prefixlen, 'dev', interface]
135136
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
136137
# Bring up network
137-
cmd = ['/sbin/ifconfig', interface, 'up']
138+
cmd = ['/sbin/ip', 'link', 'set', interface, 'up']
138139
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
139140

140141
def setHostname(self, hostname):

0 commit comments

Comments
 (0)