diff --git a/ocaml/xenopsd/scripts/common.py b/ocaml/xenopsd/scripts/common.py index 641d00dec6e..365944e657c 100755 --- a/ocaml/xenopsd/scripts/common.py +++ b/ocaml/xenopsd/scripts/common.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/python # # Copyright (c) 2011-2013 Citrix Systems, Inc. # @@ -101,7 +101,7 @@ def add_to_bridge(mode, dev, bridge, address, external_ids): cmd = ["ovs-vsctl", "--timeout=30", "--", "--if-exists", "del-port", dev, "--", "add-port", bridge, dev] for (key, value) in external_ids: cmd = cmd + ["--", "set", "interface", dev, 'external-ids:"%s"="%s"' % (key, value) ] - run(ON_ERROR_LOG, cmd) + run(ON_ERROR_LOG, cmd) def remove_from_bridge(mode, dev, bridge): if mode == MODE_BRIDGE: @@ -206,11 +206,11 @@ def get_words(value, separator): private = self.json["extra_private_keys"] if "locking_mode" in self.json: if type(self.json["locking_mode"]) is list: - # Must be type=locked here + # Must be type=locked here results["locking_mode"] = self.json["locking_mode"][0].lower() - locked_params=self.json["locking_mode"][1] - results["ipv4_allowed"] = locked_params["ipv4"] - results["ipv6_allowed"] = locked_params["ipv6"] + locked_params=self.json["locking_mode"][1] + results["ipv4_allowed"] = locked_params["ipv4"] + results["ipv6_allowed"] = locked_params["ipv6"] else: results["locking_mode"] = self.json["locking_mode"].lower() send_to_syslog("Got locking config: %s" % (repr(results))) diff --git a/ocaml/xenopsd/scripts/igmp_query_injector.py b/ocaml/xenopsd/scripts/igmp_query_injector.py index b5b7abaa157..c990cd49047 100755 --- a/ocaml/xenopsd/scripts/igmp_query_injector.py +++ b/ocaml/xenopsd/scripts/igmp_query_injector.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import argparse import threading import logging @@ -106,7 +106,7 @@ def _inject_with_connection_state_check(self): t.join(self.vif_connected_timeout) if watcher.watches: log.warning('Wait vif state change timeout') - for vif in watcher.watches.values(): + for vif in watcher.watches.itervalues(): log.warning("Vif:%s state did not change to '%s', don't inject IGMP query to mac: %s" % (vif, VIF_CONNECTED_STATE, get_vif_mac(vif))) diff --git a/ocaml/xenopsd/scripts/pygrub-wrapper b/ocaml/xenopsd/scripts/pygrub-wrapper index 6aa29d5d39b..03189c4ca9a 100644 --- a/ocaml/xenopsd/scripts/pygrub-wrapper +++ b/ocaml/xenopsd/scripts/pygrub-wrapper @@ -1,4 +1,4 @@ -#! /usr/bin/python3 +#! /usr/bin/python # # Copyright (C) 2023 Cloud Software Group # @@ -12,7 +12,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. - +from __future__ import print_function import pwd, subprocess, sys cmd = ["pygrub"] diff --git a/ocaml/xenopsd/scripts/qemu-vif-script b/ocaml/xenopsd/scripts/qemu-vif-script index 2548ef454b2..23219f43552 100755 --- a/ocaml/xenopsd/scripts/qemu-vif-script +++ b/ocaml/xenopsd/scripts/qemu-vif-script @@ -1,6 +1,6 @@ -#!/usr/bin/env python3 - +#!/usr/bin/env python +from __future__ import print_function from common import * if __name__ == "__main__": diff --git a/ocaml/xenopsd/scripts/qemu-wrapper b/ocaml/xenopsd/scripts/qemu-wrapper index 38d5f96b77d..4935d88a493 100644 --- a/ocaml/xenopsd/scripts/qemu-wrapper +++ b/ocaml/xenopsd/scripts/qemu-wrapper @@ -1,4 +1,4 @@ -#! /usr/bin/python3 +#! /usr/bin/python # # Copyright (C) 2016 Citrix Systems R&D Ltd. # @@ -12,7 +12,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. - +from __future__ import print_function import os import re import sys diff --git a/ocaml/xenopsd/scripts/setup-vif-rules b/ocaml/xenopsd/scripts/setup-vif-rules index a1152374155..fadf4d79385 100755 --- a/ocaml/xenopsd/scripts/setup-vif-rules +++ b/ocaml/xenopsd/scripts/setup-vif-rules @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/python # # Copyright (c) 2011 Citrix Systems, Inc. # @@ -13,7 +13,7 @@ # GNU Lesser General Public License for more details. # - +from __future__ import print_function import fcntl import os import os.path @@ -196,7 +196,7 @@ def clear_xs_ofport_path(vif): def make_vswitch_external_ids(vif): args = [] - for (k, v) in list(vif.get_external_ids().items()): + for (k, v) in vif.get_external_ids().items(): args += ["--", "set", "interface", vif.vif_name, 'external-ids:"%s"="%s"' % (k, v)] return args