Skip to content

Commit aaa994b

Browse files
Simple fixes and code formatting
1 parent de8d94f commit aaa994b

File tree

9 files changed

+13
-8
lines changed

9 files changed

+13
-8
lines changed

systemvm/debian/opt/cloud/bin/configure.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
import os
2222
import re
2323
import sys
24-
import urllib.request, urllib.parse, urllib.error
2524
import time
2625

26+
from urllib import *
27+
2728
from collections import OrderedDict
2829
from fcntl import flock, LOCK_EX, LOCK_UN
2930

@@ -68,7 +69,7 @@ def __update(self, vm_ip, password):
6869
data = urllib.parse.urlencode(payload)
6970
request = urllib.request.Request(url, data=data, headers={"DomU_Request": "save_password"})
7071
try:
71-
resp = urllib.request.urlopen(request, data)
72+
resp = urllib.urlopen(request, data)
7273
logging.debug("Update password server result: http:%s, content:%s" % (resp.code, resp.read()))
7374
except Exception as e:
7475
logging.error("Failed to update password server due to: %s" % e)

systemvm/debian/opt/cloud/bin/cs/CsDhcp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def add(self, entry):
180180
self.dhcp_opts.add("%s,%s" % (tag, 6))
181181
self.dhcp_opts.add("%s,%s" % (tag, 15))
182182

183-
i = IPAddress(entry['ipv4_address'])
183+
i = ip_address(entry['ipv4_address'])
184184
# Calculate the device
185185
for v in self.devinfo:
186186
if i > v['network'].network and i < v['network'].broadcast:

systemvm/debian/opt/cloud/bin/cs/CsHelper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717
# under the License.
1818
""" General helper functions
1919
for use in the configuration process
20-
2120
"""
2221
import subprocess
2322
import logging
2423
import sys
2524
import os.path
2625
import re
2726
import shutil
28-
from ipaddress import *
27+
from netaddr import *
2928

3029
PUBLIC_INTERFACES = {"router": "eth2", "vpcrouter": "eth1"}
3130

systemvm/debian/opt/cloud/bin/cs/CsNetfilter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from .CsDatabag import CsCmdLine
2020
import logging
2121

22+
2223
class CsChain(object):
2324

2425
def __init__(self):

systemvm/debian/opt/cloud/bin/cs_dhcp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import logging
1919
from ipaddress import *
2020

21+
2122
def merge(dbag, data):
2223
# A duplicate ip address wil clobber the old value
2324
# This seems desirable ....

systemvm/debian/opt/cloud/bin/cs_ip.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ def merge(dbag, ip):
5151
if mac_address in device_map:
5252
nic_dev_id = device_map[mac_address]
5353
ip['device'] = 'eth' + str(nic_dev_id)
54-
ip['broadcast'] = str(ipo.broadcast)
55-
ip['cidr'] = str(ipo.ip) + '/' + str(ipo.prefixlen)
54+
ip['broadcast'] = str(ipo.broadcast_address)
55+
ip['cidr'] = str(ipo.network_address) + '/' + str(ipo.prefixlen)
5656
ip['size'] = str(ipo.prefixlen)
57-
ip['network'] = str(ipo.network) + '/' + str(ipo.prefixlen)
57+
ip['network'] = str(ipo.network_address) + '/' + str(ipo.prefixlen)
5858
if 'nw_type' not in list(ip.keys()):
5959
ip['nw_type'] = 'public'
6060
else:

systemvm/debian/opt/cloud/bin/cs_monitorservice.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from ipaddress import *
1919

20+
2021
def merge(dbag, data):
2122

2223
if "config" in data:

systemvm/debian/opt/cloud/bin/cs_network_acl.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from ipaddress import *
1919

20+
2021
def merge(dbag, data):
2122
dbag[data['device']] = data
2223
return dbag

systemvm/debian/opt/cloud/bin/cs_vmp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from ipaddress import *
1919

20+
2021
def merge(dbag, data):
2122
"""
2223
create a dictionary of values new in data ignoring those in dbag and return it

0 commit comments

Comments
 (0)