Bug 840415 - Install-num migration throws traceback for invalid product cert location.
Install-num migration throws traceback for invalid product cert location.
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: subscription-manager (Show other bugs)
5.11
Unspecified Unspecified
unspecified Severity unspecified
: beta
: ---
Assigned To: Alex Wood
John Sefler
:
Depends On:
Blocks: rhsm-rhel511
  Show dependency treegraph
 
Reported: 2012-07-16 06:06 EDT by spandey
Modified: 2015-04-23 19:57 EDT (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
No documentation needed.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-09-15 20:21:53 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description spandey 2012-07-16 06:06:38 EDT
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 15:58:23 EDT
commit b5e32ecb0e5b4e49bff47ec565ebf0e9fb722102
Author: Alex Wood <awood@redhat.com>
Date:   Tue Sep 11 11:41:30 2012 -0400

    840415: Handle copyfile errors gracefully.

Available in subscription-manager-1.0.18+
Comment 2 RHEL Product and Program Management 2012-09-11 16:18:19 EDT
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 13:33:33 EDT
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 14:05:03 EDT
I would move this out to 6.4, doesn't seem like it should be a blocker.
Comment 6 RHEL Product and Program Management 2012-10-03 14:10:12 EDT
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 09:55:56 EDT
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 Product and Program Management 2012-10-17 10:08:49 EDT
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 10:39:53 EDT
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 13:46:34 EDT
commit 1721610e8a524be39fdabd9204243a7cba7f1cee
Author:     Alex Wood <awood@redhat.com>
AuthorDate: Wed Oct 17 11:07:41 2012 -0400
Commit:     Alex Wood <awood@redhat.com>
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 14:10:52 EST
Sounds like this is fixed to me. Moving to modified.
Comment 14 John Sefler 2014-02-19 17:52:48 EST
Moving back to RHEL5 since the install-num-migrate-to-rhsm is a RHEL5 only tool.
Comment 15 RHEL Product and Program Management 2014-02-19 18:20:18 EST
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 15:10:59 EDT
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 12:58:33 EDT
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-15 20:21:53 EDT
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.