def execute(self, argv): try: opts, args = getopt.gnu_getopt( argv, 'v', ['wait', 'max-wait=', 'timeout=', 'verbose', 'debug', 'help']) except getopt.GetoptError as e: logger.error(e) self.print_help() sys.exit(1) instance_name = 'pki-tomcat' wait = False max_wait = 60 timeout = None for o, a in opts: if o == '--wait': wait = True elif o == '--max-wait': max_wait = int(a) elif o == '--timeout': timeout = int(a) elif o in ('-v', '--verbose'): logging.getLogger().setLevel(logging.INFO) elif o == '--debug': logging.getLogger().setLevel(logging.DEBUG) elif o == '--help': self.print_help() sys.exit() else: logger.error('Unknown option: %s', o) self.print_help() sys.exit(1) if len(args) > 0: instance_name = args[0] instance = pki.server.instance.PKIServerFactory.create(instance_name) if not instance.exists(): logger.error('Invalid instance: %s', instance_name) sys.exit(1) if not instance.is_active(): self.print_message('Instance already stopped') return instance.stop(wait=wait, max_wait=max_wait, timeout=timeout)
def execute(self, argv): try: opts, args = getopt.gnu_getopt( argv, 'v', ['with-maven-deps', 'force', 'verbose', 'debug', 'help']) except getopt.GetoptError as e: logger.error(e) self.print_help() sys.exit(1) instance_name = 'pki-tomcat' with_maven_deps = False force = False for o, _ in opts: if o == '--with-maven-deps': with_maven_deps = True elif o == '--force': force = True elif o in ('-v', '--verbose'): logging.getLogger().setLevel(logging.INFO) elif o == '--debug': logging.getLogger().setLevel(logging.DEBUG) elif o == '--help': self.print_help() sys.exit() else: logger.error('Unknown option: %s', o) self.print_help() sys.exit(1) if len(args) > 0: instance_name = args[0] instance = pki.server.instance.PKIServerFactory.create(instance_name) if not force and instance.exists(): logger.error('Instance already exists: %s', instance_name) sys.exit(1) logging.info('Creating instance: %s', instance_name) instance.with_maven_deps = with_maven_deps instance.create(force=force)
def execute(self, argv): try: opts, args = getopt.gnu_getopt(argv, 'v', ['verbose', 'debug', 'help']) except getopt.GetoptError as e: logger.error(e) self.print_help() sys.exit(1) instance_name = 'pki-tomcat' for o, _ in opts: if o in ('-v', '--verbose'): logging.getLogger().setLevel(logging.INFO) elif o == '--debug': logging.getLogger().setLevel(logging.DEBUG) elif o == '--help': self.print_help() sys.exit() else: logger.error('Unknown option: %s', o) self.print_help() sys.exit(1) if len(args) > 0: instance_name = args[0] instance = pki.server.instance.PKIServerFactory.create(instance_name) if not instance.exists(): logger.error('Invalid instance: %s', instance_name) sys.exit(1) if instance.is_active(): self.print_message('Instance already started') return instance.start()
def execute(self, argv): try: opts, args = getopt.gnu_getopt(argv, 'v', [ 'as-current-user', 'with-jdb', 'with-gdb', 'with-valgrind', 'agentpath=', 'verbose', 'debug', 'help' ]) except getopt.GetoptError as e: logger.error(e) self.print_help() sys.exit(1) instance_name = 'pki-tomcat' as_current_user = False with_jdb = False with_gdb = False with_valgrind = False agentpath = None for o, a in opts: if o == '--as-current-user': as_current_user = True elif o == '--with-jdb': with_jdb = True elif o == '--with-gdb': with_gdb = True elif o == '--with-valgrind': with_valgrind = True elif o == '--agentpath': agentpath = a elif o in ('-v', '--verbose'): logging.getLogger().setLevel(logging.INFO) elif o == '--debug': logging.getLogger().setLevel(logging.DEBUG) elif o == '--help': self.print_help() sys.exit() else: logger.error('Unknown option: %s', o) self.print_help() sys.exit(1) if len(args) > 0: instance_name = args[0] instance = pki.server.instance.PKIServerFactory.create(instance_name) if not instance.exists(): logger.error('Invalid instance: %s', instance_name) sys.exit(1) instance.load() try: instance.run(as_current_user=as_current_user, with_jdb=with_jdb, with_gdb=with_gdb, with_valgrind=with_valgrind, agentpath=agentpath) except KeyboardInterrupt: logger.debug('Server stopped')