[Pulp-list] "Plugin "pulp-profile-update" can't be imported" at 2.21.4

Grant Gainey ggainey at redhat.com
Thu Nov 5 16:39:45 UTC 2020


Hey Konstantin (and anyone else hitting this),

While we're figuring out the best way to address this, here's a quick fix:

Save the attached patch
as /usr/lib/python2.7/site-packages/pulp-common.patch . Then:

$ cd /usr/lib/python2.7/site-packages/
$ sudo patch -p1 < pulp-common.patch

Here's the run from my test machine:

[vagrant at centos7 ~]$ *cd /usr/lib/python2.7/site-packages/*
[vagrant at centos7 site-packages]$ *python*
Python 2.7.5 (default, Apr  2 2020, 13:16:51)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pulp.common.bundle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pulp/common/bundle.py", line 4, in <module>
    from pulp.plugins.util import misc
*ImportError*: No module named plugins.util
>>> import pulp.common.lock
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pulp/common/lock.py", line 10, in <module>
    from pulp.plugins.util import misc
*ImportError*: No module named plugins.util
>>>
[vagrant at centos7 site-packages]$ *sudo patch -p1 < pulp-common.patch*

*patching file pulp/common/bundle.pypatching file pulp/common/lock.py*
[vagrant at centos7 site-packages]$ python
Python 2.7.5 (default, Apr  2 2020, 13:16:51)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pulp.common.bundle
>>> import pulp.common.lock
>>>
[vagrant at centos7 site-packages]$
===


G

On Thu, Nov 5, 2020 at 9:52 AM Grant Gainey <ggainey at redhat.com> wrote:

>
>
> On Tue, Nov 3, 2020 at 2:14 PM Konstantin M. Khankin <
> khankin.konstantin at gmail.com> wrote:
>
>> Hi!
>>
>> This report is very similar to the one in
>> https://pulp.plan.io/issues/5126 or mail thread
>> https://www.redhat.com/archives/pulp-list/2019-July/msg00021.html, the
>> only difference is I get this error with the latest Pulp update 2.21.4:
>>
>
> Uuugh, that would appear to be my fault as part
> of  e067d28a00bdec989dd03170d599e58cde4fba13
>
> These two changes from that commit:
>
> ===
> diff --git a/common/pulp/common/bundle.py b/common/pulp/common/bundle.py
> index 6ad95d498..be178b006 100644
> --- a/common/pulp/common/bundle.py
> +++ b/common/pulp/common/bundle.py
> @@ -1,6 +1,7 @@
>  import os
>  import re
>  from logging import getLogger
> +from pulp.plugins.util import misc
>
>  from M2Crypto import X509
>
> @@ -199,8 +200,7 @@ class Bundle:
>          Ensure I{root} directory exists.
>          """
>          path = os.path.dirname(self.path)
> -        if not os.path.exists(path):
> -            os.makedirs(path)
> +        misc.mkdir(path)
>
>      def cn(self):
>          """
> diff --git a/common/pulp/common/lock.py b/common/pulp/common/lock.py
> index 7fdf7e9b8..9caf9b1c7 100644
> --- a/common/pulp/common/lock.py
> +++ b/common/pulp/common/lock.py
> @@ -7,6 +7,8 @@ import fcntl
>
>  from threading import RLock
>
> +from pulp.plugins.util import misc
> +
>
>  class LockFailed(Exception):
>      pass
> @@ -92,8 +94,7 @@ class LockFile:
>
>      def __mkdir(self, path):
>          dir = os.path.dirname(path)
> -        if not os.path.exists(dir):
> -            os.makedirs(dir)
> +        misc.mkdir(dir)
>
>
>  class Lock:
> ===
>
> are the problem, I believe. I'll work on figuring out how best to address
> the problem.
>
> Konstantin, could you open an issue at pulp.plan.io please?  That way
> you'll see progress as we/I make it.
>
> Thanks for the catch, and the great problem report!
>
> G
>
>
>>
>>
> # rpm -qa | grep pulp
>> python-pulp-client-lib-2.21.4-1.el7.noarch
>> python-pulp-common-2.21.4-1.el7.noarch
>> pulp-rpm-handlers-2.21.4-1.el7.noarch
>> python-pulp-rpm-common-2.21.4-1.el7.noarch
>> python-pulp-agent-lib-2.21.4-1.el7.noarch
>> pulp-agent-2.21.4-1.el7.noarch
>> pulp-puppet-consumer-extensions-2.21.4-1.el7.noarch
>> pulp-consumer-client-2.21.4-1.el7.noarch
>> pulp-rpm-yumplugins-2.21.4-1.el7.noarch
>> python-pulp-bindings-2.21.4-1.el7.noarch
>> pulp-rpm-consumer-extensions-2.21.4-1.el7.noarch
>> python-pulp-puppet-common-2.21.4-1.el7.noarch
>> pulp-puppet-handlers-2.21.4-1.el7.noarch
>>
>> >>> import os
>> >>> d, m = os.path.split('/usr/lib/yum-plugins/pulp-profile-update.py')
>> >>> m = m.split('.py')[0]
>> >>> m
>> 'pulp-profile-update'
>> >>> d
>> '/usr/lib/yum-plugins'
>> >>> import imp
>> >>> imp.find_module(m, [d])
>> (<open file '/usr/lib/yum-plugins/pulp-profile-update.py', mode 'U' at
>> 0x7fbb0b54f5d0>, '/usr/lib/yum-plugins/pulp-profile-update.py', ('.py',
>> 'U', 1))
>> >>> f, p, d = imp.find_module(m, [d])
>> >>> imp.load_module(m, f, p, d)
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "/usr/lib/yum-plugins/pulp-profile-update.py", line 7, in <module>
>>     from pulp.common.bundle import Bundle as BundleImpl
>>   File "/usr/lib/python2.7/site-packages/pulp/common/bundle.py", line 4,
>> in <module>
>>     from pulp.plugins.util import misc
>> ImportError: No module named plugins.util
>>
>> # ls /usr/lib/python2.7/site-packages/pulp/
>> agent  bindings  client  common  __init__.py  __init__.pyc  __init__.pyo
>>
>> ===
>> At host where I don't have this error, ls gives:
>> # ls /usr/lib/python2.7/site-packages/pulp
>> agent  bindings  client  common  __init__.py  __init__.pyc  __init__.pyo
>>  oid_validation  plugins  repoauth  server
>>
>> # ls /usr/lib/python2.7/site-packages/pulp/plugins/
>> cataloger.py   conduits    config.pyo       distributor.pyo  importer.pyc
>>  __init__.pyc  migration  model.pyo     profiler.pyo  util
>> cataloger.pyc  config.py   distributor.py   file             importer.pyo
>>  __init__.pyo  model.py   profiler.py   rsync
>> cataloger.pyo  config.pyc  distributor.pyc  importer.py      __init__.py
>>   loader        model.pyc  profiler.pyc  types
>>
>> # rpm -qf /usr/lib/python2.7/site-packages/pulp/plugins/util/misc.py
>> pulp-server-2.21.4-1.el7.noarch
>>
>> ===
>> Obviously if plugins/util/misc is included into the pulp-server package,
>> it can only be found on a server. So same as in
>> https://pulp.plan.io/issues/5126, 2.21.4 introduced server dependency on
>> a client.
>>
>> Could you move the plugins package into the pulp-common package please?
>>
>> Thanks!
>>
>> --
>> Konstantin Khankin
>> _______________________________________________
>> Pulp-list mailing list
>> Pulp-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/pulp-list
>
>
>
> --
> Grant Gainey
> Principal Software Engineer, Red Hat System Management Engineering
>


-- 
Grant Gainey
Principal Software Engineer, Red Hat System Management Engineering
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20201105/6deaeaa7/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pulp-common.patch
Type: text/x-patch
Size: 1041 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20201105/6deaeaa7/attachment.bin>


More information about the Pulp-list mailing list