| Summary: | spacewalk-hostname-rename @postrgesql fails (SQL syntax error) | |||
|---|---|---|---|---|
| Product: | [Community] Spacewalk | Reporter: | Lukas Pramuk <lpramuk> | |
| Component: | Clients | Assignee: | Milan Zázrivec <mzazrivec> | |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Red Hat Satellite QA List <satqe-list> | |
| Severity: | unspecified | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 1.7 | CC: | bugzilla, cperry, prmarino1 | |
| Target Milestone: | --- | |||
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | Bug Fix | ||
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 820123 (view as bug list) | Environment: | ||
| Last Closed: | 2012-11-01 16:18:02 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: | ||
| Bug Depends On: | ||||
| Bug Blocks: | 820123, 871344 | |||
spacewalk.git master: af92a3dd2101a0b9759ad63f8abfd138089d5c2f I ran into this too
Its the QUIT commands in the sql statments that break it.
This diff should break the script in the right so it will work for you.
copy the script into your home directory and apply this diff with the patch command
It disables the database running check and gets rid of the "QUIT" statements which is the only Oracle specific syntax in the functional portion of the code.
unfortunately it will produce errors about the client closing the connection unexpectedly however that's not a really serious problem however i wouldn't try to put it into the core repo because of it.
--- spacewalk-hostname-rename.orig 2012-04-04 11:49:42.063065418 -0400
+++ spacewalk-hostname-rename 2012-04-04 11:57:35.000096385 -0400
@@ -331,7 +331,6 @@
UPDATE rhn_sat_cluster SET vip = '$IP' WHERE public_key LIKE '${NOCPULSE_OLD_PUBLIC_KEY}%';
UPDATE rhn_sat_node SET ip = '$IP' WHERE EXISTS (SELECT 1 FROM rhn_sat_cluster RSC WHERE RSC.public_key LIKE '${NOCPULSE_OLD_PUBLIC_KEY}%' AND sat_cluster_id = RSC.recid);
COMMIT;
-QUIT
EOS
}
@@ -417,7 +416,7 @@
" | spacewalk-sql --select-mode -
)
# SQL_RET="${SQL_RET#"${SQL_RET%%[![:space:]]*}"}"
-print_status "${SQL_RET}" "Your database isn't running."
+#print_status "${SQL_RET}" "Your database isn't running."
echo -n "Updating /etc/rhn/rhn.conf ... " | tee -a $LOG
update_rhn_conf
@@ -450,7 +449,6 @@
UPDATE rhn_config_macro SET definition='$HOSTNAME' WHERE name='RHN_SAT_HOSTNAME';
UPDATE rhn_config_macro SET definition='$HOSTNAME' WHERE name='MDOM';
COMMIT;
-QUIT
EOS
print_status 0 # just simulate end
fi
@@ -479,7 +477,6 @@
spacewalk-sql --select-mode - >>$LOG <<EOS
UPDATE rhntemplatestring SET value='$HOSTNAME' WHERE label='hostname';
COMMIT;
-QUIT
EOS
print_status 0 # just simulate end
@@ -493,7 +490,6 @@
spacewalk-sql --select-mode - >>$LOG <<EOS
DELETE FROM rhnPushDispatcher WHERE hostname != '$HOSTNAME';
COMMIT;
-QUIT
EOS
for jabber_config_file in c2s.xml s2s.xml sm.xml
*** Bug 842153 has been marked as a duplicate of this bug. *** Moving ON_QA. Packages that address this bugzilla should now be available in yum repos at http://yum.spacewalkproject.org/nightly/ Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18 |
Description of problem: Against postgresql spacewalk the "spacewalk-hostname-rename" command fails with SQL syntax error. It seems that it uses same sql code for both oracle and postgres. Version-Release number of selected component (if applicable): spacewalk-utils-1.7.15-1.el6.noarch spacewalk-schema-1.7.55-1.el6.noarch How reproducible: always Steps to Reproduce: 1.spacewalk-hostname-rename <ip> Actual results: spacewalk-hostname-rename fails, error msg printed Expected results: spacewalk-hostname-rename succeeds, no errors Additional info: spacewalk-hostname-rename x.x.x.x Validating IP ... OK ============================================= hostname: fqdn ip: x.x.x.x ============================================= Stopping rhn-satellite services ... OK Testing DB connection ... Running: psql -U spaceuser -d spaceschema -v ON_ERROR_STOP=ON -f - -h localhost -p 5432 psql:<stdin>:1: ERROR: syntax error at or near "off" LINE 1: set feed off; ^ FAILED Your database isn't running. Fix the problem and run /usr/bin/spacewalk-hostname-rename again