yanivk1984
7/4/2019 - 1:22 PM

ParallelSSHClient example

cmd = "mdsstat"
client = ParallelSSHClient(hosts=[self.hostname], user=self.user, password=self.password)
output = client.run_command(cmd)

for line in output[self.hostname].stdout:
  print(line)
cmd = "mdsstat"
client = ParallelSSHClient(hosts=[self.hostname], user=self.user, password=self.password)
logger.info('Running the {} command'.format(cmd))

try:
  output = client.run_command(cmd)
except Exception as error
  print('There was an issue with running the {} command. Exiting...'.format(cmd))
  logger.fatal('There was an issue with running the {} command. Exiting...'.format(cmd))
  exit(1)
  
for line in output[self.hostname].stdout:
  print(line)
  logger.info('Output --> ' + line)