def test__run__as_user(self): """Run a ssh command to localhost and verify it works """ result = sshmap.run('localhost', 'echo hello') if result[0].ssh_retcode == 3: logging.warn('Could not connect to localhost') return self.assertEqual('hello\n', result[0].out_string())
def test__run__as_user(self): """Run a ssh command to localhost and verify it works """ result = sshmap.run('localhost', 'echo hello') if result[0].ssh_retcode == 3: self.logger.warning('Could not connect to localhost') return self.assertEqual('hello\n', result[0].out_string())
def test__run_shell_script_as_user(self): # Run a ssh command to localhost and verify it works sf = open('testscript.test', 'w') sf.write('#!/bin/bash\necho hello\n') sf.close() result = sshmap.run('localhost', '/bin/bash', script='testscript.test') if result[0].ssh_retcode == 3: logging.warn('Could not connect to localhost') return self.assertEqual('hello\n', result[0].out_string()) os.remove('testscript.test')
def test__run_shell_script_as_user(self): # Run a ssh command to localhost and verify it works sf = open('testscript.test', 'w') sf.write('#!/bin/bash\necho hello\n') sf.close() result = sshmap.run( 'localhost', '/bin/bash', script='testscript.test' ) self.assertEqual('hello\n', result[0].out_string()) os.remove('testscript.test')
def test__run_shell_script_as_user(self): # Run a ssh command to localhost and verify it works sf = open('testscript.test', 'w') sf.write('#!/bin/bash\necho hello\n') sf.close() result = sshmap.run( 'localhost', '/bin/bash', script='testscript.test' ) if result[0].ssh_retcode == 3: self.logger.warning('Could not connect to localhost') return self.assertEqual('hello\n', result[0].out_string()) os.remove('testscript.test')
def test__run__as_user(self): """Run a ssh command to localhost and verify it works """ result = sshmap.run('localhost', 'echo hello') self.assertEqual('hello\n', result[0].out_string())