Bug #24633
closedDuplicate puppet classes are created when publishing content views in parallel
Description
Description of problem:
Puppet class is created multiple times when content views with the same class
are published in parallel.
Steps to Reproduce:
1. On a clean instance, prepare 2 content views with the same puppet class:
hammer --output csv organization create --name clash_a hammer --output csv organization create --name clash_b hammer --output csv product create --description description --label clash_product_a_label --name clash_product_a --organization-id 3 hammer --output csv product create --description description --label clash_product_b_label --name clash_product_b --organization-id 4 hammer --output csv repository create --content-type puppet --name puppet_clash_repo_a --product-id 245 --publish-via-http true --url="http://puppetmodules.example.com/bagoftricks" hammer --output csv repository create --content-type puppet --name puppet_clash_repo_b --product-id 246 --publish-via-http true --url="http://puppetmodules.example.com/bagoftricks" hammer --output csv repository synchronize --id 10 hammer --output csv repository synchronize --id 11 hammer --output csv content-view create --name clash_cv_a --organization-id 3 hammer --output csv content-view create --name clash_cv_b --organization-id 4 hammer --output csv content-view puppet-module add --author robottelo --name generic_1 --content-view-id 5 hammer --output csv content-view puppet-module add --author robottelo --name generic_1 --content-view-id 6
2. publish content views in parallel, I used hammer from 2 different terminals
3. go to Configure -> Puppet Classes, you should see duplicate entries, each in different environment
Actual results
Publishing in parallel bypasses the Rails validations and creates duplicates. Puppet classes with the same name break 'hammer puppet-class info --name' command.
Expected results:
No duplicates should exist.
Files
Updated by Ondřej Pražák about 6 years ago
- File puppetclasses_expected.png added
- File puppetclasses_actual.png added
- Subject changed from Duplicate puppet classes are created when publishing content views in parallel to Duplicate puppet classes are created when publishing content views in parallel
- Category changed from 89 to Content Views
Updated by Ondřej Pražák about 6 years ago
- File deleted (
puppetclasses_expected.png)
Updated by Ondřej Pražák about 6 years ago
- File deleted (
puppetclasses_actual.png)
Updated by Ondřej Pražák about 6 years ago
- File puppetclasses_actual.png puppetclasses_actual.png added
- File puppetclasses_expected.png puppetclasses_expected.png added
Updated by Andrew Kofink about 6 years ago
- Project changed from Katello to Foreman
- Category deleted (
Content Views)
Puppet classes need to be uniquely validated by name in the database. Rails validations won't handle this race condition.
This should be able to be reproduced by importing two environments at the same time.
Updated by The Foreman Bot about 6 years ago
- Status changed from New to Ready For Testing
- Assignee set to Ondřej Pražák
- Pull request https://github.com/theforeman/foreman/pull/6019 added
Updated by Ondřej Pražák about 6 years ago
- Related to Feature #24923: Add check for puppet class duplicates added
Updated by Marek Hulán almost 6 years ago
- Pull request https://github.com/theforeman/foreman_maintain/pull/212 added
Updated by Ondřej Pražák almost 6 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset ed2b4d1d62ef99fb1aaea04c840d8aa66abbe8f2.