Exemplo n.º 1
0
Arquivo: main.py Projeto: zdzichu/pki
        elif client_type == 'java':
            self.execute_java(cmd_args)

        else:
            raise Exception('Unsupported client type: ' + client_type)


if __name__ == '__main__':

    logging.basicConfig(format='%(levelname)s: %(message)s')

    cli = PKICLI()

    try:
        cli.execute(sys.argv)

    except subprocess.CalledProcessError as e:

        if logger.isEnabledFor(logging.DEBUG):
            logger.exception('Command: %s', ' '.join(e.cmd))

        elif logger.isEnabledFor(logging.INFO):
            logger.error('Command: %s', ' '.join(e.cmd))

        sys.exit(e.returncode)

    except KeyboardInterrupt:
        print()
        sys.exit(-1)
Exemplo n.º 2
0
            else:
                print('ERROR: unknown option ' + o)
                self.print_help()
                sys.exit(1)

        if self.verbose:
            print('Command: %s' % ' '.join(args))

        super(PKIServerCLI, self).execute(args)


if __name__ == '__main__':

    cli = PKIServerCLI()

    try:
        cli.execute(sys.argv)

    except subprocess.CalledProcessError as e:
        if cli.verbose:
            traceback.print_exc()
        print('ERROR: Command: %s' % ' '.join(e.cmd))
        sys.exit(e.returncode)

    except Exception as e:  # pylint: disable=broad-except
        if cli.verbose:
            traceback.print_exc()
        print('ERROR: %s' % e)
        sys.exit(1)