redhat-cop/openshift-applier

Import 'urlparse' module fails with ansible and Python3

mpreu opened this issue · 1 comments

mpreu commented

Fedora 29 distributes ansible packages in versions 2.7.1 and 2.6.5, all of them executing Python3 by default. This leads to the following error when using the applier:

[WARNING]: Skipping plugin (.../.openshift-applier/roles/openshift-applier/roles/openshift-applier/filter_plugins/applier-filters.py) as it seems to be invalid: No module named 'urlparse'

As the module name changed between Python2 and Python3 (urlparse -> urllib.parse) a suggestion for a fix to support Python3 interpreters could be:

try:
    from urlparse import urljoin
except ImportError:
    from urllib.parse import urljoin

Resolved by #82