Bug 233027 - make db2bak.pl & db2ldif.pl user more user-friendly
Summary: make db2bak.pl & db2ldif.pl user more user-friendly
Status: CLOSED CURRENTRELEASE
Alias: None
Product: 389
Classification: Retired
Component: Command Line Utilities   
(Show other bugs)
Version: 1.0.4
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Noriko Hosoi
QA Contact: Viktor Ashirov
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: 152373 189903 240316 FDS1.1.0
TreeView+ depends on / blocked
 
Reported: 2007-03-19 22:34 UTC by Noriko Hosoi
Modified: 2015-12-07 16:39 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-07 16:39:25 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
cvs diff template-db2bak.pl.in template-db2ldif.pl.in (3.32 KB, patch)
2007-03-19 22:41 UTC, Noriko Hosoi
no flags Details | Diff
cvs commit message (668 bytes, text/plain)
2007-03-19 23:02 UTC, Noriko Hosoi
no flags Details
cvs diff template-db2bak.in, template-db2bak.pl.in, template-db2ldif.in (4.59 KB, patch)
2007-03-20 00:39 UTC, Noriko Hosoi
no flags Details | Diff
cvs commit message (1.67 KB, text/plain)
2007-03-20 01:16 UTC, Noriko Hosoi
no flags Details
cvs diff template-db2ldif.in (1.48 KB, patch)
2007-03-23 02:10 UTC, Noriko Hosoi
no flags Details | Diff
cvs diff template-db2ldif.in and its commit message (2.27 KB, text/plain)
2007-03-24 00:52 UTC, Noriko Hosoi
no flags Details
cvs commit message (527 bytes, text/plain)
2007-03-29 22:27 UTC, Noriko Hosoi
no flags Details

Description Noriko Hosoi 2007-03-19 22:34:46 UTC
Description of problem:
[background info]
> Both db2bak.pl and db2ldif.pl do not say much about where they are backing up
or exporting.
> ./db2ldif.pl -D "cn=Directory Manager" -w <pw> -n userRoot`
> adding new entry cn=export_2007_3_19_11_1_38, cn=export, cn=tasks, cn=config
>
> ./db2bak.pl -D 'cn=Directory Manager' -w <pw>
> adding new entry cn=backup_2007_3_19_11_14_51, cn=backup, cn=tasks, cn=config
>
> Isn't it nicer the perl scripts prints out something like "exporting to
<fullpath>/<ldiffilename>" or "backing up to <backup_dir>" if it's not too noisy?
Yes, they should print something like that.
>
> Maybe, we'd better add "backend name" to the path as well?  E.g.,
laputa-userRoot_2007_3_19_11_14_51.ldif.
Sure. 

[Fix proposal]
db2bak.pl
=========
./db2bak.pl -D 'cn=Directory Manager' -w <pw>
Back up directory: /opt/fedora-ds/slapd-laputa/bak/2007_3_19_14_18_17
adding new entry cn=backup_2007_3_19_14_18_17, cn=backup, cn=tasks, cn=config

db2ldif.pl
==========
1) if suffixes are given, the first rdn values are added to the ldif file name
following the server id separated by '-'s.
./db2ldif.pl -D 'cn=Directory Manager' -w <pw> -s dc=example,dc=com -s
o=netscaperoot
Exported ldif file:
/opt/fedora-ds/slapd-laputa/ldif/laputa-example-netscaperoot-2007_3_19_14_18_7.ldif
adding new entry cn=export_2007_3_19_14_18_7, cn=export, cn=tasks, cn=config

2) if backend instance names are given, the instance names are added to the ldif
file name following the server id separated by '-'s.
./db2ldif.pl -D 'cn=Directory Manager' -w Secret123 -n userRoot -n netscapeRoot
Exported ldif file:
/opt/fedora-ds/slapd-laputa/ldif/laputa-userRoot-netscapeRoot-2007_3_19_14_18_14.ldif
adding new entry cn=export_2007_3_19_14_18_14, cn=export, cn=tasks, cn=config

note: if '-a' options are given to the both utilities, the specified path is
used for the back up dir/ldif file.

Comment 1 Noriko Hosoi 2007-03-19 22:41:48 UTC
Created attachment 150442 [details]
cvs diff template-db2bak.pl.in template-db2ldif.pl.in

Files:
 ldap/admin/src/scripts/template-db2bak.pl.in
 ldap/admin/src/scripts/template-db2ldif.pl.in

Changes:
 db2bak.pl: print out the back up directory
   Back up directory: ...
 db2ldif.pl: print out the exported ldif file name
   Exported ldif file: ...
   The ldif file name format: <server id>-[<backend>}<first suffix
value>]+-<date_time>.ldif

Comment 2 Noriko Hosoi 2007-03-19 22:44:19 UTC
We may want to mention this ldif file name change in the doc...?

Comment 3 Noriko Hosoi 2007-03-19 23:02:26 UTC
Created attachment 150443 [details]
cvs commit message

Reviewed by Rich (Thank you!)

Checked in into HEAD.

Comment 4 Noriko Hosoi 2007-03-20 00:39:47 UTC
Created attachment 150447 [details]
cvs diff template-db2bak.in, template-db2bak.pl.in, template-db2ldif.in

Files:
 ldap/admin/src/scripts/template-db2bak.in
 ldap/admin/src/scripts/template-db2bak.pl.in
 ldap/admin/src/scripts/template-db2ldif.in

Changes:
1) Found db2bak, db2bak.pl, and db2ldif do not backup/export into the dir/file
which do not start with the <server-id> string. It could cause the difficulty
to find out which server instance does the backup/exported file belongs to. 
Also, to make them consistent with db2ldif.pl, added the "server id" string to
the back up dir name/exported ldif file name.
2) db2ldif[.pl] takes -M option.  With the -M option, the server adds backend
name to the ldif file name.  To reduce the redundancy, stopped adding the
backend name if -M is set.
3) made the ldif file name db2ldif generates consistent with the one db2ldif.pl
generates.

Comment 5 Noriko Hosoi 2007-03-20 01:16:30 UTC
Created attachment 150451 [details]
cvs commit message

Thanks again for reviewing the changes, Rich.

Checked in into HEAD.

Comment 8 Noriko Hosoi 2007-03-23 02:10:02 UTC
Created attachment 150717 [details]
cvs diff template-db2ldif.in

File: ldap/admin/src/scripts/template-db2ldif.in

Problem description: the command line fails to generate an output file name
when an empty suffix is passed as follows:
db2ldif -s ""

Changes: check if the suffix is empty or not.  If it is empty, generates an
output file name without it.

Comment 9 Noriko Hosoi 2007-03-24 00:52:47 UTC
Created attachment 150813 [details]
cvs diff template-db2ldif.in and its commit message

Reviewed by Rich (Thank you!)

Checked in a slightly revised version into HEAD (removed redundant variable
"nobe"...)

Comment 10 Noriko Hosoi 2007-03-29 21:36:15 UTC
There's one more change needed for 'db2ldif -s ""' work...

Index: template-db2ldif.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/template-db2ldif.in,v
retrieving revision 1.7
diff -t -w -U4 -r1.7 template-db2ldif.in
--- template-db2ldif.in 24 Mar 2007 00:51:11 -0000      1.7
+++ template-db2ldif.in 29 Mar 2007 21:34:34 -0000
@@ -43,9 +43,11 @@
             fi
         elif [ "$1" = "-M" ]; then
             be=""
         fi
+        if [ "$1" != "" ]; then
         shift
+        fi
     done

     if [ "$be" = "" ]; then
         echo {{LDIF-DIR}}/{{SERV-ID}}-`date +%Y_%m_%d_%H%M%S`.ldif


Comment 11 Noriko Hosoi 2007-03-29 22:27:56 UTC
Created attachment 151242 [details]
cvs commit message

Reviewed by Nathan (Thank you!)

Checked in into HEAD.


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