X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fprivatebridge.py;h=8e77524a98e17632f1d26087f42933b3c680407d;hb=6f1c653e7f3712cd67d5db796eeae5c35fdddf5f;hp=5ec15b9de610fb66f47c5d43ac827e4ca931ceda;hpb=ac6786141feadccdc48b819ab21a825a54881ded;p=nodemanager.git diff --git a/plugins/privatebridge.py b/plugins/privatebridge.py index 5ec15b9..8e77524 100644 --- a/plugins/privatebridge.py +++ b/plugins/privatebridge.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Private Bridge configurator. """ -import httplib +import http.client import os import select import shutil @@ -31,8 +31,11 @@ def log_call_read(command, timeout=logger.default_timeout_minutes*60, poll=1): logger.verbose("log_call: poll=%r s" % poll) trigger=time.time()+timeout try: - child = subprocess.Popen(command, bufsize=1, - stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) + child = subprocess.Popen( + command, bufsize=1, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + close_fds=True, + universal_newlines=True) stdout = "" while True: @@ -66,13 +69,13 @@ def log_call_read(command, timeout=logger.default_timeout_minutes*60, poll=1): return (-1, None) ### Thierry - 23 Sept 2014 -# regardless of this being shipped on lxc-only or on all nodes, -# it is safer to check for the availability of the ovs-vsctl command and just print +# regardless of this being shipped on lxc-only or on all nodes, +# it is safer to check for the availability of the ovs-vsctl command and just print # out a warning when it's not there, instead of a nasty traceback def ovs_available (): "return True if ovs-vsctl can be run" try: - child = subprocess.Popen (['ovs-ovsctl', '--help']) + child = subprocess.Popen (['ovs-vsctl', '--help']) child.communicate() return True except: @@ -202,6 +205,3 @@ def GetSlivers(data, conf = None, plc = None): logger.log("privatebridge: deleting unused bridge %s" % bridge_name) ovs_delbridge(bridge_name) - - -