# try to run 'hostname' in the node
command = TestSsh (hostname,key=local_key).actual_command("hostname;uname -a")
# don't spam logs - show the command only after the grace period
- if datetime.datetime.now() > graceout:
- success=utils.system(command)
- else:
- # truly silent, just print out a dot to show we're alive
- print '.',
- sys.stdout.flush()
- command += " 2>/dev/null"
- if self.options.dry_run:
- print 'dry_run',command
- success=0
- else:
- success=os.system(command)
+ success = utils.system ( command, silent=datetime.datetime.now() < graceout)
if success==0:
utils.header('Successfully entered root@%s (%s)'%(hostname,message))
# refresh tocheck
+#
+# $Id$
+# $URL$
+#
import utils
import os, os.path
import datetime
for hostname in tocheck:
(site_spec,node_spec) = self.test_plc.locate_hostname(hostname)
date_test_ssh = TestSsh (hostname,key=remote_privatekey,username=self.name())
- if datetime.datetime.now() >= graceout:
- utils.header('Trying to enter into slice %s@%s'%(self.name(),hostname))
- # this can be ran locally as we have the key
- date = date_test_ssh.run("echo hostname ; hostname; echo id; id; echo uname -a ; uname -a")==0
+ command = date_test_ssh.actual_command("echo hostname ; hostname; echo id; id; echo uname -a ; uname -a")
+ date = utils.system (command, silent=datetime.datetime.now() < graceout)
if date:
utils.header("Successfuly entered slice %s on %s"%(self.name(),hostname))
tocheck.remove(hostname)
-def system(command,background=False):
- if background: command += " &"
+def system(command,background=False,silent=False):
if options.dry_run:
print 'dry_run:',command
return 0
+
+ if silent : command += "2> /dev/null"
+ if background: command += " &"
+ if silent:
+ print '.',
+ sys.stdout.flush()
else:
now=time.strftime("%H:%M:%S", time.localtime())
# don't show in summary
print "->",now,'--',
sys.stdout.flush()
- return os.system("set -x; " + command)
+ return os.system("set -x; " + command)
### WARNING : this ALWAYS does its job, even in dry_run mode
def output_of (command):