Bug 840415 - Install-num migration throws traceback for invalid product cert location.
Summary: Install-num migration throws traceback for invalid product cert location.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: subscription-manager
Version: 5.11
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: beta
: ---
Assignee: Alex Wood
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel511
TreeView+ depends on / blocked
 
Reported: 2012-07-16 10:06 UTC by spandey
Modified: 2015-04-23 23:57 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
No documentation needed.
Clone Of:
Environment:
Last Closed: 2014-09-16 00:21:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1225 0 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2014-09-16 04:15:23 UTC

Description spandey 2012-07-16 10:06:38 UTC
Description of problem:


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


How reproducible:
3/3

Prerequisites:
rhel5.9 with following subscription-manager rpm 
 subscription-manager-migration-1.0.9-1.git.22.35b5155.el5
subscription-manager-1.0.9-1.git.22.35b5155.el5
subscription-manager-gui-1.0.9-1.git.22.35b5155.el5
subscription-manager-firstboot-1.0.9-1.git.22.35b5155.el5
subscription-manager-migration-data-1.11.2.2-1.git.0.2eea155.el5

Steps to Repro: 
Edit rhsm.conf for product location . Specify location which doesnot exists.

“productCertDir = /etc/pki/product1”

Start install num migration with valid installation number .
“install-num-migrate-to-rhsm -i 20f91e3421ed551e”

Expected Result : 

Actual Result : 
[root@dhcp193-39 pki]# install-num-migrate-to-rhsm -i 20f91e3421ed551e 
Copying /usr/share/rhsm/product/RHEL-5/Server-Server-x86_64-dfb340743a6e-69.pem to /etc/pki/product1/69.pem
Traceback (most recent call last):
  File "/usr/sbin/install-num-migrate-to-rhsm", line 150, in ?
    main()
  File "/usr/sbin/install-num-migrate-to-rhsm", line 144, in main
    shutil.copyfile(path, dest_file)
  File "/usr/lib64/python2.4/shutil.py", line 48, in copyfile
    fdst = open(dst, 'wb')
IOError: [Errno 2] No such file or directory: '/etc/pki/product1/69.pem'

Comment 1 Alex Wood 2012-09-11 19:58:23 UTC
commit b5e32ecb0e5b4e49bff47ec565ebf0e9fb722102
Author: Alex Wood <awood>
Date:   Tue Sep 11 11:41:30 2012 -0400

    840415: Handle copyfile errors gracefully.

Available in subscription-manager-1.0.18+

Comment 2 RHEL Program Management 2012-09-11 20:18:19 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 4 John Sefler 2012-09-16 17:33:33 UTC
re-testing version...
[root@jsefler-rhel59 ~]# rpm -q subscription-manager-migration
subscription-manager-migration-1.0.18-1.el5


[root@jsefler-rhel59 ~]# rm -rf /etc/pki/product1

[root@jsefler-rhel59 ~]# sed -i 's/^productCertDir\s*=.*$/productCertDir=\/etc\/pki\/product1/g' /etc/rhsm/rhsm.conf

[root@jsefler-rhel59 ~]# install-num-migrate-to-rhsm -i 20f91e3421ed551e
Installing /usr/share/rhsm/product/RHEL-5/Server-Server-x86_64-dfb340743a6e-69.pem to /etc/pki/product1/69.pem
[Errno 2] No such file or directory: '/etc/pki/product1/69.pem'

^^^ VERIFIED: The traceback has been eliminated and the migration attempt errors out due to the missing /etc/pki/product1 directory.  This is fine, however...

[root@jsefler-rhel59 ~]# install-num-migrate-to-rhsm -i 20f91e3421ed551e --dryrun
Installing /usr/share/rhsm/product/RHEL-5/Server-Server-x86_64-dfb340743a6e-69.pem to /etc/pki/product1/69.pem

^^^ BANG!  The --dryrun option should also catch the missing productcertdir and error out too.  Afterall, the purpose of the dryrun is to catch problems like this.

Moving back to ASSIGNED

Comment 5 Adrian Likins 2012-10-03 18:05:03 UTC
I would move this out to 6.4, doesn't seem like it should be a blocker.

Comment 6 RHEL Program Management 2012-10-03 18:10:12 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 7 John Sefler 2012-10-17 13:55:56 UTC
Moving back to 5.9 since the install-num-migrate-to-rhsm is a RHEL5 only tool. 
Hopefully it is an easy fix.  Otherwise it would be deferred to 5.10

Comment 8 RHEL Program Management 2012-10-17 14:08:49 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 9 Alex Wood 2012-10-17 14:39:53 UTC
Unfortunately, fixing this is going to require a new string.

Currently in the script when it attempts to copy the file over and fails, that error message comes from Python's shutil, and the message is already internationalized.  Catching the error case during a dry run would require testing for the directory's existence ourselves and writing out a custom error message if the directory didn't exist.

Deferring until 5.10 since we are past string freeze and there are no appropriate strings already translated.

Comment 10 Alex Wood 2012-10-17 17:46:34 UTC
commit 1721610e8a524be39fdabd9204243a7cba7f1cee
Author:     Alex Wood <awood>
AuthorDate: Wed Oct 17 11:07:41 2012 -0400
Commit:     Alex Wood <awood>
CommitDate: Wed Oct 17 11:09:08 2012 -0400

    840415: Print an error message if the destination directory does not exist.

Available in subscription-manager-1.1.4-1

Comment 13 Adrian Likins 2014-01-31 19:10:52 UTC
Sounds like this is fixed to me. Moving to modified.

Comment 14 John Sefler 2014-02-19 22:52:48 UTC
Moving back to RHEL5 since the install-num-migrate-to-rhsm is a RHEL5 only tool.

Comment 15 RHEL Program Management 2014-02-19 23:20:18 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 17 Sharath Dwaral 2014-05-21 19:10:59 UTC
Version:

# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.12-1
subscription-manager: 1.11.3-3.el5
python-rhsm: 1.11.3-3.el5

VErsification:

Steps followed as described in comment4

# rpm -q subscription-manager-migration
subscription-manager-migration-1.11.3-3.el5

# rm -rf /etc/pki/product1

# sed -i 's/^productCertDir\s*=.*$/productCertDir=\/etc\/pki\/product1/g' /etc/rhsm/rhsm.conf

# cat /etc/rhsm/rhsm.conf | grep productCertDir
productCertDir=/etc/pki/product1

# install-num-migrate-to-rhsm -i 20f91e3421ed551e

Installing /usr/share/rhsm/product/RHEL-5/Server-Server-x86_64-06e8bd9df3f0-69.pem to /etc/pki/product1/69.pem

No such directory: /etc/pki/product1   <<<<<<<<<<<<<<<<<<<<

# install-num-migrate-to-rhsm -i 20f91e3421ed551e --dryrun

Installing /usr/share/rhsm/product/RHEL-5/Server-Server-x86_64-06e8bd9df3f0-69.pem to /etc/pki/product1/69.pem

No such directory: /etc/pki/product1  <<<<<<<<<<<<<<<<


VERIFIED

Comment 18 John Sefler 2014-05-28 16:58:33 UTC
This bugzilla has been obsoleted by the decsion to remove install-num-migrate-to-rhsm from the subscription-manager-migration package in https://bugzilla.redhat.com/show_bug.cgi?id=1092754#c5

Comment 20 errata-xmlrpc 2014-09-16 00:21:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1225.html


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