Bug 722554 - subscribe --quantity needs more error checking on the value
subscribe --quantity needs more error checking on the value
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
6.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Bryan Kearney
John Sefler
:
Depends On:
Blocks: rhsm-rhel62
  Show dependency treegraph
 
Reported: 2011-07-15 12:17 EDT by John Sefler
Modified: 2011-12-06 12:22 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-06 12:22:27 EST
Type: ---
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 John Sefler 2011-07-15 12:17:22 EDT
Description of problem:
Subscribe should not be successful when specifying a --quantity less than or equal to zero.


Version-Release number of selected component (if applicable):
[root@jsefler-onprem-62server ~]# rpm -q subscription-manager
subscription-manager-0.96.4-1.git.4.f2638c9.el6.x86_64


How reproducible:


Steps to Reproduce:
# subscription-manager list --avail
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:       	Awesome OS with up to 4 virtual guests
ProductId:         	awesomeos-virt-4         
PoolId:            	8a90f8c6312b1da001312b1f2ea802f4
Quantity:          	10                       
Expires:           	09/12/2012     


TEST CASES....

# subscription-manager unsubscribe --all
# subscription-manager subscribe --pool=8a90f8c6312b1da001312b1f2ea802f4 --quantity=0
Successfully subscribed the system to Pool 8a90f8c6312b1da001312b1f2ea802f4

^^^ THAT SHOULD NOT HAVE SUCCEEDED


# subscription-manager unsubscribe --all
# subscription-manager subscribe --pool=8a90f8c6312b1da001312b1f2ea802f4 --quantity=-1
Successfully subscribed the system to Pool 8a90f8c6312b1da001312b1f2ea802f4

^^^ THAT SHOULD NOT HAVE SUCCEEDED


# subscription-manager unsubscribe --all
# subscription-manager subscribe --pool=8a90f8c6312b1da001312b1f2ea802f4 --quantity=one
one is not a valid value for quantity

^^^ THAT'S GOOD.  PUT A PERIOD AT THE END OF THE MESSAGE.


# subscription-manager unsubscribe --all
# subscription-manager subscribe --pool=8a90f8c6312b1da001312b1f2ea802f4 --quantity=11
No free entitlements are available for the pool with id '8a90f8c6312b1da001312b1f2ea802f4'

^^^ THAT'S ALMOST GOOD.   PUT A PERIOD AT THE END OF THE MESSAGE.
MORE ACCURATE MSG: Not enough free entitlements are available for the pool with id '8a90f8c6312b1da001312b1f2ea802f4'.


# subscription-manager unsubscribe --all[root@jsefler-onprem-62server ~]# subscription-manager subscribe --pool=8a90f8c6312b1da001312b1f2ea802f4 --quantity=1
Successfully subscribed the system to Pool 8a90f8c6312b1da001312b1f2ea802f4
# subscription-manager subscribe --pool=8a90f8c6312b1da001312b1f2ea802f4 --quantity=1
This consumer is already subscribed to the product matching pool with id '8a90f8c6312b1da001312b1f2ea802f4'

^^^ THAT'S GOOD.   PUT A PERIOD AT THE END OF THE MESSAGES.
Comment 1 Bryan Kearney 2011-07-22 12:41:19 EDT
Fixed in master at c1634f2d016fc9a48e0b22a20bc7e005381a45e5


All errors now return:

Error: Quantity must be a positive number.


The "This consumer..." error message will require a rebuild of the candlepin server. That commit is 886f8834b9fef18d9eb645c99de752ac7ef280aa.
Comment 3 John Sefler 2011-07-25 17:38:05 EDT
Verifying Version...
[root@jsefler-onprem-62server ~]# rpm -q subscription-manager
subscription-manager-0.96.4-1.git.54.5de26be.el6.x86_64
[root@jsefler-onprem-62candlepin proxy]# git branch
  0.3
* master
[root@jsefler-onprem-62candlepin proxy]# git show-ref | grep master
1da9ae2e13265ec256b39e7676ad0b4ab4782f12 refs/heads/master
1da9ae2e13265ec256b39e7676ad0b4ab4782f12 refs/remotes/origin/master




[root@jsefler-onprem-62server ~]# subscription-manager list --avail
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+       


ProductName:       	Awesome OS with up to 4 virtual guests
ProductId:         	awesomeos-virt-4         
PoolId:            	8a90f8c6315e9bcf01315e9d5321031e
Quantity:          	20                       
Expires:           	09/22/2012    

[root@jsefler-onprem-62server ~]# subscription-manager subscribe --pool=8a90f8c6315e9bcf01315e9d5321031e --quantity=0
Error: Quantity must be a positive number.
[root@jsefler-onprem-62server ~]# subscription-manager subscribe --pool=8a90f8c6315e9bcf01315e9d5321031e --quantity=-1
Error: Quantity must be a positive number.
[root@jsefler-onprem-62server ~]# subscription-manager subscribe --pool=8a90f8c6315e9bcf01315e9d5321031e --quantity=one
Error: Quantity must be a positive number.
[root@jsefler-onprem-62server ~]# subscription-manager subscribe --pool=8a90f8c6315e9bcf01315e9d5321031e --quantity=21
No free entitlements are available for the pool with id '8a90f8c6315e9bcf01315e9d5321031e'.
[root@jsefler-onprem-62server ~]# subscription-manager subscribe --pool=8a90f8c6315e9bcf01315e9d5321031e --quantity=2
Successfully subscribed the system to Pool 8a90f8c6315e9bcf01315e9d5321031e
[root@jsefler-onprem-62server ~]# subscription-manager subscribe --pool=8a90f8c6315e9bcf01315e9d5321031e --quantity=2
This consumer is already subscribed to the product matching pool with id '8a90f8c6315e9bcf01315e9d5321031e'.


moving to VERIFIED
Comment 4 errata-xmlrpc 2011-12-06 12:22:27 EST
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-2011-1695.html

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