Exemple #1
0
def server():
    agent = None
    if platform.system() == 'Linux':
        from guest_agent_linux import LinuxVdsAgent

        agent = LinuxVdsAgent()
    else:
        from guest_agent_windows import WindowsVdsAgent

        agent = WindowsVdsAgent()
    agent.run()
            name = args.get('name')
            result = self.commandHandler.get_infomation(name)
            self._send('get_infomation', {'result': result})

        elif command == 'execute_script':
            path = args.get('path')
            type = args.get('type')
            result = self.commandHandler.execute_script(path, type)
            self._send('execute_script', {'result': result})

        elif command == 'execute_command':
            cmd = args.get('cmd')
            try:
                result = self.commandHandler.execute_command(cmd)
                self._send('execute_command', {'result': result})
            except:
                self._send('execute_command', {'result': '0e0r0r0o0r1'})

        elif command == 'echo':
            self._send('echo', args)

        else:
            self._send(command, {'result': '0e0r0r0o0r0'})


if __name__ == '__main__':
    from guest_agent_linux import LinuxVdsAgent

    agent = LinuxVdsAgent()
    agent.run()
            name = args.get('name')
            result = self.commandHandler.get_infomation(name)
            self._send('get_infomation', {'result': result})

        elif command == 'execute_script':
            path = args.get('path')
            type = args.get('type')
            result = self.commandHandler.execute_script(path, type)
            self._send('execute_script', {'result': result})

        elif command == 'execute_command':
            cmd = args.get('cmd')
            try:
                result = self.commandHandler.execute_command(cmd)
                self._send('execute_command', {'result': result})
            except:
                self._send('execute_command', {'result': '0e0r0r0o0r1'})

        elif command == 'echo':
            self._send('echo', args)

        else:
            self._send(command, {'result': '0e0r0r0o0r0'})


if __name__ == '__main__':
    from guest_agent_linux import LinuxVdsAgent

    agent = LinuxVdsAgent()
    agent.run()