Project

General

Profile

Actions

Bug #5129

closed

Host Group creation may fail if Host Group with id 1 exists with same parameter name

Added by Justin Sherrill over 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

I believe the cause is similar to issue #4731. On a production RHEL or Centos install, when creating a Host Group and specifying some parameter, if a host group with ID = 1 already exists with that same parameter name the creation will fail with error "Name has already been taken". The cause is that when this validation is run:

validates :name, :uniqueness => {:scope => :reference_id}

The new parameter's reference_id is set to 1 instead of nil. Thus if a host group already exists with this parameter name (and that host group has an ID of 1), the validation will fail.

Here is an example of a validation:

GroupParameter Exists (0.2ms) SELECT 1 AS one FROM "parameters" WHERE "parameters"."type" IN ('GroupParameter') AND ("parameters"."name" = 'kt_org' AND "parameters"."reference_id" = 1) LIMIT 1

This was the sql generated with a new host group submission.

NOTE: this will not occur on a development install using the latest version of Rails 3.2.


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #6375: Can't create parameters for operating system with id 1 using APIClosedJoseph Magen06/25/2014Actions
Actions #1

Updated by Dominic Cleal over 10 years ago

  • Category set to Database
  • Status changed from New to Ready For Testing
  • Target version set to 1.8.4
Actions #2

Updated by Dominic Cleal over 10 years ago

  • Status changed from Ready For Testing to New
  • Target version deleted (1.8.4)

PR closed.

Actions #3

Updated by Justin Sherrill over 10 years ago

  • Bugzilla link set to https://bugzilla.redhat.com/show_bug.cgi?id=1103321
Actions #4

Updated by Dominic Cleal over 10 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Joseph Magen
  • Target version set to 1.8.1
Actions #5

Updated by Dominic Cleal over 10 years ago

  • Translation missing: en.field_release set to 18
Actions #6

Updated by Joseph Magen over 10 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #7

Updated by Dominic Cleal over 10 years ago

  • Related to Bug #6375: Can't create parameters for operating system with id 1 using API added
Actions

Also available in: Atom PDF