allow create-repo-list to be run without six

Some distros (gentoo) do not come with six in the base image (stage3),
it is installed later in the image build.  Use the native
urlopen/URLError if the six version is not available.

Change-Id: Id1c52aa17e565c16369645508e43e4f485defa66
This commit is contained in:
Matthew Thode 2021-01-17 02:38:37 -06:00
parent 083ddaf2f9
commit d29d9313d7
No known key found for this signature in database
GPG Key ID: 64A37BEAAE19A4E8
1 changed files with 8 additions and 2 deletions

View File

@ -19,8 +19,14 @@
import os
import yaml
from six.moves.urllib.request import urlopen
from six.moves.urllib.error import URLError
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
URL = ('https://opendev.org/openstack/project-config/'
'raw/gerrit/projects.yaml')