import src.python.config
import paramiko
import io
from src.python.config import Config
from src.python.sessions.hitchcocksession import get_hitchcock_ssh_session
import logging
from root import root_dir
import sys

logging.basicConfig(filename=root_dir + '\\logs\\server.log',level=logging.INFO)
session_abcd = get_hitchcock_ssh_session()


def run_script(script):
    """
    Run the given json script on the hitchcock server

    :param script: json script
    :type script: str
    """

    script = "\'" + script + "\'"

    try:
        # stdin, stdout, stderr = session.exec_command('ls')
        # stdin, stdout, stderr = session.exec_command('ssh -A -t [email protected] "ls"')
        # stdin, stdout, stderr = session.exec_command('ssh -A -t [email protected] "bash /var/www/icarus.blacklinegps.com/scripts/hitchcock/message/qascripts/sridhar/sridharmessage.sh "'+ script)
        stdin, stdout, stderr = session_abcd.exec_command('bash /var/www/icarus.blacklinegps.com/scripts/hitchcock/message/qascripts/sridhar/sridharmessage.sh ' + script)
        stdin.close()

        output = '-' * 150 + '\n'
Example #2
0
import src.python.sessions.hitchcocksession as hs

hs.get_hitchcock_ssh_session()