Bug 1585408
Summary: | SQL error when adding some puppet modules to CV: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "katello_cv_puppet_modules_name" | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Jan Hutař <jhutar> |
Component: | Content Views | Assignee: | Stephen Benjamin <stbenjam> |
Status: | CLOSED ERRATA | QA Contact: | Lai <ltran> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 6.4 | CC: | akarsale, apatel, kgaikwad, ltran, mbacovsk, pcreech, rabajaj, sjagtap, stbenjam, tstrachota |
Target Milestone: | 6.4.0 | Keywords: | Triaged |
Target Release: | Unused | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | tfm-rubygem-katello-3.7.0.rc1.2-0.1.rc1.2 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2018-10-16 19:08:39 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Jan Hutař
2018-06-02 13:37:35 UTC
This feels more like server issue (database error is probably not related to CLI), moving to content views as the foreign key is probably added from there. Created redmine issue http://projects.theforeman.org/issues/23945 from this bug Many people can, for example, create a "motd" module. They are namespaced by author, so while "puppetlabs/motd" and "stbenjam/motd" are different modules, clients just reference 'motd' meaning they can only have 1 of that name available. In Katello, a repo can have many implementations of 'motd' but a content view can only have 1. A better reproducer than syncing all of puppet forge: 1. Create a puppet module repository 2. Upload the [puppetlabs](https://forge.puppet.com/v3/files/puppetlabs-motd-1.9.0.tar.gz) and [ericsson](https://forge.puppet.com/v3/files/ericsson-motd-1.0.3.tar.gz) implementations of 'motd', and get the UUID's with `hammer puppet-module list`: ``` 3 | motd | ericsson | 1.0.3 | 7ade8518-4314-49e9-a7ab-b6ed5cf2df59l 2 | motd | puppetlabs | 1.9.0 | 45b9a9a2-2a9e-48b1-8a2d-160ae0fec59c ``` 3. Create a content-view and try adding both modules: ``` $ hammer content-view puppet-module add --content-view-id 2 --organization-id=1 --uuid 7ade8518-4314-49e9-a7ab-b6ed5cf2df59 Puppet module added to content view $ hammer content-view puppet-module add --content-view-id 2 --organization-id=1 --uuid 45b9a9a2-2a9e-48b1-8a2d-160ae0fec59c ``` Previously you'd get this error: ``` Could not add the puppet module: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "katello_cv_puppet_modules_name" DETAIL: Key (name, content_view_id)=(motd, 2) already exists. : INSERT INTO "katello_content_view_puppet_modules" ("content_view_id", "name", "author", "uuid", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" ``` With this change, you'll get the more user friendly: ``` There is already a module named "motd" in this content view. ``` Upstream bug assigned to stbenjam Upstream bug assigned to stbenjam Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/23945 has been resolved. 1) Create a puppet module repository 2) Upload the [puppetlabs](https://forge.puppet.com/v3/files/puppetlabs-motd-1.9.0.tar.gz) and [ericsson](https://forge.puppet.com/v3/files/ericsson-motd-1.0.3.tar.gz) implementations of 'motd', and get the UUID's with `hammer puppet-module list`: 3) ---|------|------------|---------|------------------------------------- ID | NAME | AUTHOR | VERSION | UUID ---|------|------------|---------|------------------------------------- 2 | motd | ericsson | 1.0.3 | 5d3b1bca-0138-4392-a7cf-c71c68eae748 1 | motd | puppetlabs | 1.9.0 | 555698ac-8ad3-47b0-8761-5b59161007c9 ---|------|------------|---------|------------------------------------- 4) # hammer content-view puppet-module add --content-view-id 3 --organization-id=1 --uuid 5d3b1bca-0138-4392-a7cf-c71c68eae748 Puppet module added to content view 5) # hammer content-view puppet-module add --content-view-id 3 --organization-id=1 --uuid 555698ac-8ad3-47b0-8761-5b59161007c9 Validation failed: Name There is already a module named "motd" in this content view. User friendly message was able to be generated with the above steps in sat6.4. This was verified in snap_6.4.0_22.0. 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. https://access.redhat.com/errata/RHSA-2018:2927 |