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
*** Bug 1155773 has been marked as a duplicate of this bug. ***
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).
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
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
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.
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?
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.
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
Moved to https://pulp.plan.io/issues/587