From 0f30e60e96a0b99461cf65e6901c18b2fc084455 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 12 Sep 2024 10:55:54 -0700 Subject: [PATCH] Convert python2 dib element scripts to python3 As part of the move to zuul jobs building images we've discovered we have a couple of scripts that are invoked by python2. Python2 isn't available be default in the test images and python2 is old enough now that we should just use python3. This change updates things to make it so. Co-Authored-By: Clark Boylan Change-Id: Ib8692ef1389f80b4af59784d5b89d6dadc349a7c --- .../static/usr/local/bin/initialize-urandom.py | 2 +- .../extra-data.d/50-create-repo-list | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/dib-elements/initialize-urandom/static/usr/local/bin/initialize-urandom.py b/dib-elements/initialize-urandom/static/usr/local/bin/initialize-urandom.py index 1cb449d..fa21529 100755 --- a/dib-elements/initialize-urandom/static/usr/local/bin/initialize-urandom.py +++ b/dib-elements/initialize-urandom/static/usr/local/bin/initialize-urandom.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 Red Hat, Inc. # diff --git a/dib-elements/openstack-repos/extra-data.d/50-create-repo-list b/dib-elements/openstack-repos/extra-data.d/50-create-repo-list index 73c7bbe..9e7f78e 100755 --- a/dib-elements/openstack-repos/extra-data.d/50-create-repo-list +++ b/dib-elements/openstack-repos/extra-data.d/50-create-repo-list @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (C) 2011-2013 OpenStack Foundation # @@ -18,15 +18,8 @@ import os import yaml - -try: - from six.moves.urllib.request import urlopen -except ImportError: - from urllib.request import urlopen -try: - from six.moves.urllib.error import URLError -except ImportError: - from urllib.request import URLError +from urllib.request import urlopen +from urllib.request import URLError URL = ('https://opendev.org/openstack/project-config/' 'raw/gerrit/projects.yaml')