head	1.6;
access;
symbols
	TIGRIS_NOV_12_2000:1.5
	OLDHELM:1.5.0.2
	TIGRIS_NOV_11_2000:1.5
	TIGRIS_SEP_13_2000:1.4.0.2
	TIGRIS_BASELINE:1.4;
locks; strict;
comment	@# @;


1.6
date	2000.11.14.02.25.03;	author kmaples;	state dead;
branches;
next	1.5;

1.5
date	2000.09.27.20.38.14;	author kmaples;	state Exp;
branches;
next	1.4;

1.4
date	2000.05.17.00.55.57;	author manoj;	state Exp;
branches;
next	1.3;

1.3
date	2000.04.29.00.04.10;	author jrobbins;	state Exp;
branches;
next	1.2;

1.2
date	2000.03.24.21.45.35;	author jrobbins;	state Exp;
branches;
next	1.1;

1.1
date	2000.03.24.20.31.59;	author jrobbins;	state Exp;
branches;
next	;


desc
@@


1.6
log
@Changed the way that child scripts are called in order to return the number
or the (child) script which failed (if any).  Currently returns 0 or the
number of the first script in the sequence to fail.  Removed leftovers from
merge.
@
text
@#!/usr/bin/perl -w

# ================================================================
# Copyright (c) 2000 Collab.Net.  All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. The end-user documentation included with the redistribution, if
# any, must include the following acknowlegement: "This product includes
# software developed by Collab.Net (http://www.Collab.Net/)."
# Alternately, this acknowlegement may appear in the software itself, if
# and wherever such third-party acknowlegements normally appear.
#
# 4. The hosted project names must not be used to endorse or promote
# products derived from this software without prior written
# permission. For written permission, please contact info@@collab.net.
#
# 5. Products derived from this software may not use the "Tigris" name
# nor may "Tigris" appear in their names without prior written
# permission of Collab.Net.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ====================================================================
#
# This software consists of voluntary contributions made by many
# individuals on behalf of Collab.Net.
#


################################################################
# Name:              UserEdit
# Original Author:   jrobbins@@collab.net
# $Id: UserEdit,v 1.5 2000/09/27 20:38:14 kmaples Exp $
#
# The goal of this script is to do everything that is needed to update
# the named module in the given project.
#

# Minimum number of args this script requires for successful execution:
#my $minimum_arg_index = 8;

#---------------------------------------------------------------
# Approach to logging - each 'ControlScript' (like this one) should 
# maintain it's own log file that includes the actions it's children.

my $script_name;

# Alpha and Omega:
BEGIN {
        $ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin";
        my $scripts_dir = $ENV{'SANDBOX'} . '/helm/perl/scripts';

        require "$scripts_dir/ParentChildArgumentBridge.pl" 
                or die "Require failed: $!\n";

	# Open the logfile for logging at the beginning of execution.
	# The primary reason for this is to 'die' before doing anything
	# that we won't be able to log, and opening the log filehandle
	# in the beginning ensures this.
	
	# Grab just the filename portion of this script to use as a 
	# log identifier:
	$script_name = $0;
	$script_name =~ s/^.*\/([\w]+)$/$1/;

	# Autoflush buffer:
	$| = 1;

	# If this program is called by another program, we'll send STDOUT
	# and SDTERR to the logfile - this way the children's messages will
	# stick with the parent's logs.  Conversely, if this is called 
	# interactively (on the command line), we'll just let the output
	# go to the terminal instead of clogging up the logfiles with stuff
	# resulting from debugging attempts.
	
	unless(-t STDIN && -t STDOUT){
			
		# This needs to be established dynamically; I don't know the
		# preferred method for arriving at this value:
	 	my $logdir   = get_sandbox() . '/log/';	
		my $logfile  = 'HelmPerlScripts' . '.log';
		
		# Point STDOUT and STDERR to the logfile, or bail out:
		unless(open(STDOUT,">> $logdir" . "$logfile") && open(STDERR,">&STDOUT")){
			die "Can't open handle for logging: $!\n";
		}
		
		# This shouldn't really be necessary, but it couldn't hurt:
		select(STDERR); $| = 1;	
		select(STDOUT); $| = 1;	

		# This might appear odd, but since STDOUT is now a filehandle
		# for the logfile, try to get a lock on it, or bail out:
		unless(flock(STDOUT, 2|4)){ # Ask nice first.
			sleep 1;
			unless(flock(STDOUT, 2)){
				die "Unable to lock logfile: $!\n";
			}
		}
	}
	# This is all in order to print a nice header for the log
	# entry:

	my $time   = time();
	my $date   = localtime($time);
	my $header = "[$date]\n[$$] START: $script_name\n";
	
	print $header;
}
END {
	# Note that because END blocks are executed from bottom to top,
	# this block should appear BEFORE any other END blocks trying 
	# to print to the same filehandle.  This might seem unnecessary,
	# but since we did point these at a file, we really ought to 
	# clean up after ourselves:

	my $footer = "[$$] END: $script_name\n\n";
	
	print $footer;

	close(STDOUT) or die "Couldn't close logging handle STDOUT: $!\n";
	close(STDERR) or die "Couldn't close logging handle STDERR: $!\n";
}
#---------------------------------------------------------------
# An early-warning system: nip this in the bud if it's not going 
# to be able to execute anyway:
#unless($#ARGV >= $minimum_arg_index){
#	die "Execution failed due to insufficient arguments.\n";
#}

#---------------------------------------------------------------
# MAIN
#---------------------------------------------------------------
# NOTE:  According to Ed K., servlets are now dealing with functions
# relating to qmail/ezmlm/mhonarc - this leaves CVS and apache as
# the two components to be manipulated here.

my $ret = ''; # placeholder for current return value.  Unused.

# QMAIL:    call defunct
# EZMLM:    call defunct
# CVS:      nothing
# Mhonarc:  call defunct
# Apache:   nothing
# Bugzilla: ???

#---------------------------------------------------------------
# END MAIN
#---------------------------------------------------------------

__END__


@


1.5
log
@Modified scripts to follow existing framework; essentially this passes for
an initial checkin of these scripts.
@
text
@d53 1
a53 1
# $Id: $
@


1.4
log
@Eliminate DNS and bugzilla administration code from the perl scripts.
@
text
@d5 1
a5 1
# 
d9 1
a9 1
# 
d12 1
a12 1
# 
d16 1
a16 1
# 
d22 1
a22 1
# 
d26 1
a26 1
# 
d30 1
a30 1
# 
d44 1
a44 1
# 
a49 1

d51 3
a53 2
# $Id: UserEdit,v 1.3 2000/04/29 00:04:10 jrobbins Exp $
# Original Author: jrobbins@@collab.net
d55 2
a56 2
# The goal of this script is to do everything that is needed to edit a
# user on a host running tigris.
a57 33
# Arguments:
# $ARGV[1] = user_login_id
# $ARGV[2] = domain_name (including TLD)
# $ARGV[3] = brand_name
# $ARGV[4] = user real name
# $ARGV[5] = user email address
# $ARGV[6] = password (plain text)
 


# Process arguments
my $sandbox      = $ARGV[0];
my $user_login_id       = $ARGV[1];
my $domain_name         = $ARGV[2];
my $brand_name          = $ARGV[3];
my $user_real_name      = $ARGV[4];
my $user_email_address  = $ARGV[5];
my $password            = $ARGV[6];

my $cmd = "unix command line";

# Main code body

# QMAIL
$cmd = "./qmail-user-edit $sandbox $user_login_id $domain_name $brand_name $user_email_address";
print "UserEdit: $cmd\n";
system($cmd) == 0 or die "Command failed: $!\n";



# EZMLM
# do nothing
# future: module specific mailing lists?
d59 2
d62 108
a169 2
# CVS
# do nothing
d171 1
a172 2
# Monarc
# do nothing
a173 2
# Apache
# do nothing
@


1.3
log
@initial checkin
@
text
@d52 1
a52 1
# $Id: UserEdit,v 1.2 2000/03/24 21:45:35 jrobbins Exp $
a80 3
# DNS
# do nothing

a99 8

# Bugzilla
# add a bugzilla profile
$cmd = "./bugzilla-user-edit $sandbox $user_login_id $domain_name $brand_name $user_email_address $password"; 
print "UserEdit: $cmd\n";
system($cmd) == 0 or die "Command failed: $!\n";

  
@


1.2
log
@removed control-Ms and started using /home/jrobbins
@
text
@d52 1
a52 1
# $Id: UserEdit,v 1.1 2000/03/24 20:31:59 jrobbins Exp $
a67 12
# CONFIG - set to /path/to/helm/perl
use lib "$ENV{'SANDBOX'}/helm/perl";

# include needed libraries
use Helm::dns;
use Helm::qmail;
use Helm::ezmlm;
use Helm::cvs;
use Helm::mhonarc;
use Helm::bugzilla;
use Helm::apache;

d69 7
a75 7
my $user_login_id       = $ARGV[0];
my $domain_name         = $ARGV[1];
my $brand_name          = $ARGV[2];
my $user_real_name      = $ARGV[3];
my $user_email_address  = $ARGV[4];
my $password            = $ARGV[5];

d77 1
d85 4
a88 2
Helm::qmail->userEdit($user_login_id, $domain_name,
		      $brand_name, $user_email_address);
d106 3
a108 4
Helm::bugzilla->userEdit($user_login_id, $domain_name,
			 $brand_name, $user_email_address,
			 $password); 

@


1.1
log
@initial checkin of new event-driven scripts for tigris
@
text
@d1 122
a122 122
#!/usr/bin/perl -w

# ================================================================
# Copyright (c) 2000 Collab.Net.  All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 
# 3. The end-user documentation included with the redistribution, if
# any, must include the following acknowlegement: "This product includes
# software developed by Collab.Net (http://www.Collab.Net/)."
# Alternately, this acknowlegement may appear in the software itself, if
# and wherever such third-party acknowlegements normally appear.
# 
# 4. The hosted project names must not be used to endorse or promote
# products derived from this software without prior written
# permission. For written permission, please contact info@@collab.net.
# 
# 5. Products derived from this software may not use the "Tigris" name
# nor may "Tigris" appear in their names without prior written
# permission of Collab.Net.
# 
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ====================================================================
# 
# This software consists of voluntary contributions made by many
# individuals on behalf of Collab.Net.
#



################################################################
# $Id$
# Original Author: jrobbins@@collab.net
#
# The goal of this script is to do everything that is needed to edit a
# user on a host running tigris.
#
# Arguments:
# $ARGV[1] = user_login_id
# $ARGV[2] = domain_name (including TLD)
# $ARGV[3] = brand_name
# $ARGV[4] = user real name
# $ARGV[5] = user email address
# $ARGV[6] = password (plain text)
 


# CONFIG - set to /path/to/helm/perl
use lib "/home/httpd/helm/perl";

# include needed libraries
use Helm::dns;
use Helm::qmail;
use Helm::ezmlm;
use Helm::cvs;
use Helm::mhonarc;
use Helm::bugzilla;
use Helm::apache;

# Process arguments
my $user_login_id       = $ARGV[0];
my $domain_name         = $ARGV[1];
my $brand_name          = $ARGV[2];
my $user_real_name      = $ARGV[3];
my $user_email_address  = $ARGV[4];
my $password            = $ARGV[5];



# Main code body

# DNS
# do nothing

# QMAIL
Helm::qmail->userEdit($user_login_id, $domain_name,
		      $brand_name, $user_email_address);


# EZMLM
# do nothing
# future: module specific mailing lists?


# CVS
# do nothing


# Monarc
# do nothing


# Bugzilla
# add a bugzilla profile
Helm::bugzilla->userEdit($user_login_id, $domain_name,
			 $brand_name, $user_email_address,
			 $password); 


  
# Apache
# do nothing
@

