Bug 1247525
Summary: | rhnservergroup table thrown error when run insert/update sql. | ||
---|---|---|---|
Product: | [Community] Spacewalk | Reporter: | Muhammad Aizuddin <aizuddin.zali> |
Component: | Server | Assignee: | Jan Dobes <jdobes> |
Status: | CLOSED NOTABUG | QA Contact: | Jan Hutař <jhutar> |
Severity: | urgent | Docs Contact: | |
Priority: | unspecified | ||
Version: | 2.2 | CC: | aizuddin.zali, avi.miller, jhutar |
Target Milestone: | --- | Keywords: | Reopened |
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2016-11-10 20:23:05 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1484117 |
Description
Muhammad Aizuddin
2015-07-28 08:54:39 UTC
This is not a bug. You need to call clear_log_id() and set_log_auth(:user_id) prior to running the insert. Otherwise, the trigger won't fire correctly. This is handled automatically by Spacewalk's Hibernate Factory and the Logging mechanisms associated with creating new objects via Java (and the API). Pseudo-code would look something like this (in PL/SQL): begin logging.clear_log_id(); logging.set_log_auth(1); insert into rhnservergroup (id, name, description, org_id) values (rhn_server_group_id_seq.nextval, :name, :description, :org_id); end; / This assumes you're inserting with the user_id of 1, which is the initial super-admin account. subversion-1.8.14-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-be2c11d456 Hi Avi, Thank you for looking at this. I concur the same after reading schema docs. Hence this is enhancement to the database-application structure. Regards subversion-1.8.15-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-6efa349a85 subversion-1.8.15-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with $ su -c 'dnf --enablerepo=updates-testing update subversion' You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-6efa349a85 Great, looks like no code change was required here. I have tested on both SWnightly@OracleXE10@RHEL6 and SWnightly@PostgreSQL@RHEL7 (spacewalk-schema-2.6.14-1.el?.noarch) by creating new organization what creates new records in the table and yay, new records were created: @Oracle before new organization creation: # echo "SELECT * FROM rhnservergroup;" | spacewalk-sql --select-mode-direct - ID NAME DESCRIPTION CURRENT_MEMBERS GROUP_TYPE ORG_ID CREATED MODIFIED ---------- ---------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------- ---------- ---------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- 1 Spacewalk Management Entitled Servers Spacewalk Management Entitled Servers 0 1 1 10-NOV-16 10.37.05.418097 AM 10-NOV-16 10.37.05.418369 AM 2 Virtualization Host Entitled Servers Virtualization Host Entitled Servers 0 2 1 10-NOV-16 10.37.05.430974 AM 10-NOV-16 10.37.05.431062 AM @Oracle after new organization created: # echo "SELECT * FROM rhnservergroup;" | spacewalk-sql --select-mode-direct - ID NAME DESCRIPTION CURRENT_MEMBERS GROUP_TYPE ORG_ID CREATED MODIFIED ---------- ---------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------- ---------- ---------- --------------------------------------------------------------------------- --------------------------------------------------------------------------- 3 Spacewalk Management Entitled Servers Spacewalk Management Entitled Servers 0 1 2 10-NOV-16 09.16.42.534602 PM 10-NOV-16 09.16.42.534674 PM 4 Virtualization Host Entitled Servers Virtualization Host Entitled Servers 0 2 2 10-NOV-16 09.16.42.562595 PM 10-NOV-16 09.16.42.562668 PM 1 Spacewalk Management Entitled Servers Spacewalk Management Entitled Servers 0 1 1 10-NOV-16 10.37.05.418097 AM 10-NOV-16 10.37.05.418369 AM 2 Virtualization Host Entitled Servers Virtualization Host Entitled Servers 0 2 1 10-NOV-16 10.37.05.430974 AM 10-NOV-16 10.37.05.431062 AM @PostgreSQL before: # echo "SELECT * FROM rhnservergroup;" | spacewalk-sql --select-mode-direct - id | name | description | current_members | group_type | org_id | created | modified ----+---------------------------------------+---------------------------------------+-----------------+------------+--------+-------------------------------+------------------------------- 1 | Spacewalk Management Entitled Servers | Spacewalk Management Entitled Servers | 0 | 1 | 1 | 2016-11-10 10:24:26.639337+01 | 2016-11-10 10:24:26.639337+01 2 | Virtualization Host Entitled Servers | Virtualization Host Entitled Servers | 0 | 2 | 1 | 2016-11-10 10:24:26.639337+01 | 2016-11-10 10:24:26.639337+01 (2 rows) @PostgreSQL after: # echo "SELECT * FROM rhnservergroup;" | spacewalk-sql --select-mode-direct - id | name | description | current_members | group_type | org_id | created | modified ----+---------------------------------------+---------------------------------------+-----------------+------------+--------+-------------------------------+------------------------------- 1 | Spacewalk Management Entitled Servers | Spacewalk Management Entitled Servers | 0 | 1 | 1 | 2016-11-10 10:24:26.639337+01 | 2016-11-10 10:24:26.639337+01 2 | Virtualization Host Entitled Servers | Virtualization Host Entitled Servers | 0 | 2 | 1 | 2016-11-10 10:24:26.639337+01 | 2016-11-10 10:24:26.639337+01 3 | Spacewalk Management Entitled Servers | Spacewalk Management Entitled Servers | 0 | 1 | 2 | 2016-11-10 21:17:20.981545+01 | 2016-11-10 21:17:20.981545+01 4 | Virtualization Host Entitled Servers | Virtualization Host Entitled Servers | 0 | 2 | 2 | 2016-11-10 21:17:20.981545+01 | 2016-11-10 21:17:20.981545+01 (4 rows) This BZ closed some time during 2.5, 2.6 or 2.7. Adding to 2.7 tracking bug. |