Bug 771666

Summary: catch candlepin message - system already subscribed
Product: Red Hat Satellite Reporter: Garik Khachikyan <gkhachik>
Component: katello-agentAssignee: Tomas Strachota <tstrachota>
Status: CLOSED CURRENTRELEASE QA Contact: Garik Khachikyan <gkhachik>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0.0CC: bkearney, mkoci, omaciel
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: katello-0.1.231-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-22 18:17:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Garik Khachikyan 2012-01-04 14:37:01 UTC
Description of problem:
There is recently displaying the whole Candlepin error stack on the `system subscribe --pool` when the system is already subscribed to that pool.

Version-Release number of selected component (if applicable):
katello-cli-0.1.31-1.fc16.noarch

How reproducible:
always

Steps to Reproduce:
1.subscribe a system to Katello through cli
2.try to resubscribe to the same pool
3.
  
Actual results:
RestClient::Forbidden: Candlepin::Consumer: 403 Forbidden {"displayMessage":"This consumer is already subscribed to the product matching pool with id '8aa2a25f34a8110b0134a8629b52001f'."} (POST /candlepin/consumers/07d0be5f-d996-4c41-a6ae-ba3d7943678c/entitlements?pool=8aa2a25f34a8110b0134a8629b52001f&quantity=1)

Expected results:
Better error back like: This consumer is already subscribed to the product matching pool with id '8aa2a25f34a8110b0134a8629b52001f'

Additional info:

Comment 1 Tomas Strachota 2012-02-10 11:41:08 UTC
Fixed in katello-0.1.231-1.
Better formatting of exception messages coming from subsystems added.

Comment 2 Og Maciel 2012-02-13 18:22:53 UTC
Hi Tomas. Is this the expected behavior?

# subscription-manager register --force --username=mbloomberg --password=*****
The system with UUID d01360f2-6a86-4cbd-a36d-6ebe7349f86e has been unregistered
The system has been registered with id: 152e4bbe-02fd-4d69-bfab-927737f96249 
# subscription-manager register --username=mbloomberg --password=*****
This system is already registered. Use --force to override

Comment 3 Tomas Strachota 2012-02-14 08:32:13 UTC
Hi,
this bug was in katello cli. Following commands test the behavior:

# katello system register --name devsys
Successfully registered System [ devsys ]

# katello system subscribe --name devsys --pool POOL_ID
Successfully subscribed System [ devsys ]

# katello system subscribe --name devsys --pool POOL_ID
This consumer is already subscribed to the product matching pool with id 'POOL_ID'.

Command should print only "displayMessage" part of the hash from the bug description.

Comment 4 Garik Khachikyan 2012-02-15 10:28:35 UTC
# VERIFIED

and the scenario on command#3 gets fixed.

I confirm - a message like: "This consumer is already subscribed to the product matching pool with id 'ff808081357edc0e013580891ece0114'." getting displayed now.

checked against:
---

katello-0.1.237-1.git.7.752d8de.el6.noarch
katello-cli-0.1.54-1.git.79.17c365f.el6.noarch
candlepin-0.5.17-1.el6.noarch
pulp-0.0.265-1.el6.noarch