Project

General

Profile

Bug #24633

Duplicate puppet classes are created when publishing content views in parallel

Added by Ondřej Pražák 4 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Normal
Category:
Puppet integration
Target version:
-
Team Backlog:
Fixed in Releases:
Found in Releases:

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.

puppetclasses_actual.png View puppetclasses_actual.png 89.5 KB Ondřej Pražák, 08/16/2018 10:49 AM
puppetclasses_expected.png View puppetclasses_expected.png 98.7 KB Ondřej Pražák, 08/16/2018 10:49 AM
Puppetclasses actual Puppetclasses expected

Related issues

Related to Foreman Maintain - Feature #24923: Add check for puppet class duplicatesClosed

Associated revisions

Revision ed2b4d1d (diff)
Added by Ondřej Pražák 3 months ago

Fixes #24633 - Add uniqueness to puppet class name (#6019)

History

#1 Updated by Ondřej Pražák 4 months ago

  • Category changed from Puppet to Content Views
  • 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
  • File puppetclasses_actual.png added
  • File puppetclasses_expected.png added

#2 Updated by Ondřej Pražák 4 months ago

  • File deleted (puppetclasses_expected.png)

#3 Updated by Ondřej Pražák 4 months ago

  • File deleted (puppetclasses_actual.png)

#5 Updated by Andrew Kofink 4 months ago

  • Category deleted (Content Views)
  • Project changed from Katello to Foreman

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.

#6 Updated by The Foreman Bot 4 months ago

  • Assignee set to Ondřej Pražák
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6019 added

#7 Updated by Ondřej Pražák 3 months ago

  • Related to Feature #24923: Add check for puppet class duplicates added

#8 Updated by Marek Hulán 3 months ago

  • Pull request https://github.com/theforeman/foreman_maintain/pull/212 added

#9 Updated by Marek Hulán 3 months ago

  • Fixed in Releases 1.20.0 added

#10 Updated by Ondřej Pražák 3 months ago

  • Status changed from Ready For Testing to Closed

#11 Updated by Tomer Brisker 2 months ago

  • Category set to Puppet integration

Also available in: Atom PDF