From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 12 Feb 2007 20:17:12 -0000 Subject: [Cluster-devel] cluster/fence/agents baytech/fence_baytech.pl ... Message-ID: <20070212201712.22028.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Changes by: rmccabe at sourceware.org 2007-02-12 20:17:08 Modified files: fence/agents/baytech: fence_baytech.pl fence/agents/bladecenter: fence_bladecenter.pl fence/agents/brocade: fence_brocade.pl fence/agents/bullpap: fence_bullpap.pl fence/agents/cpint: fence_cpint.pl fence/agents/drac: fence_drac.pl fence/agents/egenera: fence_egenera.pl fence/agents/ibmblade: fence_ibmblade.pl fence/agents/ilo: fence_ilo.pl fence/agents/mcdata: fence_mcdata.pl fence/agents/sanbox2: fence_sanbox2.pl fence/agents/vixel: fence_vixel.pl fence/agents/vmware: fence_vmware.pl fence/agents/wti: fence_wti.pl fence/agents/xcat: fence_xcat.pl fence/agents/xen: fence_xen.pl fence/agents/zvm: fence_zvm.pl Log message: Update the perl fence agents to take the additional command line option -S or stdin param passwd_script= Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/baytech/fence_baytech.pl.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/bladecenter/fence_bladecenter.pl.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/brocade/fence_brocade.pl.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/bullpap/fence_bullpap.pl.diff?cvsroot=cluster&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/cpint/fence_cpint.pl.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/drac/fence_drac.pl.diff?cvsroot=cluster&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/egenera/fence_egenera.pl.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ibmblade/fence_ibmblade.pl.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/ilo/fence_ilo.pl.diff?cvsroot=cluster&r1=1.5&r2=1.6 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/mcdata/fence_mcdata.pl.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/sanbox2/fence_sanbox2.pl.diff?cvsroot=cluster&r1=1.3&r2=1.4 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/vixel/fence_vixel.pl.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/vmware/fence_vmware.pl.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/wti/fence_wti.pl.diff?cvsroot=cluster&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xcat/fence_xcat.pl.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xen/fence_xen.pl.diff?cvsroot=cluster&r1=1.2&r2=1.3 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/zvm/fence_zvm.pl.diff?cvsroot=cluster&r1=1.1&r2=1.2 --- cluster/fence/agents/baytech/fence_baytech.pl 2006/08/16 19:13:26 1.2 +++ cluster/fence/agents/baytech/fence_baytech.pl 2007/02/12 20:17:05 1.3 @@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions @@ -32,7 +32,7 @@ #BEGIN_VERSION_GENERATION $FENCE_RELEASE_NAME=""; -$SISTINA_COPYRIGHT=""; +$REDHAT_COPYRIGHT=""; $BUILD_DATE=""; #END_VERSION_GENERATION @@ -70,6 +70,7 @@ print " -o string action: On,Off,Status or Reboot (default)\n"; print " -n string outlet name\n"; print " -p string password\n"; + print " -S path script to run to retrieve password\n"; print " -V version\n"; exit 0; @@ -94,7 +95,7 @@ sub version { print "$pname $FENCE_RELEASE_NAME $BUILD_DATE\n"; - print "$SISTINA_COPYRIGHT\n" if ( $SISTINA_COPYRIGHT ); + print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT ); exit 0; } @@ -104,7 +105,7 @@ { $action = "Reboot"; if (@ARGV > 0) { - getopts("n:l:p:o:a:VhD") || fail_usage ; + getopts("n:l:p:S:o:a:VhD") || fail_usage ; usage if defined $opt_h; version if defined $opt_V; @@ -130,6 +131,13 @@ $quiet=$opt_q if defined $opt_q; $user=$opt_l if defined $opt_l; $passwd=$opt_p if defined $opt_p; + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $passwd=$pwd_script_out; + } + } if(defined $passwd && !defined $user) { @@ -184,6 +192,10 @@ $opt_p = $val; } + elsif ($name eq "passwd_script") { + $opt_S = $val; + } + elsif ($name eq "action" ) { $opt_o = $val; --- cluster/fence/agents/bladecenter/fence_bladecenter.pl 2006/08/15 18:34:20 1.2 +++ cluster/fence/agents/bladecenter/fence_bladecenter.pl 2007/02/12 20:17:05 1.3 @@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions @@ -35,7 +35,7 @@ #BEGIN_VERSION_GENERATION $FENCE_RELEASE_NAME=""; -$SISTINA_COPYRIGHT=""; +$REDHAT_COPYRIGHT=""; $BUILD_DATE=""; #END_VERSION_GENERATION @@ -53,6 +53,7 @@ print " -n blade number to operate on\n"; print " -o Action: on, off, reboot (default) or status\n"; print " -p Password for login\n"; + print " -S Script to run to retrieve password\n"; print " -q quiet mode\n"; print " -V version\n"; @@ -78,7 +79,7 @@ sub version { print "$pname $FENCE_RELEASE_NAME $BUILD_DATE\n"; - print "$SISTINA_COPYRIGHT\n" if ( $SISTINA_COPYRIGHT ); + print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT ); exit 0; } @@ -129,7 +130,10 @@ elsif ($name eq "passwd" ) { $passwd = $val; - } + } + elsif ($name eq "passwd_script" ) { + $passwd_script = $val; + } elsif ($name eq "blade" ) { $bladenum = $val; @@ -199,7 +203,7 @@ if (@ARGV > 0) { - getopts("a:hl:n:o:p:qv:V") || fail_usage ; + getopts("a:hl:n:o:p:S:qv:V") || fail_usage ; usage if defined $opt_h; version if defined $opt_V; @@ -212,12 +216,20 @@ $verbose = $opt_v if defined $opt_v; $quiet = $opt_q if defined $opt_q; + if (defined $opt_S) { + $pwd_script_output = `$opt_S`; + chomp($pwd_script_output); + if ($pwd_script_output) { + $passwd = $pwd_script_output; + } + } + fail_usage "Unknown parameter." if (@ARGV > 0); fail_usage "No '-a' flag specified." unless defined $host; fail_usage "No '-n' flag specified." unless defined $bladenum; fail_usage "No '-l' flag specified." unless defined $login; - fail_usage "No '-p' flag specified." unless defined $passwd; + fail_usage "No '-p' or '-S' flag specified." unless defined $passwd; fail_usage "Unrecognised action '$action' for '-o' flag" unless $action =~ /^(on|off|reboot|status)$/i; } @@ -228,9 +240,17 @@ fail "failed: no IP address" unless defined $host; fail "failed: no blade number" unless defined $bladenum; fail "failed: no login name" unless defined $login; - fail "failed: no password" unless defined $passwd; fail "failed: unrecognised action: $action" unless $action =~ /^(on|off|reboot|status)$/i; + + if (defined $passwd_script) { + $pwd_script_output = `$passwd_script`; + chomp($pwd_script_output); + if ($pwd_script_output) { + $passwd = $pwd_script_output; + } + } + fail "failed: no password" unless defined $passwd; } # convert $action to lower case --- cluster/fence/agents/brocade/fence_brocade.pl 2006/08/16 19:02:23 1.3 +++ cluster/fence/agents/brocade/fence_brocade.pl 2007/02/12 20:17:06 1.4 @@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions @@ -46,6 +46,7 @@ print " -n Port number to operate on\n"; print " -o Action: disable (default) or enable\n"; print " -p Password for login\n"; + print " -S Script to run to retrieve password\n"; print " -q quiet mode\n"; print " -V version\n"; @@ -78,17 +79,25 @@ if (@ARGV > 0) { - getopts("a:hl:n:o:p:qV") || fail_usage ; + getopts("a:hl:n:o:p:S:qV") || fail_usage ; usage if defined $opt_h; version if defined $opt_V; fail_usage "Unknown parameter." if (@ARGV > 0); + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail_usage "No '-a' flag specified." unless defined $opt_a; fail_usage "No '-n' flag specified." unless defined $opt_n; fail_usage "No '-l' flag specified." unless defined $opt_l; - fail_usage "No '-p' flag specified." unless defined $opt_p; + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; fail_usage "Unrecognised action '$opt_o' for '-o' flag" unless $opt_o =~ /^(disable|enable)$/i; @@ -98,6 +107,15 @@ fail "failed: no IP address" unless defined $opt_a; fail "failed: no plug number" unless defined $opt_n; fail "failed: no login name" unless defined $opt_l; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "failed: no password" unless defined $opt_p; fail "failed: unrecognised action: $opt_o" unless $opt_o =~ /^(disable|enable)$/i; @@ -226,6 +244,9 @@ { $opt_p = $val; } + elsif ($name eq "passwd_script") { + $opt_S = $val; + } elsif ($name eq "port" ) { $opt_n = $val; --- cluster/fence/agents/bullpap/fence_bullpap.pl 2006/04/25 13:00:05 1.6 +++ cluster/fence/agents/bullpap/fence_bullpap.pl 2007/02/12 20:17:06 1.7 @@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions @@ -31,7 +31,7 @@ #BEGIN_VERSION_GENERATION $FENCE_RELEASE_NAME=""; -$SISTINA_COPYRIGHT=""; +$REDHAT_COPYRIGHT=""; $BUILD_DATE=""; #END_VERSION_GENERATION @@ -49,17 +49,19 @@ print " -d Domain to operate on\n"; print " -o Action: on, off, reboot (default) or status\n"; print " -p Password for login\n"; + print " -S Script to run to retrieve password\n"; print " -q quiet mode\n"; print " -V version\n"; print "\n"; print "When run with no arguments, $pname takes arguments from "; print "standard\ninput, one line per option. They are as follows:\n"; print "\n"; - print " ipaddr= Same as -a command line option\n"; - print " login= Same as -l command line option\n"; - print " domain= Same as -d command line option\n"; - print " option= Same as -o command line option\n"; - print " passwd= Same as -p command line option\n\n"; + print " ipaddr= Same as -a command line option\n"; + print " login= Same as -l command line option\n"; + print " domain= Same as -d command line option\n"; + print " option= Same as -o command line option\n"; + print " passwd= Same as -p command line option\n"; + print " passwd_script= Same as -S command line option\n\n"; exit 0; } @@ -82,7 +84,7 @@ sub version { print "$pname $FENCE_RELEASE_NAME $BUILD_DATE\n"; - print "$SISTINA_COPYRIGHT\n" if ( $SISTINA_COPYRIGHT ); + print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT ); exit 0; } @@ -138,6 +140,9 @@ { $passwd = $val; } + elsif ($name eq "passwd_script" ) { + $passwd_script = $val; + } elsif ($name eq "domain" ) { $domain = $val; @@ -221,7 +226,7 @@ if (@ARGV > 0) { - getopts("a:hl:d:o:p:qv:V") || fail_usage ; + getopts("a:hl:d:o:p:S:qv:V") || fail_usage ; usage if defined $opt_h; version if defined $opt_V; @@ -234,12 +239,20 @@ $verbose = $opt_v if defined $opt_v; $quiet = $opt_q if defined $opt_q; + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $passwd = $pwd_script_out; + } + } + fail_usage "Unknown parameter." if (@ARGV > 0); fail_usage "No '-a' flag specified." unless defined $host; fail_usage "No '-d' flag specified." unless defined $domain; fail_usage "No '-l' flag specified." unless defined $login; - fail_usage "No '-p' flag specified." unless defined $passwd; + fail_usage "No '-p' or '-S' flag specified." unless defined $passwd; fail_usage "Unrecognised action '$action' for '-o' flag" unless $action =~ /^(on|off|reboot|status)$/i; } @@ -250,9 +263,17 @@ fail "failed: no IP address" unless defined $host; fail "failed: no domain" unless defined $domain; fail "failed: no login name" unless defined $login; - fail "failed: no password" unless defined $passwd; fail "failed: unrecognized action: $action" unless $action =~ /^(on|off|reboot|status)$/i; + + if (defined $passwd_script) { + $pwd_script_out = `$passwd_script`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $passwd = $pwd_script_out; + } + } + fail "failed: no password" unless defined $passwd; } # convert $action to lower case --- cluster/fence/agents/cpint/fence_cpint.pl 2004/06/24 08:53:13 1.1 +++ cluster/fence/agents/cpint/fence_cpint.pl 2007/02/12 20:17:06 1.2 @@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions --- cluster/fence/agents/drac/fence_drac.pl 2006/11/27 16:45:38 1.9 +++ cluster/fence/agents/drac/fence_drac.pl 2007/02/12 20:17:06 1.10 @@ -3,7 +3,7 @@ ############################################################################### ############################################################################### ## -## Copyright (C) 2006 Red Hat, Inc. All rights reserved. +## Copyright (C) 2006-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions @@ -79,15 +79,17 @@ print " -m DRAC/MC module name\n"; print " -o Action: reboot (default), off or on\n"; print " -p Login password\n"; + print " -S Script to run to retrieve password\n"; print " -q quiet mode\n"; print " -V version\n"; print "\n"; print "CCS Options:\n"; - print " action = \"string\" Action: reboot (default), off or on\n"; - print " debug = \"debugfile\" debugging output file\n"; + print " action = \"string\" Action: reboot (default), off or on\n"; + print " debug = \"debugfile\" debugging output file\n"; print " ipaddr = \"ip\" IP address or hostname of DRAC\n"; print " login = \"name\" Login name\n"; - print " passwd = \"string\" Login password\n"; + print " passwd = \"string\" Login password\n"; + print " passwd_script = \"path\" Script to run to retrieve password\n"; exit 0; } @@ -125,7 +127,7 @@ sub version { print "$pname $FENCE_RELEASE_NAME $BUILD_DATE\n"; - print "$SISTINA_COPYRIGHT\n" if ( $SISTINA_COPYRIGHT ); + print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT ); exit 0; } @@ -540,7 +542,11 @@ elsif ($name eq "passwd" ) { $passwd = $val; - } + } + elsif ($name eq "passwd_script" ) + { + $passwd_script = $val; + } elsif ($name eq "debug" ) { $debug = $val; @@ -572,7 +578,7 @@ # Check parameters # if (@ARGV > 0) { - getopts("a:c:d:D:hl:m:o:p:qVv") || fail_usage ; + getopts("a:c:d:D:hl:m:o:p:S:qVv") || fail_usage ; usage if defined $opt_h; version if defined $opt_V; @@ -590,7 +596,15 @@ $modulename = $opt_m if defined $opt_m; - fail_usage "No '-p' flag specified." unless defined $opt_p; + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; $passwd = $opt_p; $verbose = $opt_v if defined $opt_v; @@ -610,9 +624,18 @@ fail "failed: no IP address" unless defined $address; fail "failed: no login name" unless defined $login; + + if (defined $passwd_script) { + $pwd_script_out = `$passwd_script`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $passwd = $pwd_script_out; + } + } + fail "failed: no password" unless defined $passwd; fail "failed: unrecognised action: $action" - unless $action =~ /^(Off|On|Reboot|status)$/i; + unless $action =~ /^(Off|On|Reboot|status)$/i; } --- cluster/fence/agents/egenera/fence_egenera.pl 2006/08/16 19:14:50 1.2 +++ cluster/fence/agents/egenera/fence_egenera.pl 2007/02/12 20:17:06 1.3 @@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions --- cluster/fence/agents/ibmblade/fence_ibmblade.pl 2004/09/10 15:44:32 1.2 +++ cluster/fence/agents/ibmblade/fence_ibmblade.pl 2007/02/12 20:17:06 1.3 @@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions --- cluster/fence/agents/ilo/fence_ilo.pl 2006/08/16 19:11:49 1.5 +++ cluster/fence/agents/ilo/fence_ilo.pl 2007/02/12 20:17:06 1.6 @@ -1,4 +1,17 @@ #!/usr/bin/perl + +############################################################################### +############################################################################### +## +## Copyright (C) 2006-2007 Red Hat, Inc. All rights reserved. +## +## This copyrighted material is made available to anyone wishing to use, +## modify, copy, or redistribute it subject to the terms and conditions +## of the GNU General Public License v.2. +## +############################################################################### +############################################################################### + $|=1; eval { $ssl_mod="Net::SSL" if require Net::SSL} || @@ -14,6 +27,9 @@ # "#END_VERSION_GENERATION" It is generated by the Makefile #BEGIN_VERSION_GENERATION +$FENCE_RELEASE_NAME=""; +$REDHAT_COPYRIGHT=""; +$BUILD_DATE=""; #END_VERSION_GENERATION # Get the program name from $0 and strip directory names @@ -35,6 +51,7 @@ print " -l Login name\n"; print " -o Action: reboot (default), off, on or status\n"; print " -p Login password\n"; + print " -S Script to run to retrieve login password\n"; print " -q quiet mode\n"; print " -V version\n"; print " -v verbose\n"; @@ -62,7 +79,7 @@ sub version { print "$pname $FENCE_RELEASE_NAME $BUILD_DATE\n"; - print "$SISTINA_COPYRIGHT\n" if ( $SISTINA_COPYRIGHT ); + print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT ); exit 0; } @@ -452,6 +469,10 @@ { $passwd = $val; } + elsif ($name eq "passwd_script" ) + { + $passwd_script = $val; + } elsif ($name eq "ribcl" ) { $ribcl_vers = $val; @@ -471,7 +492,7 @@ $ribcl_vers = undef; # undef = autodetect if (@ARGV > 0) { - getopts("a:hl:n:o:p:r:qvV") || fail_usage ; + getopts("a:hl:n:o:p:S:r:qvV") || fail_usage ; usage if defined $opt_h; version if defined $opt_V; @@ -484,7 +505,15 @@ fail_usage "No '-l' flag specified." unless defined $opt_l; $username = $opt_l; - fail_usage "No '-p' flag specified." unless defined $opt_p; + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; $passwd = $opt_p; $action = $opt_o if defined $opt_o; @@ -504,6 +533,15 @@ fail "no host\n" unless defined $hostname; fail "no login name\n" unless defined $username; + + if (defined $passwd_script) { + $pwd_script_out = `$passwd_script`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $passwd = $pwd_script_out; + } + } + fail "no password\n" unless defined $passwd; fail "unrecognised action: $action\n" --- cluster/fence/agents/mcdata/fence_mcdata.pl 2006/08/16 19:05:25 1.2 +++ cluster/fence/agents/mcdata/fence_mcdata.pl 2007/02/12 20:17:06 1.3 @@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions @@ -53,6 +53,7 @@ print " -n Port number to disable\n"; print " -o Action: disable (default) or enable\n"; print " -p Password for login\n"; + print " -S Script to run to retrieve login password\n"; print " -q quiet mode\n"; print " -V version\n"; @@ -129,7 +130,11 @@ elsif ($name eq "passwd" ) { $opt_p = $val; - } + } + elsif ($name eq "passwd_script" ) + { + $opt_S = $val; + } elsif ($name eq "port" ) { $opt_n = $val; @@ -146,7 +151,7 @@ # MAIN if (@ARGV > 0) { - getopts("a:hl:n:o:p:qV") || fail_usage ; + getopts("a:hl:n:o:p:S:qV") || fail_usage ; usage if defined $opt_h; version if defined $opt_V; @@ -156,7 +161,16 @@ fail_usage "No '-a' flag specified." unless defined $opt_a; fail_usage "No '-n' flag specified." unless defined $opt_n; fail_usage "No '-l' flag specified." unless defined $opt_l; - fail_usage "No '-p' flag specified." unless defined $opt_p; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; fail_usage "Unrecognised action '$opt_o' for '-o' flag" unless $opt_o =~ /^(disable|enable)$/i; @@ -166,6 +180,15 @@ fail "failed: no IP address" unless defined $opt_a; fail "failed: no plug number" unless defined $opt_n; fail "failed: no login name" unless defined $opt_l; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "failed: no password" unless defined $opt_p; fail "failed: unrecognised action: $opt_o" unless $opt_o =~ /^(disable|enable)$/i; --- cluster/fence/agents/sanbox2/fence_sanbox2.pl 2006/08/16 19:06:05 1.3 +++ cluster/fence/agents/sanbox2/fence_sanbox2.pl 2007/02/12 20:17:06 1.4 @@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions @@ -46,6 +46,7 @@ print " -n Port number to disable\n"; print " -o Action: disable (default) or enable\n"; print " -p Password for login\n"; + print " -S Script to run to retrieve login password\n"; print " -q quiet mode\n"; print " -V version\n"; @@ -78,7 +79,7 @@ if (@ARGV > 0) { - getopts("a:hl:n:o:p:qV") || fail_usage ; + getopts("a:hl:n:o:p:S:qV") || fail_usage ; usage if defined $opt_h; version if defined $opt_V; @@ -88,7 +89,16 @@ fail_usage "No '-a' flag specified." unless defined $opt_a; fail_usage "No '-n' flag specified." unless defined $opt_n; fail_usage "No '-l' flag specified." unless defined $opt_l; - fail_usage "No '-p' flag specified." unless defined $opt_p; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; fail_usage "Unrecognised action '$opt_o' for '-o' flag" unless $opt_o =~ /^(disable|enable)$/i; @@ -98,6 +108,15 @@ fail "failed: no IP address" unless defined $opt_a; fail "failed: no plug number" unless defined $opt_n; fail "failed: no login name" unless defined $opt_l; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "failed: no password" unless defined $opt_p; fail "failed: unrecognised action: $opt_o" unless $opt_o =~ /^(disable|enable)$/i; @@ -222,7 +241,11 @@ elsif ($name eq "passwd" ) { $opt_p = $val; - } + } + elsif ($name eq "passwd_script" ) + { + $opt_S = $val; + } elsif ($name eq "port" ) { $opt_n = $val; --- cluster/fence/agents/vixel/fence_vixel.pl 2006/08/16 19:06:43 1.2 +++ cluster/fence/agents/vixel/fence_vixel.pl 2007/02/12 20:17:07 1.3 @@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions @@ -40,6 +40,7 @@ print " -h Usage\n"; print " -n Port number to disable\n"; print " -p Password for login\n"; + print " -S Script to run to retrieve login password\n"; print " -V version\n\n"; exit 0; @@ -70,7 +71,7 @@ } if (@ARGV > 0) { - getopts("a:hn:p:V") || fail_usage ; + getopts("a:hn:p:S:V") || fail_usage ; usage if defined $opt_h; version if defined $opt_V; @@ -78,13 +79,31 @@ fail_usage "Unknown parameter." if (@ARGV > 0); fail_usage "No '-a' flag specified." unless defined $opt_a; - fail_usage "No '-p' flag specified." unless defined $opt_p; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; fail_usage "No '-n' flag specified." unless defined $opt_n; } else { get_options_stdin(); fail "failed: no IP address for the Vixel." unless defined $opt_a; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "failed: no password provided." unless defined $opt_p; fail "failed: no port number specified." unless defined $opt_n; } @@ -130,7 +149,7 @@ ($text, $match) = $t->waitfor('/\>/'); if ($text !~ /[Oo][Kk]/) { - fail "failed: error from switch\n"; + fail "failed: error from switch\n"; } $t->print("exit"); @@ -141,57 +160,57 @@ sub get_options_stdin { - my $opt; - my $line = 0; - - while( defined($in = <>) ) - { - $_ = $in; - chomp; - - # strip leading and trailing whitespace - s/^\s*//; - s/\s*$//; - - # skip comments - next if /^#/; - - $line+=1; - $opt=$_; - next unless $opt; - - ($name,$val)=split /\s*=\s*/, $opt; - - if ( $name eq "" ) { - print("parse error: illegal name in option $line\n"); - exit 2; - } - - # DO NOTHING -- this field is used by fenced - elsif ($name eq "agent" ) { } - - # FIXME -- depricated. use "port" instead. - elsif ($name eq "fm" ) { - (my $dummy,$opt_n) = split /\s+/,$val; - print STDERR "Depricated \"fm\" entry detected. refer to man page.\n"; - } + my $opt; + my $line = 0; - elsif ($name eq "ipaddr" ) + while( defined($in = <>) ) { - $opt_a = $val; - } + $_ = $in; + chomp; - elsif ($name eq "name" ) { } - - elsif ($name eq "passwd" ) - { - $opt_p = $val; - } - - elsif ($name eq "port" ) - { - $opt_n = $val; - } - } + # strip leading and trailing whitespace + s/^\s*//; + s/\s*$//; + + # skip comments + next if /^#/; + + $line+=1; + $opt=$_; + next unless $opt; + + ($name,$val)=split /\s*=\s*/, $opt; + + if ( $name eq "" ) { + print("parse error: illegal name in option $line\n"); + exit 2; + } + + # DO NOTHING -- this field is used by fenced + elsif ($name eq "agent" ) { } + + # FIXME -- depricated. use "port" instead. + elsif ($name eq "fm" ) { + (my $dummy,$opt_n) = split /\s+/,$val; + print STDERR "Depricated \"fm\" entry detected. Refer to man page.\n"; + } + elsif ($name eq "ipaddr" ) + { + $opt_a = $val; + } + elsif ($name eq "name" ) { } + elsif ($name eq "passwd" ) + { + $opt_p = $val; + } + elsif ($name eq "passwd_script" ) + { + $opt_S = $val; + } + elsif ($name eq "port" ) + { + $opt_n = $val; + } + } } --- cluster/fence/agents/vmware/fence_vmware.pl 2005/09/01 18:25:42 1.1 +++ cluster/fence/agents/vmware/fence_vmware.pl 2007/02/12 20:17:07 1.2 @@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions @@ -21,7 +21,7 @@ use VMware::VmPerl::VM; use VMware::VmPerl::Server; use VMware::VmPerl::ConnectParams; -use vars qw( $opt_L $opt_v $opt_V $opt_h $opt_T $opt_n $opt_o $opt_p $opt_P $opt_l $opt_a $opt_q $vm_product $vm_platform $vm_build $vm_version_major $vm_version_minor $vm_version_revision ); +use vars qw( $opt_L $opt_v $opt_V $opt_h $opt_T $opt_n $opt_o $opt_p $opt_P $opt_S $opt_l $opt_a $opt_q $vm_product $vm_platform $vm_build $vm_version_major $vm_version_minor $vm_version_revision ); # Get the program name from $0 and strip directory names $_=$0; @@ -62,6 +62,7 @@ print " -h usage\n"; print " -l Login name\n"; print " -p Login password\n"; + print " -S Script to run to retrieve login password\n"; print " -n Name of VM to change \n"; print " -o Action: Reboot (default), Off or On\n"; print " -q quiet mode\n"; @@ -99,7 +100,7 @@ sub version { print "$pname $FENCE_RELEASE_NAME $BUILD_DATE\n"; - print "$SISTINA_COPYRIGHT\n" if ( $SISTINA_COPYRIGHT ); + print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT ); exit 0; } @@ -240,7 +241,11 @@ elsif ($name eq "passwd" ) { $opt_p = $val; - } + } + elsif ($name eq "passwd_script" ) + { + $opt_S = $val; + } elsif ($name eq "port" ) { $opt_n = $val; @@ -275,7 +280,7 @@ ### MAIN ####################################################### if (@ARGV > 0) { - getopts("a:hl:n:o:p:qTvVL") || fail_usage ; + getopts("a:hl:n:o:p:S:qTvVL") || fail_usage ; usage if defined $opt_h; version if defined $opt_V; @@ -285,9 +290,18 @@ fail_usage "No '-a' flag specified." unless defined $opt_a; fail_usage "No '-n' flag specified." unless defined $opt_n or defined $opt_L; fail_usage "No '-l' flag specified." unless defined $opt_l; - fail_usage "No '-p' flag specified." unless defined $opt_p; - fail_usage "Unrecognised action '$opt_o' for '-o' flag" - unless $opt_o =~ /^(Off|On|Reboot)$/i; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; + fail_usage "Unrecognized action '$opt_o' for '-o' flag" + unless $opt_o =~ /^(Off|On|Reboot)$/i; ($opt_a, $opt_P) = split(/:/, $opt_a); fail_usage "No port number specified." unless defined $opt_P; @@ -298,9 +312,18 @@ fail "failed: no IP address" unless defined $opt_a; fail "failed: no vm name" unless defined $opt_n; fail "failed: no login name" unless defined $opt_l; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "failed: no password" unless defined $opt_p; - fail "failed: unrecognised action: $opt_o" - unless $opt_o =~ /^(Off|On|Reboot)$/i; + fail "failed: unrecognized action: $opt_o" + unless $opt_o =~ /^(Off|On|Reboot)$/i; } &login; --- cluster/fence/agents/wti/fence_wti.pl 2007/01/31 20:22:07 1.6 +++ cluster/fence/agents/wti/fence_wti.pl 2007/02/12 20:17:08 1.7 @@ -43,6 +43,7 @@ print " -h usage\n"; print " -n Physical plug number on NPS\n"; print " -p Password if NPS requires one\n"; + print " -S Script to run to retrieve login password\n"; print " -o Operation to perform (on, off, reboot)\n"; print " -q quiet mode\n"; print " -T test reports state of plug (no power cycle)\n"; @@ -77,7 +78,7 @@ $opt_o = "reboot"; if (@ARGV > 0) { - getopts("a:hn:p:qTVo:") || fail_usage ; + getopts("a:hn:p:S:qTVo:") || fail_usage ; usage if defined $opt_h; version if defined $opt_V; @@ -86,13 +87,31 @@ fail_usage "No '-a' flag specified." unless defined $opt_a; fail_usage "No '-n' flag specified." unless defined $opt_n; - fail_usage "No '-p' flag specified." unless defined $opt_p; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; } else { get_options_stdin(); fail "failed: no IP address" unless defined $opt_a; fail "failed: no plug number" unless defined $opt_n; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "failed: no password" unless defined $opt_p; } @@ -338,6 +357,10 @@ { $opt_p = $val; } + elsif ($name eq "passwd_script" ) + { + $opt_S = $val; + } elsif ($name eq "port" ) { $opt_n = $val; --- cluster/fence/agents/xcat/fence_xcat.pl 2006/08/16 19:18:44 1.2 +++ cluster/fence/agents/xcat/fence_xcat.pl 2007/02/12 20:17:08 1.3 @@ -4,6 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ############################################################################### ############################################################################### --- cluster/fence/agents/xen/fence_xen.pl 2005/06/16 15:05:42 1.2 +++ cluster/fence/agents/xen/fence_xen.pl 2007/02/12 20:17:08 1.3 @@ -3,7 +3,7 @@ ############################################################################### ############################################################################### ## -## Copyright (C) 2005 Red Hat, Inc. All rights reserved. +## Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions @@ -35,9 +35,9 @@ # "#END_VERSION_GENERATION" It is generated by the Makefile #BEGIN_VERSION_GENERATION -$FENCE_RELEASE_NAME="DEVEL.1105353156"; -$REDHAT_COPYRIGHT=("Copyright (C) Red Hat, Inc. 2005 All rights reserved."); -$BUILD_DATE="(built Mon Jan 10 10:35:41 GMT 2005)"; +$FENCE_RELEASE_NAME=""; +$REDHAT_COPYRIGHT=""; +$BUILD_DATE=""; #END_VERSION_GENERATION sub usage @@ -83,7 +83,7 @@ sub version { print "$pname $FENCE_RELEASE_NAME $BUILD_DATE\n"; - print "$SISTINA_COPYRIGHT\n" if ( $SISTINA_COPYRIGHT ); + print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT ); exit 0; } --- cluster/fence/agents/zvm/fence_zvm.pl 2004/06/24 08:53:17 1.1 +++ cluster/fence/agents/zvm/fence_zvm.pl 2007/02/12 20:17:08 1.2 @@ -4,7 +4,7 @@ ############################################################################### ## ## Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. -## Copyright (C) 2004 Red Hat, Inc. All rights reserved. +## Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. ## ## This copyrighted material is made available to anyone wishing to use, ## modify, copy, or redistribute it subject to the terms and conditions @@ -45,7 +45,8 @@ print " -a IP address or hostname of the physical s390\n"; print " -h usage\n"; print " -u userid of the virtual machine to fence\n"; - print " -p Password\n"; + print " -p Password\n"; + print " -S Script to run to retrieve login password\n"; print " -q quiet mode\n"; print " -r ipl device \n"; print " -V Version\n"; @@ -267,6 +268,10 @@ { $opt_p = $val; } + elsif ($name eq "passwd_script" ) + { + $opt_S = $val; + } elsif ($name eq "userid" ) { $opt_u = $val; @@ -281,14 +286,23 @@ } if (@ARGV > 0){ - getopts("a:hp:qr:u:V") || fail_usage; + getopts("a:hp:S:qr:u:V") || fail_usage; usage if defined $opt_h; version if defined $opt_V; fail_usage "Unkown parameter." if (@ARGV > 0); fail_usage "No '-a' flag specified." unless defined $opt_a; - fail_usage "No '-p' flag specified." unless defined $opt_p; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + + fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p; fail_usage "No '-u' flag specified." unless defined $opt_u; } else { @@ -296,6 +310,15 @@ fail "no IP address" unless defined $opt_a; fail "no userid" unless defined $opt_u; + + if (defined $opt_S) { + $pwd_script_out = `$opt_S`; + chomp($pwd_script_out); + if ($pwd_script_out) { + $opt_p = $pwd_script_out; + } + } + fail "no password" unless defined $opt_p; }