+ def ssh_tasks(self,options, expected=True, command=None):
+# timeout_minutes=20, silent_minutes=10, period_seconds=15):
+# timeout = timedelta(minutes=timeout_minutes)
+# graceout = timedelta(minutes=silent_minutes)
+# period = timedelta(seconds=period_seconds)
+ if not command:
+ command = "echo hostname ; hostname; echo id; id; echo uname -a ; uname -a"
+ # locate a key
+ private_key = self.locate_private_key()
+ if not private_key :
+ utils.header("WARNING: Cannot find a valid key for slice {}".format(self.name()))
+ return False
+
+ # convert nodenames to real hostnames
+ if expected: msg="ssh slice access enabled"
+ else: msg="ssh slice access disabled"
+ utils.header("checking for {} -- slice {}".format(msg, self.name()))
+
+ tasks=[]
+ slicename=self.name()
+ dry_run = getattr(options, 'dry_run', False)
+ for nodename in self.slice_spec['nodenames']:
+ site_spec, node_spec = self.test_plc.locate_node(nodename)
+ tasks.append( CompleterTaskSliceSsh(self.test_plc, node_spec['node_fields']['hostname'],
+ slicename, private_key, command, expected, dry_run))
+ return tasks
+
+ def ssh_slice_basics (self, options, *args, **kwds):
+ "the slice is expected to be UP and we just check a few simple sanity commands, including 'ps' to check for /proc"
+ overall = True
+ if not self.do_ssh_slice_once(options, expected=True, command='true'): overall=False
+ if not self.do_ssh_slice_once(options, expected=False, command='false'): overall=False
+ if not self.do_ssh_slice_once(options, expected=False, command='someimprobablecommandname'): overall=False
+ if not self.do_ssh_slice_once(options, expected=True, command='ps'): overall=False
+ if not self.do_ssh_slice_once(options, expected=False, command='ls /vservers'): overall=False
+ return overall
+
+ # pick just one nodename and runs the ssh command once
+ def do_ssh_slice_once(self, options, command, expected):