Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1595284 - creating realm without realm proxy installed causes ISE: insert or update on table "realms" violates foreign key constraint "realms_realm_proxy_id_fk"
Summary: creating realm without realm proxy installed causes ISE: insert or update on ...
Keywords:
Status: NEW
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Realm
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Stephen Wadeley
URL:
Whiteboard:
: 1581168 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-26 13:42 UTC by Jan Hutař
Modified: 2019-03-24 03:21 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)

Description Jan Hutař 2018-06-26 13:42:26 UTC
Description of problem:
creating realm without realm proxy installed causes ISE: insert or update on table "realms" violates foreign key constraint "realms_realm_proxy_id_fk"


Version-Release number of selected component (if applicable):
satellite-6.4.0-9.beta.el7sat.noarch


How reproducible:
always


Steps to Reproduce:
1. # hammer -v -u admin -p changeme --output=csv realm create --name="SomeName" --realm-proxy-id="SomeRealmProxyId" --realm-type="Red Hat Identity Management"


Actual results:
# hammer -v -u admin -p changeme --output=csv realm create --name="SomeName" --realm-proxy-id="SomeRealmProxyId" --realm-type="Red Hat Identity Management"
[ERROR 2018-06-26T15:39:09 API] 500 Internal Server Error
[ERROR 2018-06-26T15:39:09 Exception] PG::ForeignKeyViolation: ERROR:  insert or update on table "realms" violates foreign key constraint "realms_realm_proxy_id_fk"
DETAIL:  Key (realm_proxy_id)=(0) is not present in table "smart_proxies".
: INSERT INTO "realms" ("name", "realm_type", "realm_proxy_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"
Could not create the realm:
  PG::ForeignKeyViolation: ERROR:  insert or update on table "realms" violates foreign key constraint "realms_realm_proxy_id_fk"
  DETAIL:  Key (realm_proxy_id)=(0) is not present in table "smart_proxies".
  : INSERT INTO "realms" ("name", "realm_type", "realm_proxy_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"
[ERROR 2018-06-26T15:39:09 Exception] 

RestClient::InternalServerError (500 Internal Server Error):
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/abstract_response.rb:223:in `exception_with_response'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/abstract_response.rb:103:in `return!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:353:in `block in rest_client_call_block'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:807:in `process_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:725:in `block in transmit'
    /opt/rh/rh-ruby24/root/usr/share/ruby/net/http.rb:877:in `start'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:715:in `transmit'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:145:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:52:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/resource.rb:67:in `post'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:327:in `call_client'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:240:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:190:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:185:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/apipie/command.rb:51:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.0/lib/hammer_cli_foreman/commands.rb:168:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/apipie/command.rb:34:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.0/bin/hammer:143:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'


Expected results:
Should return some helpful message


Additional info:
There is also this PostgreSQL error:

==> /var/lib/pgsql/data/pg_log/postgresql-Tue.log <==
ERROR:  insert or update on table "realms" violates foreign key constraint "realms_realm_proxy_id_fk"
DETAIL:  Key (realm_proxy_id)=(0) is not present in table "smart_proxies".
STATEMENT:  INSERT INTO "realms" ("name", "realm_type", "realm_proxy_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"

Comment 3 Jan Hutař 2018-06-26 13:46:41 UTC
Same happens when I rerun installer with:

    # satellite-installer --scenario satellite --foreman-proxy-realm

Comment 6 Patrick Creech 2019-03-21 13:37:41 UTC
*** Bug 1581168 has been marked as a duplicate of this bug. ***


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