Skip to content

Commit

Permalink
Merge pull request #122 from dtantsur/netaddr
Browse files Browse the repository at this point in the history
Drop the dependency on netaddr
  • Loading branch information
tbreeds authored Jan 15, 2020
2 parents 08caaf7 + 79f5569 commit cb4c25b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 4 additions & 4 deletions hardware/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import argparse
import fcntl
import ipaddress
import json
import os
import pprint
Expand All @@ -32,8 +33,6 @@
import uuid
import xml.etree.ElementTree as ET

from netaddr import IPNetwork

from hardware import areca
from hardware.benchmark import cpu as bm_cpu
from hardware.benchmark import disk as bm_disk
Expand Down Expand Up @@ -573,9 +572,10 @@ def find_element(xml, xml_spec, sys_subtype,
cidr = get_cidr(netmask)
hw_lst.append(
('network', name.text, 'ipv4-cidr', cidr))
net = (ipaddress.IPv4Interface('%s/%s' % (ipv4, cidr))
.network.network_address)
hw_lst.append(
('network', name.text, 'ipv4-network',
"%s" % IPNetwork('%s/%s' % (ipv4, cidr)).network))
('network', name.text, 'ipv4-network', str(net)))
except Exception as excpt:
sys.stderr.write('unable to get info for %s: %s\n'
% (name.text, str(excpt)))
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

pbr>=1.0 # Apache-2.0
six # MIT
ipaddress # PSF
netaddr # BSD
pexpect # ISC
numpy # BSD
pandas # BSD

0 comments on commit cb4c25b

Please sign in to comment.