예제 #1
0
 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())
예제 #2
0
 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())
예제 #3
0
    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')
예제 #4
0
    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')
예제 #5
0
    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')
예제 #6
0
 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())