Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
The label needs to be unique. So, using the second repo named "latest" will cause the following error in candlepin:
Dec 22 19:20:37 [http-8443-1] ERROR org.hibernate.util.JDBCExceptionReporter - Batch entry 0 insert into cp_content (created, updated, contentUrl, gpgUrl, label, metadataExpire, name, requiredTags, type, vendor, id) values ('2011-12-22 19:20:37.671000 -05:00:00', '2011-12-22 19:20:37.671000 -05:00:00', '/custom/systemengine/latest', '', 'latest', NULL, 'latest', NULL, 'yum', 'Custom', '1324599637671') was aborted. Call getNextException to see the cause.
Dec 22 19:20:37 [http-8443-1] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 23505
Dec 22 19:20:37 [http-8443-1] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: duplicate key value violates unique constraint "cp_content_label_key"
Dec 22 19:20:37 [http-8443-1] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
I would suggest makeing the label be productName + " " + repo name replacing all spaces with _.
In candlepin-0.5.8-1 only label must be unique.
It was solved by prefixing the repo name with product id in Katello. It's not ideal, but it works.
productName + " " + repoName is not sufficient because there might be two products with the same name in two organizations. We could add orgName to prefix to be unique, but I'm not sure the lenght is ideal?
Modified in commit 0c75d7d54772b73d251d74ea0b064acf2689a7ff:
Changing form of generated label from {product.id}-{repo.name} to
{org.name}_{product.name}_{repo.name}. The reason is that this label is shown
in redhat.repo and therefore it should be more user friendly.
The length is not an issue (255 chars should be enough for the whole part).
I am changing it back, but in slightly different order. So instead
{org.name}_{product.name}_{repo.name}
we get
{repo.name}_{self.id}
This is because repo binding/unbinding. We would need to do another query into Candlepin to get a label. Such a service would need to be created first. This format makes it easier.
Ok I am NOT changing the format to "#{repo.name}-#{self.id}".gsub(/\s/,"_").
Keeping Ivan's implementation:
"#{self.organization.name} #{self.name} #{repo.name}".gsub(/\s/,"_")
The label needs to be unique. So, using the second repo named "latest" will cause the following error in candlepin: Dec 22 19:20:37 [http-8443-1] ERROR org.hibernate.util.JDBCExceptionReporter - Batch entry 0 insert into cp_content (created, updated, contentUrl, gpgUrl, label, metadataExpire, name, requiredTags, type, vendor, id) values ('2011-12-22 19:20:37.671000 -05:00:00', '2011-12-22 19:20:37.671000 -05:00:00', '/custom/systemengine/latest', '', 'latest', NULL, 'latest', NULL, 'yum', 'Custom', '1324599637671') was aborted. Call getNextException to see the cause. Dec 22 19:20:37 [http-8443-1] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 23505 Dec 22 19:20:37 [http-8443-1] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: duplicate key value violates unique constraint "cp_content_label_key" Dec 22 19:20:37 [http-8443-1] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) I would suggest makeing the label be productName + " " + repo name replacing all spaces with _.