Bug 233027 - make db2bak.pl & db2ldif.pl user more user-friendly
make db2bak.pl & db2ldif.pl user more user-friendly
Status: CLOSED CURRENTRELEASE
Product: 389
Classification: Community
Component: Command Line Utilities (Show other bugs)
1.0.4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Noriko Hosoi
Viktor Ashirov
:
Depends On:
Blocks: 152373 189903 240316 FDS1.1.0
  Show dependency treegraph
 
Reported: 2007-03-19 18:34 EDT by Noriko Hosoi
Modified: 2015-12-07 11:39 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-12-07 11:39:25 EST
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 18:41 EDT, Noriko Hosoi
no flags Details | Diff
cvs commit message (668 bytes, text/plain)
2007-03-19 19:02 EDT, Noriko Hosoi
no flags Details
cvs diff template-db2bak.in, template-db2bak.pl.in, template-db2ldif.in (4.59 KB, patch)
2007-03-19 20:39 EDT, Noriko Hosoi
no flags Details | Diff
cvs commit message (1.67 KB, text/plain)
2007-03-19 21:16 EDT, Noriko Hosoi
no flags Details
cvs diff template-db2ldif.in (1.48 KB, patch)
2007-03-22 22:10 EDT, Noriko Hosoi
no flags Details | Diff
cvs diff template-db2ldif.in and its commit message (2.27 KB, text/plain)
2007-03-23 20:52 EDT, Noriko Hosoi
no flags Details
cvs commit message (527 bytes, text/plain)
2007-03-29 18:27 EDT, Noriko Hosoi
no flags Details

  None (edit)
Description Noriko Hosoi 2007-03-19 18:34:46 EDT
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 18:41:48 EDT
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 18:44:19 EDT
We may want to mention this ldif file name change in the doc...?
Comment 3 Noriko Hosoi 2007-03-19 19:02:26 EDT
Created attachment 150443 [details]
cvs commit message

Reviewed by Rich (Thank you!)

Checked in into HEAD.
Comment 4 Noriko Hosoi 2007-03-19 20:39:47 EDT
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-19 21:16:30 EDT
Created attachment 150451 [details]
cvs commit message

Thanks again for reviewing the changes, Rich.

Checked in into HEAD.
Comment 8 Noriko Hosoi 2007-03-22 22:10:02 EDT
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-23 20:52:47 EDT
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 17:36:15 EDT
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 18:27:56 EDT
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.