Bug 1155411 - pulp cant install package with version in it
Summary: pulp cant install package with version in it
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Pulp
Classification: Retired
Component: rpm-support
Version: 2.4.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: pulp-bugs
QA Contact: pulp-qe-list
URL:
Whiteboard:
: 1155773 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-22 06:22 UTC by Dhaval
Modified: 2015-02-28 22:40 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-28 22:40:56 UTC
Embargoed:
dhaval.joshi: needinfo+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Pulp Redmine 587 0 None None None Never

Description Dhaval 2014-10-22 06:22:16 UTC
Description of problem:pulp cant install package with version in it


Version-Release number of selected component (if applicable):2.4.2


[root@lonlx90008 yum.repos.d]# yum list |grep master_test
nm-python.x86_64                      2.7.6-1                     master_test
nm-python.x86_64                      2.7.7-1                     master_test

now I am trying “yum install”

[root@pulp-consumer yum.repos.d]# yum install nmr-python-2.7.6
Loaded plugins: product-id, pulp-profile-update, security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nmr-python.x86_64 0:2.7.6-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
 Package                     Arch                    Version                   Repository                    Size
==================================================================================================================
Installing:
 nm-python                  x86_64                  2.7.6-1                   master_test                   22 M

Transaction Summary
==================================================================================================================
Install       1 Package(s)

Total download size: 22 M
Installed size: 87 M
Is this ok [y/N]: n


Here I am trying “pulp-admin”

[root@pulp-admin 0]# pulp-admin -u admin -p admin rpm consumer package install run --consumer-id pulp-consumer--name nm-python-2.7.6
Install task created with id [ f9d1177d-4548-430d-b4ce-9b470a162228 ]

This command may be exited via ctrl+c without affecting the request.

Refresh Repository Metadata

Install Failed

*:nm-python-2.7.6-*-*.*: No package(s) available to install

Comment 1 Jeff Ortel 2014-10-24 14:19:00 UTC
*** Bug 1155773 has been marked as a duplicate of this bug. ***

Comment 2 Jeff Ortel 2014-10-24 14:21:35 UTC
The pulp-admin rpm package install command only supports package specification by name.  Needs to support epoch, version, release and (probably) arch.  Broken (from the CLI perspective) in 2.4.0 by https://bugzilla.redhat.com/show_bug.cgi?id=1004981.  1004981 fixed the handler (and correctly so) but CLI needs to be updated as well.

This is supported by the API (just a CLI issue).

Comment 3 Dhaval 2014-11-12 13:53:57 UTC
Hello,

can you confirm where exactly it's breaking?, i checked code and tried to pass version='2.7.6' with unit and it worked, but how do i handle that with multiple packages ?

Regards,
DJ

Comment 4 Dhaval 2014-11-13 05:24:54 UTC
Below is my workaround  “pulp_rpm/extensions/admin/rpm_admin_consumer/package.py”


125     def get_content_units(self, kwargs):
126
127         def _unit_dict(unit_name):
128             if '/' in unit_name:
129                 parts = unit_name.split('/', 2)
130                 if len(parts) < 2:
131                     raise ValueError
132                 return {'type_id': TYPE_ID_RPM,
133                             'unit_key': {'name': parts[0], 'version': parts[1]}}
134             else:
135                 return {'type_id': TYPE_ID_RPM,
136                         'unit_key': {'name': unit_name}}
137
138         return map(_unit_dict, kwargs['name'])

If you can guide me how to get NEVRA for package, i can apply with that as well.

Thanks,
DJ

Comment 5 Brian Bouterse 2014-11-13 16:27:46 UTC
I talked to Dhaval in #pulp and he wanted to get input on his posted patch. I didn't know so I'm marking it as needs info to you Jeff.

Comment 6 vijaykumar.jain 2014-11-13 18:56:27 UTC
In [6]: import rpmUtils

In [7]: print  rpmUtils.miscutils.splitFilename('lgtoman-7.6.5.1-1.x86_64.rpm')
('lgtoman', '7.6.5.1', '1', '', 'x86_64')

I have seen someone raising some issues with respect to inconsistent repo naming, but we can definitely get NEVRA from here and use full rpm name for deploy in the CLI.

Let me know if this sounds ok?

Comment 7 Jeff Ortel 2014-11-20 15:51:13 UTC
I have been discussing with dhaval via direct email.  Providing feedback here for completeness.

No, I would not recommend using that function.  I does weird things with 
partial names.

EG:

 >>> from rpmUtils.miscutils import splitFilename
 >>> splitFilename('lgtoman-7.6.5.1-1.x86_64.rpm')
('lgtoman', '7.6.5.1', '1', '', 'x86_64')
 >>> splitFilename('lgtoman-7.6.5.1-1.x86_64')
('lgtoman', '7.6.5.1', '1', '', 'x86_64')
 >>> splitFilename('lgtoman-7.6.5.1.x86_64')
('lgtoman-7.6.5.1.x86_6', 'lgtoman', '7.6.5.1', '', 'x86_64')
 >>> splitFilename('lgtoman')
('lgtoma', 'lgtoma', 'lgtoma', '', 'lgtoman')
 >>> splitFilename('lgtoman-1.0')
('lgtoman-1.', 'lgtoman', '1', '', '0')

If you write a function to perform the split, I would suggest putting it 
in pulp_rpm.common.  Also, I did a quick look and did not find anything 
in the pulp_rpm project that you can use for this.  Though, it would be 
good for you to do a search as well before writing the function just to 
double check.

Comment 8 vijaykumar.jain 2014-11-21 06:09:09 UTC
what about using the function only when path is full filename. we can have any amount of "-"s and "."s in the name which can hinder the parsing functionality.
We can either ask the user to explicitly provide the full rpm and the use the above parsing only when we have full rpm file else, go with the name based approach and if there is a failure then provide available packages in repository matching the input?
pulp-admin -u admin -p admin rpm repo content rpm --repo-id <repoid> --match='filename=myrpm-1.6' --fields name,filename,version

Comment 9 Brian Bouterse 2015-02-28 22:40:56 UTC
Moved to https://pulp.plan.io/issues/587


Note You need to log in before you can comment on or make changes to this bug.