Skip to content

Commit 544b1c6

Browse files
committed
change python to python3 in shebang
Issue: OpenSDN-io/community#63 Change-Id: I2837b40edbde8a6be6328431d9ec5396f7bedf5b
1 parent a614919 commit 544b1c6

File tree

67 files changed

+79
-349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+79
-349
lines changed

src/config/common/cfgm_common/datastore/drivers/cassandra_cql.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import queue
1414
import socket
1515
import ssl
16-
import sys
1716

1817
import gevent
1918
import gevent.lock
@@ -58,12 +57,9 @@
5857
}
5958

6059
# SSL related configurations
61-
if sys.version_info >= (3, 6):
62-
# Python3.6 Introduces PROTOCOL_TLS which is using the best
63-
# version supported.
64-
SSL_VERSION = ssl.PROTOCOL_TLS
65-
else:
66-
SSL_VERSION = ssl.PROTOCOL_TLSv1_2
60+
# Python3.6 Introduces PROTOCOL_TLS which is using the best
61+
# version supported.
62+
SSL_VERSION = ssl.PROTOCOL_TLS
6763

6864
# Set hard limit of the columns returned.
6965
MAX_COLUMNS = 10000000

src/config/common/cfgm_common/schema_changed_detector.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
# -*- coding: utf-8 -*-
33
# USAGE
44
# There are two available ways to check if schema has been changed.

src/config/common/cfgm_common/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
# -*- coding: utf-8 -*-
33

44
# vim: tabstop=4 shiftwidth=4 softtabstop=4

src/config/common/tests/tools/colorizer.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,7 @@ def printErrorList(self, flavor, errors):
327327

328328
test = subunit.ProtocolTestCase(sys.stdin, passthrough=None)
329329

330-
if sys.version_info[0:2] <= (2, 6):
331-
runner = unittest.TextTestRunner(verbosity=2)
332-
else:
333-
runner = unittest.TextTestRunner(verbosity=2, resultclass=NovaTestResult)
330+
runner = unittest.TextTestRunner(verbosity=2, resultclass=NovaTestResult)
334331

335332
if runner.run(test).wasSuccessful():
336333
exit_code = 0

src/config/common/tests/tools/install_venv_common.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ def die(self, message, *args):
5858
sys.exit(1)
5959

6060
def check_python_version(self):
61-
if sys.version_info < (2, 6):
62-
self.die("Need Python Version >= 2.6")
61+
pass
6362

6463
def run_command_with_code(self, cmd, redirect_output=True,
6564
check_exit_code=True):

src/config/contrail_issu/contrail_issu/issu_contrail_common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
#
33
# Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
44
#

src/config/contrail_issu/contrail_issu/issu_contrail_config.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
#
33
# Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
44
#
55

6-
import sys
7-
if sys.version_info[0] < 3:
8-
reload(sys) # noqa
9-
sys.setdefaultencoding('UTF8')
10-
import configparser
11-
from six import string_types
126
import argparse
7+
import configparser
138
import logging
9+
from six import string_types
10+
import sys
1411

1512
from cfgm_common.datastore.keyspace import ConfigKeyspaceMap
1613
from pysandesh.gen_py.sandesh.ttypes import SandeshLevel

src/config/contrail_issu/contrail_issu/issu_contrail_post_sync.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
#
33
# Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
44
#
@@ -9,11 +9,6 @@
99
from contrail_issu import issu_contrail_config
1010

1111

12-
def _myprint(x, level):
13-
print(x)
14-
logging.info(x)
15-
16-
1712
def _issu_cassandra_post_sync_main():
1813

1914
logging.basicConfig(

src/config/contrail_issu/contrail_issu/issu_contrail_pre_sync.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
#
33
# Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
44
#

src/config/contrail_issu/contrail_issu/issu_contrail_run_sync.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
#
33
# Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
44
#

src/config/contrail_issu/contrail_issu/issu_contrail_zk_sync.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
#
33
# Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
44
#

src/config/fabric-ansible/ansible-playbooks/common/contrail_command.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import json # noqa
44
import pprint

src/config/fabric-ansible/ansible-playbooks/common/plugin_ironic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
from ironicclient import client as ironicclient
44
from urllib.parse import urlparse

src/config/fabric-ansible/ansible-playbooks/filter_plugins/cli_sync.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import glob
44
import os

src/config/fabric-ansible/ansible-playbooks/filter_plugins/discover_os_computes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2020 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/filter_plugins/discover_role.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import argparse
44
import sys

src/config/fabric-ansible/ansible-playbooks/filter_plugins/discover_server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import logging
44
import sys

src/config/fabric-ansible/ansible-playbooks/filter_plugins/fabric.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
#
33
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
44
#

src/config/fabric-ansible/ansible-playbooks/filter_plugins/fabric_config_filters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2019 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/filter_plugins/get_mgmt_ip_filter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import sys
44
import traceback

src/config/fabric-ansible/ansible-playbooks/filter_plugins/hitless_upgrade_filters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/filter_plugins/import_chassis_info.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import sys
44
import traceback

src/config/fabric-ansible/ansible-playbooks/filter_plugins/import_hardware_inventory_info.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import json
44
import sys

src/config/fabric-ansible/ansible-playbooks/filter_plugins/import_interfaces_info.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import sys
44
import traceback

src/config/fabric-ansible/ansible-playbooks/filter_plugins/import_lldp_info.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import sys
44
import traceback

src/config/fabric-ansible/ansible-playbooks/filter_plugins/import_server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import logging
44
import traceback

src/config/fabric-ansible/ansible-playbooks/filter_plugins/node_profile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import logging
44
import traceback

src/config/fabric-ansible/ansible-playbooks/filter_plugins/rma_filters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22
#
33
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
44
#

src/config/fabric-ansible/ansible-playbooks/filter_plugins/update_physical_router.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import json
44
import sys

src/config/fabric-ansible/ansible-playbooks/filter_plugins/validate_schema.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import json
44
import sys

src/config/fabric-ansible/ansible-playbooks/filter_plugins/write_to_file_filter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import argparse
44
import sys

src/config/fabric-ansible/ansible-playbooks/filter_plugins/ztp_filters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/library/discover_device.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/library/job_objectlog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/library/prouter_objectlog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/library/swift_container_cleanup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/library/swift_fileutil.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/library/vnc_db_mod.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/module_utils/device_info.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/module_utils/fabric_pysnmp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
import binascii
44
from collections import defaultdict

src/config/fabric-ansible/ansible-playbooks/module_utils/fabric_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33

44
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/roles/assign_static_device_ip/filter_plugins/physical_router_filters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2019 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/roles/import_interfaces_info/filter_plugins/import_interface.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2019 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/roles/wait_for_fpc_online/filter_plugins/fpc_filters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2019 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/test/sanity/sanity_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/test/sanity/sanity_test_assign_roles.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/test/sanity/sanity_test_brownfield_workflow.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/test/sanity/sanity_test_delete_devices.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/test/sanity/sanity_test_fabric_deletion.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/test/sanity/sanity_test_rma_activate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2019 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/ansible-playbooks/test/sanity/sanity_test_ztp_workflow.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/python3
22

33
#
44
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.

src/config/fabric-ansible/job_manager/playbook_helper.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,12 @@ def fabric_ansible_display(self, msg, color=None, stderr=False,
229229
msg2 = msg
230230

231231
msg2 = to_bytes(msg2, encoding=self._output_encoding(stderr=stderr))
232-
if sys.version_info >= (3,):
233-
# Convert back to text string on python3
234-
# We first convert to a byte string so that we get rid of
235-
# characters that are invalid in the user's locale
236-
msg2 = to_text(msg2, self._output_encoding(stderr=stderr),
237-
errors='replace')
232+
# Convert back to text string on python3
233+
# We first convert to a byte string so that we get rid of
234+
# characters that are invalid in the user's locale
235+
msg2 = to_text(
236+
msg2, self._output_encoding(stderr=stderr),
237+
errors='replace')
238238

239239
# Note: After Display() class is refactored need to update the
240240
# log capture code in 'bin/ansible-connection' (and other
@@ -258,11 +258,10 @@ def fabric_ansible_display(self, msg, color=None, stderr=False,
258258
msg2 = nocolor.lstrip(u'\n')
259259

260260
msg2 = to_bytes(msg2)
261-
if sys.version_info >= (3,):
262-
# Convert back to text string on python3
263-
# We first convert to a byte string so that we get rid of
264-
# characters that are invalid in the user's locale
265-
msg2 = to_text(msg2, self._output_encoding(stderr=stderr))
261+
# Convert back to text string on python3
262+
# We first convert to a byte string so that we get rid of
263+
# characters that are invalid in the user's locale
264+
msg2 = to_text(msg2, self._output_encoding(stderr=stderr))
266265

267266
if color == CONST.COLOR_ERROR:
268267
logger.error(msg2)

0 commit comments

Comments
 (0)