示例#1
0
文件: AutoD.py 项目: miichy/Pisces
class AutoD:
    def __init__(self, host, comms, key, user, ):

        self.logger = MyLogger().getLogger();
        self.logger.info('AutoD initial beginning~~~')
        self.tool = Tool()

        self.host = host
        self.comms = comms
        if not key:
            self.child = run('ssh {0}@{1}'.format(user, host))
        else:
            self.child = run('ssh -i {0} {1}@{2}'.format(key, user, host))

    def destroyed(self):
        self.logger.info('Destoryed the ssh login ~~~ ')
        self.child.close(force=True)

    def exec_command(self):
        self.logger.info('AutoD.exec_command ')
        self.tool.jdk_exist()
        print('command is {}'.format(self.comms))