Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 158237 Details for
Bug 245815
DS Admin Migration framework
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
new Migration.pm.in
Migration.pm.in (text/plain), 11.47 KB, created by
Rich Megginson
on 2007-06-29 18:24:37 UTC
(
hide
)
Description:
new Migration.pm.in
Filename:
MIME Type:
Creator:
Rich Megginson
Created:
2007-06-29 18:24:37 UTC
Size:
11.47 KB
patch
obsolete
># BEGIN COPYRIGHT BLOCK ># This Program is free software; you can redistribute it and/or modify it under ># the terms of the GNU General Public License as published by the Free Software ># Foundation; version 2 of the License. ># ># This Program is distributed in the hope that it will be useful, but WITHOUT ># ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ># FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ># ># You should have received a copy of the GNU General Public License along with ># this Program; if not, write to the Free Software Foundation, Inc., 59 Temple ># Place, Suite 330, Boston, MA 02111-1307 USA. ># ># In addition, as a special exception, Red Hat, Inc. gives You the additional ># right to link the code of this Program with code not covered under the GNU ># General Public License ("Non-GPL Code") and to distribute linked combinations ># including the two, subject to the limitations in this paragraph. Non-GPL Code ># permitted under this exception must only link to the code of this Program ># through those well defined interfaces identified in the file named EXCEPTION ># found in the source code files (the "Approved Interfaces"). The files of ># Non-GPL Code may instantiate templates or use macros or inline functions from ># the Approved Interfaces without causing the resulting work to be covered by ># the GNU General Public License. Only Red Hat, Inc. may make changes or ># additions to the list of Approved Interfaces. You must obey the GNU General ># Public License in all respects for all of the Program code and other code used ># in conjunction with the Program except the Non-GPL Code covered by this ># exception. If you modify this file, you may extend this exception to your ># version of the file, but you are not obligated to do so. If you do not wish to ># provide this exception without modification, you must delete this exception ># statement from your version and license this file solely under the GPL without ># exception. ># ># ># Copyright (C) 2007 Red Hat, Inc. ># All rights reserved. ># END COPYRIGHT BLOCK ># > >########################### ># ># This perl module provides a way to set up a new installation after ># the binaries have already been extracted. This is typically after ># using native packaging support to install the package e.g. RPM, ># pkgadd, depot, etc. This script will show the license, readme, ># dsktune, then run the usual setup pre and post installers. ># >########################## > >package Migration; >use Setup; > >use Exporter (); >@ISA = qw(Exporter Setup); >@EXPORT = qw(); >@EXPORT_OK = qw(); > ># tempfiles >use File::Temp qw(tempfile tempdir); > ># hostname >use Net::Domain qw(hostfqdn); > ># load perldap >use Mozilla::LDAP::Conn; >use Mozilla::LDAP::Utils qw(normalizeDN); >use Mozilla::LDAP::API qw(ldap_explode_dn); >use Mozilla::LDAP::LDIF; > >use Getopt::Long; > >use File::Temp qw(tempfile tempdir); > >use SetupLog; >use Util; > ># process command line options >Getopt::Long::Configure(qw(bundling)); # bundling allows -ddddd > >sub VersionMessage { > print "@capbrand@ Directory Server Migration Program Version @PACKAGE_VERSION@\n"; >} > >sub HelpMessage { > print <<EOF; > >INTRODUCTION > >This script will copy instances (data and configuration) from the old >server root directory to their new FHS locations. This script does a >copy only - the data in the old instances will be left untouched. The >old instances must be shutdown first to ensure that the databases are >copied safely. The new instances will not be started by migration, >but can be started after running migration. > >USAGE > > $0 [--options] -- [args] > >options: > --help This message > --version Print the version and exit > --debug Turn on debugging > --oldsroot The old server root directory to migrate from > --actualsroot This is the old location of the old server root. See below. > --silent Use silent setup - no user input > --file=name Use the file 'name' in .inf format to supply the default answers > --keepcache Do not delete the temporary .inf file generated by this program > --logfile Log migration messages to this file - otherwise, a temp file will be used > --instance By default, all directory server instances will be migrated. You can use > this argument to specify one or more (e.g. -i slapd-foo -i slapd-bar) if > you do not want to migrate all of them. >For all options, you can also use the short name e.g. -h, -d, etc. For the -d argument, >specifying it more than once will increase the debug level e.g. -ddddd > >args: >You can supply default .inf data in this format: > section.param=value >e.g. > General.FullMachineName=foo.example.com >or > "slapd.Suffix=dc=example, dc=com" >Values passed in this manner will override values in an .inf file given with the -f argument. > >actualsroot: >This is used when you must migrate from one machine to another. The >usual case is that you have mounted the old server root on a different >root directory, either via a network mount, or by copying a tarball >made using a relative directory on the source machine to the >destination machine and untarring it. > >For example: machineA is a 32bit machine, and you want to migrate your >servers to a new 64bit machine. Lets assume your old server root on >machineA was /opt/myds, and your new machine also wants to use a >server root of /opt/myds. There are a couple of different ways to >proceed. Either make a tarball of opt/myds from machineA using a >relative path (i.e. NOT /opt/myds) or use NFS to mount >machineA:/opt/myds on a different mount point >(e.g. machineB:/migration/opt/myds). > >If you do this, you should give the old "real" server root (/opt/myds) >as the --actualsroot argument, and use /migration/opt/myds for the >--oldsroot argument. That is, the oldsroot is the physical location of >the files on disk. The actualsroot is the old value of the server root >on the source machine. >EOF >} > >sub init { > my $self = shift; > $self->{res} = shift; > my ($silent, $inffile, $keep, $preonly, $logfile, $oldsroot, $actualsroot); > my @instances; > > GetOptions('help|h|?' => sub { VersionMessage(); HelpMessage(); exit 0 }, > 'version|v' => sub { VersionMessage(); exit 0 }, > 'debug|d+' => \$Util::debuglevel, > 'silent|s' => \$silent, > 'file|f=s' => \$inffile, > 'keepcache|k' => \$keep, > 'preonly|p' => \$preonly, > 'logfile|l=s' => \$logfile, > 'oldsroot|o=s' => \$oldsroot, > 'actualsroot|a=s' => \$actualsroot, > 'instance|i=s' => \@instances > ); > > my $pkgname = "@package_name@"; > # this is the new pkgname which may be something like > # fedora-ds-base - we have to strip off the -suffix > if ($pkgname =~ /-(core|base)$/) { > $pkgname =~ s/-(core|base)$//; > } > my $oldpkgname = $pkgname; > > $self->{pkgname} = $pkgname; > $self->{oldsroot} = $oldsroot || "/opt/$oldpkgname"; > $self->{actualsroot} = $actualsroot || $oldsroot; > $self->{silent} = $silent; > $self->{inffile} = $inffile; > $self->{keep} = $keep; > $self->{preonly} = $preonly; > $self->{logfile} = $logfile; > $self->{log} = new SetupLog($self->{logfile}, "migrate"); > # if user supplied inf file, use that to initialize > if (defined($self->{inffile})) { > $self->{inf} = new Inf($self->{inffile}); > } else { > $self->{inf} = new Inf; > } > my $fh; > # create a temp inf file for writing for other processes > # never overwrite the user supplied inf file > ($fh, $self->{inffile}) = tempfile("migrateXXXXXX", UNLINK => !$keep, > SUFFIX => ".inf", OPEN => 0, > DIR => File::Spec->tmpdir); > $self->{inf}->{filename} = $self->{inffile}; > > # see if user passed in default inf values - also, command line > # arguments override those passed in via an inf file - this > # allows the reuse of .inf files with some parameters overridden > for (@ARGV) { > if (/^([\w_-]+)\.([\w_-]+)=(.*)$/) { # e.g. section.param=value > $self->{inf}->{$1}->{$2} = $3; > } else { # error > print STDERR "Error: unknown command line option $_\n"; > usage(); > exit 1; > } > } > > # this is the base config directory - the directory containing > # the slapd-instance instance specific config directories > $self->{configdir} = $ENV{DS_CONFIG_DIR} || "@instconfigdir@"; > > # get list of instances to migrate > if (! @instances) { > # an instance must be a directory called $oldsroot/slapd-something and the file > # $oldsroot/slapd-something/config/dse.ldif must exist > @instances = grep { -d && -f "$_/config/dse.ldif" && ($_ =~ s,$self->{oldsroot}/,,) } > glob("$self->{oldsroot}/slapd-*"); > } > > die "No instances found to migrate" unless (@instances); > > $self->{instances} = \@instances; >} > >sub doExit { > my $self = shift; > $self->msg($FATAL, 'migration_exiting', $self->{log}->{filename}); > exit 1; >} > >sub migrateSecurityFiles { > my $self = shift; > my $inst = shift; > my $destdir = shift; > my $oldroot = $self->{oldsroot}; > > if (! -d "$oldroot/alias") { > $self->msg('old_secdir_error', "$oldroot/alias", $!); > return 0; > } elsif (! -d $destdir) { > $self->msg('new_secdir_error', $destdir, $!); > return 0; > } else { > $self->log($INFO, "Copying $oldroot/alias/$inst-cert8.db to $destdir/cert8.db\n"); > if (system ("cp -p $oldroot/alias/$inst-cert8.db $destdir/cert8.db")) { > $self->msg($FATAL, 'error_copying_certdb', "$oldroot/alias/$inst-cert8.db", > "$destdir/cert8.db", $!); > return 0; > } > $self->log($INFO, "Copying $oldroot/alias/$inst-key3.db to $destdir/key3.db\n"); > if (system ("cp -p $oldroot/alias/$inst-key3.db $destdir/key3.db")) { > $self->msg($FATAL, 'error_copying_keydb', "$oldroot/alias/$inst-key3.db", > "$destdir/key3.db", $!); > return 0; > } > $self->log($INFO, "Copying $oldroot/alias/secmod.db to $destdir/secmod.db\n"); > if (system ("cp -p $oldroot/alias/secmod.db $destdir/secmod.db")) { > $self->msg($FATAL, 'error_copying_secmoddb', "$oldroot/alias/secmod.db", > "$destdir/secmod.db", $!); > return 0; > } > if (-f "$oldroot/alias/$inst-pin.txt") { > $self->log($INFO, "Copying $oldroot/alias/$inst-pin.txt to $destdir/pin.txt\n"); > if (system ("cp -p $oldroot/alias/$inst-pin.txt $destdir/pin.txt")) { > $self->msg($FATAL, 'error_copying_pinfile', "$oldroot/alias/$inst-pin.txt", > "$destdir/pin.txt", $!); > return 0; > } > } else { > $self->log($INFO, "No $oldroot/alias/$inst-pin.txt to migrate\n"); > } > > if (-f "$oldroot/shared/config/certmap.conf") { > $self->log($INFO, "Copying $oldroot/shared/config/certmap.conf to $destdir/certmap.conf\n"); > if (system ("cp -p $oldroot/shared/config/certmap.conf $destdir/certmap.conf")) { > $self->msg($FATAL, 'error_copying_certmap', "$oldroot/shared/config/certmap.conf", > "$destdir/certmap.conf", $!); > return 0; > } > } else { > $self->log($INFO, "No $oldroot/shared/config/certmap.conf to migrate\n"); > } > } > > return 1; >} > >############################################################################# ># Mandatory TRUE return value. ># >1;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 245815
:
158147
|
158227
|
158228
|
158229
|
158230
|
158231
|
158235
|
158236
| 158237 |
158238
|
158239
|
158241
|
158266
|
158269
|
158883
|
158885
|
159053
|
159352