Skip to content

Commit

Permalink
Maintenance: remove dead code of DebStyleInterface
Browse files Browse the repository at this point in the history
Now only RH Style are used so this code can be removed
Solves: xenserver#46

Signed-off-by: BenjiReis <[email protected]>
  • Loading branch information
benjamreis authored and GeraldEV committed Aug 18, 2023
1 parent 84557fd commit 3ca3be0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
23 changes: 0 additions & 23 deletions netinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,29 +137,6 @@ def getBroadcast(self):
bcast = output[10:].strip()
return bcast

def writeDebStyleInterface(self, iface, f):
""" Write a Debian-style configuration entry for this interface to
file object f using interface name iface. """

# Debian style interfaces are only used for the installer; dom0 only uses CentOS style
# IPv6 is only enabled through answerfiles and so is not supported here.
assert self.modev6 is None
assert self.mode
iface_vlan = self.getInterfaceName(iface)

if self.mode == self.DHCP:
f.write("iface %s inet dhcp\n" % iface_vlan)
else:
# CA-11825: broadcast needs to be determined for non-standard networks
bcast = self.getBroadcast()
f.write("iface %s inet static\n" % iface_vlan)
f.write(" address %s\n" % self.ipaddr)
if bcast is not None:
f.write(" broadcast %s\n" % bcast)
f.write(" netmask %s\n" % self.netmask)
if self.gateway:
f.write(" gateway %s\n" % self.gateway)

def writeRHStyleInterface(self, iface):
""" Write a RedHat-style configuration entry for this interface to
file object f using interface name iface. """
Expand Down
21 changes: 1 addition & 20 deletions netutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,10 @@ def rankValue(ethx):
relevant.sort(lambda l, r: rankValue(l) - rankValue(r))
return relevant

# writes an 'interfaces' style file given a network configuration object list
def writeDebStyleInterfaceFile(configuration):
filename = '/etc/network/interfaces'
outfile = open(filename, 'w')

outfile.write("auto lo\n")
outfile.write("iface lo inet loopback\n")

for iface in configuration:
configuration[iface].writeDebStyleInterface(iface, outfile)

outfile.close()

def writeRHStyleInterfaceFiles(configuration):
def writeNetInterfaceFiles(configuration):
for iface in configuration:
configuration[iface].writeRHStyleInterface(iface)

def writeNetInterfaceFiles(configuration):
if os.path.isfile('/etc/sysconfig/network-scripts/ifcfg-lo'):
writeRHStyleInterfaceFiles(configuration)
else:
writeDebStyleInterfaceFile(configuration)

# writes DNS server entries to a resolver file given a network configuration object
# list
def writeResolverFile(configuration, filename):
Expand Down

0 comments on commit 3ca3be0

Please sign in to comment.