Bug 1556819 - foreman-maintain upgrade check should check whether the entry for label=share is present in "cp_consumer_type" table
Summary: foreman-maintain upgrade check should check whether the entry for label=share...
Keywords:
Status: CLOSED DUPLICATE of bug 1554371
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Candlepin
Version: 6.3.0
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: Unspecified
Assignee: Barnaby Court
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-15 10:12 UTC by Ashish Humbe
Modified: 2021-06-10 15:20 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-11 14:15:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ashish Humbe 2018-03-15 10:12:53 UTC
Description of problem:

- foreman-maintain should add a check for the below entry in the candlepin database.

# select * from cp_consumer_type where label='share';
                id                |            created            |            updated            | label | manifest 
----------------------------------+-------------------------------+-------------------------------+-------+----------
 8ac1507661e196ff0161ffd7abda2ccb | 2018-03-07 15:12:59.802+05:30 | 2018-03-07 15:12:59.802+05:30 | share | N
(1 row)


This entry is not present on all satellite v 6.2 servers, I have one Sat6.2 with this entry and another without above entry in the database.

If this entry is present then the satellite upgrade fails at migrate_candlepin step, here is the error message: 


[DEBUG 2018-03-14 03:50:31 main] ########## ERROR ############
[DEBUG 2018-03-14 03:50:31 main] Error running command: liquibase --driver=org.postgresql.Driver --classpath=/usr/share/java/postgresql-jdbc.jar:/var/lib/tomcat/webapps/candlepin/WEB-INF/classes/ --changeLogFile=db/changelog/changelog-update.xml --url=jdbc:postgresql:candlepin --username=candlepin --password=+FILTERED+ --logLevel=severe migrate -Dcommunity=False
[DEBUG 2018-03-14 03:50:31 main] Status code: 65280
[DEBUG 2018-03-14 03:50:31 main] Command output: SEVERE 3/14/18 3:50 AM:liquibase: db/changelog/changelog-update.xml: db/changelog/20170206133825-add-share-consumer-type.xml::20170206133825-1::awood: Change Set db/changelog/20170206133825-add-share-consumer-type.xml::20170206133825-1::awood failed.  Error: Error executing SQL INSERT INTO public.cp_consumer_type (id, label, manifest) VALUES ('1008', 'share', 'N'): ERROR: duplicate key value violates unique constraint "cp_consumer_type_label_key"
[DEBUG 2018-03-14 03:50:31 main]   Detail: Key (label)=(share) already exists.
[DEBUG 2018-03-14 03:50:31 main] liquibase.exception.DatabaseException: Error executing SQL INSERT INTO public.cp_consumer_type (id, label, manifest) VALUES ('1008', 'share', 'N'): ERROR: duplicate key value violates unique constraint "cp_consumer_type_label_key"



Version-Release number of selected component (if applicable):
Satellite v 6.3


Steps to Reproduce:
1. Upgrade satellite v 6.2 to 6.3  (its reproducible only when we have the entry present in the database table before upgrade)
2. 
3.

Actual results:
- Upgrade fails with error mentioned above. 


Expected results:
- If the entry is already present in the candlepin database then foreman-maintain upgrade check should remove it or ask an admin to remove it by pointing out the KCS / required steps. 

Additional info:

Here are the steps to fix this issue: 

# mkdir /candlepin-bkp
# chmod 777 /candlepin-bkp
# runuser - postgres -c "pg_dump -Fc candlepin > /candlepin-bkp/candlepin.dump"

# su - postgres
$ psql candlepin
candlepin=# delete from cp_consumer_type where label='share';
candlepin=# \q
bash-4.2$ exit

# foreman-maintain upgrade run --target-version 6.3

For more details you can refer below KCS article: 

https://access.redhat.com/solutions/3380851

Comment 2 Kavita 2018-03-15 12:56:37 UTC
Hello Michael,

As per description, upgrade process failed on candlepin db migration with message "ERROR: duplicate key value violates unique constraint cp_consumer_type_label_key".

IMHO, fix for the this issue is expected in candlepin.

Please confirm.

Comment 3 Kavita 2018-06-07 13:23:18 UTC
I have confirmed this from Micheal that this issue is related to Candlepin and fix should be expected there so moving this under Candlepin component.

Comment 5 Kevin Howell 2018-06-11 14:15:20 UTC

*** This bug has been marked as a duplicate of bug 1554371 ***


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