Bug 722554 - subscribe --quantity needs more error checking on the value
Summary: subscribe --quantity needs more error checking on the value
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Bryan Kearney
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel62
TreeView+ depends on / blocked
 
Reported: 2011-07-15 16:17 UTC by John Sefler
Modified: 2011-12-06 17:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 17:22:27 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1695 0 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2011-12-06 01:23:29 UTC

Description John Sefler 2011-07-15 16:17:22 UTC
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 16:41:19 UTC
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 21:38:05 UTC
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 17:22:27 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-2011-1695.html


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