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.
Bug 1354568 - creating a hostgroup with invalid id option should raise proper error instead of foreign key constraint error
Summary: creating a hostgroup with invalid id option should raise proper error instead...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: API
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Dominik Hlavac Duran
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On: 1398392
Blocks: 1484102
TreeView+ depends on / blocked
 
Reported: 2016-07-11 15:20 UTC by Sachin Ghai
Modified: 2019-04-01 20:27 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-09-04 17:42:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 20888 0 Normal Ready For Testing creating a hostgroup with invalid id option should raise proper error instead of foreign key constraint error 2020-02-07 16:49:32 UTC
Red Hat Bugzilla 1484102 0 unspecified CLOSED hammer host creation should handle non-existant os id instead of PG:Error 2021-02-22 00:41:40 UTC

Internal Links: 1484102

Description Sachin Ghai 2016-07-11 15:20:43 UTC
Description of problem:
Creating a hostgroup with invalid subnet id raises:

~]# hammer -u admin -p changeme hostgroup create --name test123512 --organizations='Default Organization' --location-ids 1 --puppet-proxy-id 1   --puppet-ca-proxy-id 1 --root-pass redhat123 --subnet-id 1 --domain-id 1
Could not create the hostgroup:
  ERROR:  insert or update on table "hostgroups" violates foreign key constraint "hostgroups_subnet_id_fk"
  DETAIL:  Key (subnet_id)=(1) is not present in table "subnets".

Version-Release number of selected component (if applicable):
sat62 GA snap19

How reproducible:


Steps to Reproduce:
1. create hostgroup with invalid subnet-id
2.
3.

Actual results:


Expected results:
user should get an error: subnet not found


Additional info:

Comment 2 Sachin Ghai 2016-07-12 08:12:46 UTC
this issue appears with all 'id' options of hostgroup like:

invalid arch-id:
===============
 ~]# hammer -u admin -p changeme hostgroup create --name test1234455 --architecture-id 45
Could not create the hostgroup:
  ERROR:  insert or update on table "hostgroups" violates foreign key constraint "hostgroups_architecture_id_fk"
  DETAIL:  Key (architecture_id)=(45) is not present in table "architectures".


invalid domain-id:
==================~]# hammer -u admin -p changeme hostgroup create --name test1234455 --domain-id 45
Could not create the hostgroup:
  ERROR:  insert or update on table "hostgroups" violates foreign key constraint "hostgroups_domain_id_fk"
  DETAIL:  Key (domain_id)=(45) is not present in table "domains".

invalid puppet-proxy-id:
=======================
~]# hammer -u admin -p changeme hostgroup create --name test1234455 --puppet-proxy-id 45
Could not create the hostgroup:
  ERROR:  insert or update on table "hostgroups" violates foreign key constraint "hostgroups_puppet_proxy_id_fk"
  DETAIL:  Key (puppet_proxy_id)=(45) is not present in table "smart_proxies".



user should get error: Couldn't find domain 'id' OR could not find architecture 'id'

Comment 3 Bryan Kearney 2016-12-20 11:09:24 UTC
Upstream bug assigned to szadok

Comment 4 Bryan Kearney 2016-12-20 11:09:27 UTC
Upstream bug assigned to szadok

Comment 5 Bryan Kearney 2016-12-20 17:09:36 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/17525 has been resolved.

Comment 6 Stanislav Tkachenko 2017-06-14 08:27:38 UTC
Failed on Satellite 6.3 Snap 2.0:
* foreman-1.15.0-1.el7sat.noarch
* satellite-6.3.0-15.0.beta.el7sat.noarch
* katello-3.4.0-3.el7sat.noarch

Could not create the hostgroup:
  ERROR:  insert or update on table "hostgroups" violates foreign key constraint "hostgroups_subnet_id_fk"
  DETAIL:  Key (subnet_id)=(5278) is not present in table "subnets".

Could not create the hostgroup:
  ERROR:  insert or update on table "hostgroups" violates foreign key constraint "hostgroups_domain_id_fk"
  DETAIL:  Key (domain_id)=(9981) is not present in table "domains".

Could not create the hostgroup:
  ERROR:  insert or update on table "hostgroups" violates foreign key constraint "hostgroups_architecture_id_fk"
  DETAIL:  Key (architecture_id)=(3990) is not present in table "architectures".

Comment 7 Satellite Program 2017-06-30 18:10:49 UTC
Upstream bug assigned to szadok

Comment 9 Satellite Program 2017-07-03 08:10:51 UTC
Upstream bug assigned to szadok

Comment 10 Satellite Program 2017-08-09 12:10:42 UTC
Upstream bug assigned to dhlavacd

Comment 11 Satellite Program 2017-08-09 12:10:45 UTC
Upstream bug assigned to dhlavacd

Comment 14 Marek Hulan 2017-09-11 11:41:39 UTC
Created redmine issue http://projects.theforeman.org/issues/20888 from this bug

Comment 15 Bryan Kearney 2018-09-04 17:42:38 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and we do not expect this to be implemented in the product in the foreseeable future. We are therefore closing this out as WONTFIX. If you have any concerns about this, please feel free to contact Rich Jerrido or Bryan Kearney. Thank you.


Note You need to log in before you can comment on or make changes to this bug.