[Fedora-directory-commits] adminserver/admserv/cgi-src40 ds_unregister.in, NONE, 1.1

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Fri Aug 3 22:07:03 UTC 2007


Author: nhosoi

Update of /cvs/dirsec/adminserver/admserv/cgi-src40
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25248/admserv/cgi-src40

Added Files:
	ds_unregister.in 
Log Message:
Resolves: #214276
Summary: "rpm -e fedora-ds" uninstall doesn't remove server from configuration 
directory (comment #2-#4 with fix #6)



--- NEW FILE ds_unregister.in ---
#!@perlexec@
# 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.
# 
# Copyright (C) 2007 Red Hat, Inc.
# All rights reserved.
# END COPYRIGHT BLOCK
#

use lib qw(@perlpath@);

use strict;

use CGI qw(:cgi :oldstyle_urls);
use Inf;
use AdminUtil;
use Util;
use Resource;

my $res = new Resource("@propertydir@/ds_remove.res",
                       "@propertydir@/setup-ds-admin.res",
                       "@propertydir@/setup-ds.res");

# parse the input parameters
my $query = new CGI;

# call ds_newinst as a GET (GET or POST works, GET is simpler)
$ENV{REQUEST_METHOD} = "GET";
$ENV{QUERY_STRING} = $query->query_string();

my $instname = $query->param('InstanceName');
my ($slapd, $inst) = split(/-/, $instname, 2);
my $configdir = "@instconfigdir@/slapd-$inst";
if ( ! -d $configdir )
{
    print "Content-type: text/plain\n\n";
    print "NMC_ErrInfo: $configdir does not exist\n";
    print "NMC_Status: 1\n";
    print STDERR "Error: $configdir does not exist\n";
    exit 1;
}
my @errs;
my $inf = createInfFromConfig($configdir, $inst, \@errs);
if (@errs)
{
    print "Content-type: text/plain\n\n";
    print "NMC_ErrInfo: ", $res->getText(@errs), "\n";
    print "NMC_Status: 1\n";
    print STDERR "Error: ", $res->getText(@errs), "\n";
    exit 1;
}

# add the parmeters necessary to configure this DS to be managed
# by the console and to be registered with the config DS - these
# are usually passed in via the CGI params, or use reasonable
# default values
my $admConf = getAdmConf("@instconfigdir@/admin-serv");
$inf->{General}->{ConfigDirectoryLdapURL} = $query->param('ldap_url') ||
    $admConf->{ldapurl};
$inf->{General}->{AdminDomain} = $query->param('admin_domain') ||
    $admConf->{AdminDomain};

# Unregister the server from the configuration ds
# get config ds url from input or admconf
# get admin id from input or admconf
# must get admin password from input (PASSWORD_PIPE?)
# get admin domain
# config ds info
if (!unregisterDSWithConfigDS($inst, \@errs, $inf))
{
    print "Content-type: text/plain\n\n";
    print "NMC_ErrInfo: ", $res->getText(@errs), "\n";
    print "NMC_Status: 1\n";
    print STDERR "Error:", $res->getText(@errs), "\n";
    exit 1;
}

# if we got here, report success
print "Content-type: text/plain\n\n";
print "NMC_Status: 0\n";
exit 0;




More information about the Fedora-directory-commits mailing list