From f901190305cb01aa7a682a56ea0d212e6216049a Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Oct 23 2018 15:59:18 +0000 Subject: Ticket 49856 - Remove backend option from bak2db Description: The server has not supported backup/restore of a single backend for a long time now. All references to it should be remove from the CLI and man pages. https://pagure.io/389-ds-base/issue/49856 Reviewed by: tbordaz & spichugi(Thanks!!) --- diff --git a/ldap/admin/src/scripts/bak2db.in b/ldap/admin/src/scripts/bak2db.in index cb5ef14..5ab4546 100755 --- a/ldap/admin/src/scripts/bak2db.in +++ b/ldap/admin/src/scripts/bak2db.in @@ -13,10 +13,9 @@ export SHLIB_PATH usage() { - echo "Usage: bak2db archivedir [-Z serverID] [-n backend] [-q] [-h]" + echo "Usage: bak2db archivedir [-Z serverID] [-q] [-h]" echo "Options:" echo " archivedir - Directory where the archived backup is located" - echo " -n backend - Backend database name. Example: userRoot" echo " -Z serverID - Server instance identifier" echo " -q - Quiet mode - suppresses output" echo " -h - Display usage" @@ -44,7 +43,6 @@ do h) usage exit 0;; Z) servid=$OPTARG;; - n) args=$args" -n \"$OPTARG\"";; q) args=$args" -q";; d) args=$args" -d \"$OPTARG\"";; v) args=$args" -v";; diff --git a/ldap/admin/src/scripts/bak2db.pl.in b/ldap/admin/src/scripts/bak2db.pl.in index bba8b93..7987756 100644 --- a/ldap/admin/src/scripts/bak2db.pl.in +++ b/ldap/admin/src/scripts/bak2db.pl.in @@ -25,7 +25,7 @@ $i = 0; sub usage { print(STDERR "Usage: bak2db.pl [-Z serverID] [-D rootdn] { -w password | -w - | -j filename } -a dirname [-t dbtype]\n"); - print(STDERR " [-n backendname] [-P protocol] [-h]\n"); + print(STDERR " [-P protocol] [-h]\n"); print(STDERR "Options:\n"); print(STDERR " -D rootdn - Directory Manager\n"); print(STDERR " -w password - Directory Manager's password\n"); @@ -34,7 +34,6 @@ sub usage { print(STDERR " -j filename - Read Directory Manager's password from file\n"); print(STDERR " -a dirname - Backup directory\n"); print(STDERR " -t dbtype - Database type (default: ldbm database)\n"); - print(STDERR " -n backend - Backend database name. Example: userRoot\n"); print(STDERR " -P protocol - STARTTLS, LDAPS, LDAPI, LDAP (default: uses most secure protocol available)\n"); print(STDERR " -h - Display usage\n"); } @@ -50,8 +49,6 @@ while ($i <= $#ARGV) { $i++; $passwdfile = $ARGV[$i]; } elsif ("$ARGV[$i]" eq "-t") { # database type $i++; $dbtype = $ARGV[$i]; - } elsif ("$ARGV[$i]" eq "-n") { # backend instance name - $i++; $instance = $ARGV[$i]; } elsif ("$ARGV[$i]" eq "-Z") { # server instance name $i++; $servid = $ARGV[$i]; } elsif ("$ARGV[$i]" eq "-P") { # protocol preference @@ -94,12 +91,9 @@ if (!$isabs) { $dn = "dn: cn=$taskname, cn=restore, cn=tasks, cn=config\n"; $misc = "objectclass: top\nobjectclass: extensibleObject\n"; $cn = "cn: $taskname\n"; -if ($instance ne "") { - $nsinstance = "nsInstance: ${instance}\n"; -} $nsarchivedir = "nsArchiveDir: $archivedir\n"; $nsdbtype = "nsDatabaseType: $dbtype\n"; -$entry = "${dn}${misc}${cn}${nsinstance}${nsarchivedir}${nsdbtype}"; +$entry = "${dn}${misc}${cn}${nsarchivedir}${nsdbtype}"; $rc = DSUtil::ldapmod($entry, %info); diff --git a/man/man8/bak2db.8 b/man/man8/bak2db.8 index 74e5e58..49e034c 100644 --- a/man/man8/bak2db.8 +++ b/man/man8/bak2db.8 @@ -18,7 +18,7 @@ .SH NAME bak2db - Directory Server script for restoring a backup .SH SYNOPSIS -bak2db archivedir [\-Z serverID] [\-n backendname] [\-q] [\-v] [\-h] +bak2db archivedir [\-Z serverID] [\-q] [\-v] [\-h] .SH DESCRIPTION Restores the database from a archived backup. The Directory Server must be stopped prior to running this script. .SH OPTIONS @@ -31,9 +31,6 @@ The directory of the archived database. The server ID of the Directory Server instance. If there is only one instance on the system, this option can be skipped. .TP -.B \fB\-n\fR \fIBackend Name\fR -The name of the LDBM database to restore. Example: userRoot -.TP .B \fB\-q\fR .br Quiet mode. Reduces output of task. diff --git a/src/lib389/doc/source/task.rst b/src/lib389/doc/source/task.rst index 9adf96c..614b169 100644 --- a/src/lib389/doc/source/task.rst +++ b/src/lib389/doc/source/task.rst @@ -31,7 +31,7 @@ Usage example standalone.tasks.importLDIF(DEFAULT_SUFFIX, path_ro_ldif, args) standalone.tasks.exportLDIF(DEFAULT_SUFFIX, benamebase=None, output_file=path_to_ldif, args) standalone.tasks.db2bak(backup_dir, args) - standalone.tasks.bak2db(bename=None, backup_dir, args) + standalone.tasks.bak2db(backup_dir, args) standalone.tasks.reindex(suffix=None, benamebase=None, attrname=None, args) standalone.tasks.fixupMemberOf(suffix=None, benamebase=None, filt=None, args) standalone.tasks.fixupTombstones(bename=None, args) diff --git a/src/lib389/doc/source/utils.rst b/src/lib389/doc/source/utils.rst index 9e7865f..e0ee462 100644 --- a/src/lib389/doc/source/utils.rst +++ b/src/lib389/doc/source/utils.rst @@ -7,7 +7,7 @@ Usage example standalone.ldif2db(bename, suffixes, excludeSuffixes, encrypt, import_file) standalone.db2ldif(bename, suffixes, excludeSuffixes, encrypt, repl_data, outputfile) - standalone.bak2db(archive_dir,bename=None) + standalone.bak2db(archive_dir) standalone.db2bak(archive_dir) standalone.db2index(bename=None, suffixes=None, attrs=None, vlvTag=None) standalone.dbscan(bename=None, index=None, key=None, width=None, isRaw=False) diff --git a/src/lib389/lib389/__init__.py b/src/lib389/lib389/__init__.py index 151e68c..9c1089c 100644 --- a/src/lib389/lib389/__init__.py +++ b/src/lib389/lib389/__init__.py @@ -2867,7 +2867,7 @@ class DirSrv(SimpleLDAPObject, object): return True - def bak2db(self, archive_dir, bename=None): + def bak2db(self, archive_dir): """ @param archive_dir - The directory containing the backup @param bename - The backend name to restore diff --git a/src/lib389/lib389/tasks.py b/src/lib389/lib389/tasks.py index a068075..6726c74 100644 --- a/src/lib389/lib389/tasks.py +++ b/src/lib389/lib389/tasks.py @@ -522,7 +522,7 @@ class Tasks(object): return exitCode - def bak2db(self, bename=None, backup_dir=None, args=None): + def bak2db(self, backup_dir=None, args=None): ''' Restore a backup by creating a bak2db task @@ -543,12 +543,6 @@ class Tasks(object): if not os.path.exists(backup_dir): raise ValueError("Backup file (%s) does not exist" % backup_dir) - # If a backend name was provided then verify it - if bename: - ents = self.conn.mappingtree.list(bename=bename) - if len(ents) != 1: - raise ValueError("invalid backend name: %s" % bename) - # build the task entry cn = "restore_" + time.strftime("%m%d%Y_%H%M%S", time.localtime()) dn = "cn=%s,%s" % (cn, DN_RESTORE_TASK) @@ -559,8 +553,6 @@ class Tasks(object): 'nsArchiveDir': backup_dir, 'nsDatabaseType': 'ldbm database' }) - if bename: - entry.update({'nsInstance': bename}) # start the task and possibly wait for task completion try: