diff --git a/tsshbatch.py b/tsshbatch.py index 8209532..8fc8ef8 100755 --- a/tsshbatch.py +++ b/tsshbatch.py @@ -20,7 +20,7 @@ CMDINCL = PROGENV + "CMDS" HOSTINCL = PROGENV + "HOSTS" -CVSID = "$Id: tsshbatch.py,v 1.227 2016/01/18 22:41:05 tundra Exp $" +CVSID = "$Id: tsshbatch.py,v 1.228 2016/01/18 23:23:18 tundra Exp $" VERSION = CVSID.split()[2] CPRT = "(c)" PROGDATE = "2011-2016" @@ -81,7 +81,7 @@ HOSTNOISE = '[%s]' HOSTLIST = 'Hosts' INDENTWIDTH = 8 -OPTIONSLIST = 'BEKG:H:NP:ST:abef:hkl:n:p:qstvxy' +OPTIONSLIST = 'BC:EKG:H:NP:ST:abef:hkl:n:p:qstvxy' PADWIDTH = 12 PATHDELIM = ':' PATHSEP = os.sep @@ -98,34 +98,35 @@ USERVAR = 'USER' USAGE = \ - PROGVER + "\n" +\ - HOMEPAGE + "\n\n" +\ - "Usage: tsshbatch.py [-EKNSTaehkqstvy -G 'file dest' -P 'file dest' -f cmdfile -l logfile -n name -p pw ] -H 'host ..' | hostlistfile [command arg ... ]\n" +\ - " where,\n" +\ - "\n" +\ - " -B Print start and stop statistics\n" +\ - " -E Write error output to stdout instead of stderr\n" +\ - " -K Force password prompting - Overrides previous -k\n" +\ - " -G 'file dest' GET file on host and write local dest directory\n" +\ - " -H '...' List of targeted hosts passed as a single argument\n" +\ - " -N Force prompting for username\n" +\ - " -P 'file dest' PUT local file to host dest directory\n" +\ - " -S Force prompting for sudo password\n" +\ - " -T seconds Timeout for ssh connection attempts (Default: 15 sec)\n" +\ - " -a Don't abort program after failed file transfers\n" +\ - " -b Don't abort program after failed sudo command\n" +\ - " -e Don't report remote host stderr output\n" +\ - " -f cmdfile Read commands from file\n" +\ - " -h Display help\n" +\ - " -k Use key exchange-based authentication\n" +\ - " -l logfile Log errors to logfile (Default: /dev/null)\n" +\ - " -n name Specify login name\n" +\ - " -p pw Specify login password\n" +\ - " -q Quiet mode - produce less 'noisy' output\n" +\ - " -s Silence all program noise - only return command output\n" +\ - " -t Run in test mode, don't actually execute commands\n" +\ - " -v Display extended program version information\n" +\ - " -x Turn off test mode (if on) and execute requests\n" +\ + PROGVER + "\n" +\ + HOMEPAGE + "\n\n" +\ + "Usage: tsshbatch.py [-BEKNSTaehkqstvy -C configfile -G 'file dest' -P 'file dest' -f cmdfile -l logfile -n name -p pw ] -H 'host ..' | hostlistfile [command arg ... ]\n" +\ + " where,\n" +\ + "\n" +\ + " -B Print start and stop statistics (Off)\n" +\ + " -C configfile Specify location of ssh configuration file (~/.ssh/config)\n" +\ + " -E Write error output to stdout instead of stderr (Output to stderr)\n" +\ + " -K Force password prompting - Overrides previous -k\n" +\ + " -G 'file dest' GET file on host and write local dest directory\n" +\ + " -H '...' List of targeted hosts passed as a single argument\n" +\ + " -N Force prompting for username\n" +\ + " -P 'file dest' PUT local file to host dest directory\n" +\ + " -S Force prompting for sudo password\n" +\ + " -T seconds Timeout for ssh connection attempts (15 sec)\n" +\ + " -a Don't abort program after failed file transfers (Abort on failure)\n" +\ + " -b Don't abort program after failed sudo command (Abort on failure)\n" +\ + " -e Don't report remote host stderr output (Report host stderr) \n" +\ + " -f cmdfile Read commands from file\n" +\ + " -h Display help\n" +\ + " -k Use key exchange-based authentication (Use password auth)\n" +\ + " -l logfile Log errors to logfile (/dev/null)\n" +\ + " -n name Specify login name\n" +\ + " -p pw Specify login password\n" +\ + " -q Quiet mode - produce less 'noisy' output\n" +\ + " -s Silence all program noise - only return command output\n" +\ + " -t Run in test mode, don't actually execute commands (Default)\n" +\ + " -v Display extended program version information\n" +\ + " -x Turn off test mode (if on) and execute requests\n" +\ " -y Turn on 'noisy' reporting for additional detail\n" @@ -181,7 +182,7 @@ # Informational Messages ##### -iNOCFGFILE = "Warning: Cannot Open File '%s'! Continuing Anyway ..." +iNOCFGFILE = "Warning: Cannot Open Configuration File '%s'! Continuing Anyway ..." iTXFILE = "Writing %s To %s ..." @@ -716,7 +717,7 @@ # File open failed, but we go on anyway except: PrintStderr(iNOCFGFILE % filename) - return sshconfig + return retval sshconfig.parse(f) f.close() @@ -827,6 +828,9 @@ if opt == "-B": BANNERSON = True + if opt == "-C": + SSHCFGFILE = val + if opt == "-E": REDIRSTDERR = True