Bug 722554

Summary: subscribe --quantity needs more error checking on the value
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Bryan Kearney <bkearney>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2CC: spandey
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 17:22:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 682238    

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