Bug 1030806 - restore.sh - wrong example commands in --help
Summary: restore.sh - wrong example commands in --help
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
: 3.4.0
Assignee: Eli Mesika
QA Contact: Petr Beňas
URL:
Whiteboard: infra
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-15 08:17 UTC by Jiri Belka
Modified: 2016-02-10 19:28 UTC (History)
8 users (show)

Fixed In Version: ovirt-3.4.0-alpha1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 21591 0 None None None Never

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


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