Bug 1030806

Summary: restore.sh - wrong example commands in --help
Product: Red Hat Enterprise Virtualization Manager Reporter: Jiri Belka <jbelka>
Component: ovirt-engineAssignee: Eli Mesika <emesika>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Beňas <pbenas>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 3.3.0CC: acathrow, emesika, iheim, lpeer, pbenas, pstehlik, Rhev-m-bugs, yeylon
Target Milestone: ---   
Target Release: 3.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: ovirt-3.4.0-alpha1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jiri Belka 2013-11-15 08:17:11 UTC
Description of problem:

See original story at https://bugzilla.redhat.com/show_bug.cgi?id=976337#c6

Wrong escaping or usage of double quotes.

...
        2) Drop existing from root user by : su - postgres -c "psql -d template1 -c "drop database <db>;"" 
...

-%-
# su - postgres -c "psql -d template1 -c "drop database engine;""
ERROR:  syntax error at end of input
LINE 1: drop
            ^
-bash: : command not found
-%-

Either escape nested double quotes or use single quotes inside double quotes.

Same issue with following example from --help.

        3) Create a new blank db with the same name by:  su - postgres -c "psql -d template1 -c "create database <db> owner engine;"".

Why not to replace <db> to engine? If anybody wants to "clone" to different DB name, he would probably know how to do it...

Version-Release number of selected component (if applicable):
is22

How reproducible:
100%

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Sandro Bonazzola 2014-01-14 08:43:59 UTC
ovirt 3.4.0 alpha has been released

Comment 2 Petr Beňas 2014-02-17 12:36:01 UTC
Verified in 3.4.0-0.7.beta2.el6.

[root@pb-rh34 ~]# /usr/share/ovirt-engine/dbscripts/restore.sh -h
Usage: restore.sh [-h] [-s SERVERNAME] [-p PORT] -u USERNAME -d DATABASE -f FILE [-o]
    This script must run with a DB engine user credentials.
    -s SERVERNAME - The database servername for the database (def. localhost).
    -p PORT       - The database port for the database       (def. 5432).
    -u USERNAME   - The username for the database            (def. engine).
    -d DATABASE   - The database name, this must match the db name recorded in the backup file.
    -f File       - Backup file name to restore from .
    -o            - Omit upgrade step.
    -h            - This help text.
    for more options please run pg_restore --help
    The recommended way for restoring your database is.
    1) Backup current database with backup.sh.
    2) Drop existing from root user by : su - postgres -c "psql -d template1 -c 'drop database engine;'"
    3) Create a new blank db with the same name by:  su - postgres -c "psql -d template1 -c 'create database engine owner engine;'"
    4) Run restore.sh and give new database instance name as the target.

Comment 3 Itamar Heim 2014-06-12 14:09:56 UTC
Closing as part of 3.4.0