vaultmanager/VaultManager.py
def initialize_arg_parser(self):
        """
        Initialize parser and subparsers then launch the specified module
        """
        self.logger.debug("initializing arguments parser")
        self.arg_parser = argparse.ArgumentParser(
            description="Vault configuration manager"
        )
        self.add_arguments()
        subparsers = self.arg_parser.add_subparsers()
        # Fetch the list of all available submodules
        self.modules = dict()
        for file in glob.glob(
                os.path.join(self.module_path, 'modules', 'VaultManager*.py')):
            self.logger.debug("Module " + file + " found")
            module_name = os.path.splitext(os.path.basename(file))[0]
            module_short_name = module_name.replace("VaultManager", "").lower()
            try:
                module = getattr(importlib.import_module('modules.' + module_name), module_name)
            except ImportError:
                module = getattr(importlib.import_module(
                    'vaultmanager.modules.' + module_name),
                    module_name
                )
            self.modules[module_short_name] = module(self.base_logger_name)
            self.modules[module_short_name].initialize_subparser(subparsers)
        self.parsed_arguments = self.arg_parser.parse_args()
        self.adjust_log_level()
        self.fetch_argument_values()
        if self.parsed_arguments.version:
            try:
                self.logger.info(
                    self.base_logger_name + " v" + vaultmanager.__version__
                )
            except NameError:
                self.logger.error("vaultmanager is not installed")
        elif len(sys.argv) <= 2:
            print()
            print(self.arg_parser.print_help())
        else:
            # Start the specified module
            if self.parsed_arguments.dry_run:
                self.logger.info("RUNNING IN DRY MODE")
            try:
                self.modules[self.parsed_arguments.module_name].run(
                    vars(self.parsed_arguments)
                )
                # if logger has logged messages > WARNING
                if logging.getLogger('VaultManager.VaultClient').has_error():
                    self.logger.error("Error found during execution" + "\n")
                    exit(1)
            except ValueError as e:
                self.logger.error(str(e) + "\n")
                self.arg_parser.print_help()
                exit(1)

        Initialize parser and subparsers then launch the specified module
        
Initialize parser and subparsers then launch the specified module
Initialize parser and subparsers then launch the specified module
def initialize_arg_parser(self):
        self.logger.debug("initializing arguments parser")
        self.arg_parser = argparse.ArgumentParser(
            description="Vault configuration manager"
        )
        self.add_arguments()
        subparsers = self.arg_parser.add_subparsers()
        self.modules = dict()
        for file in glob.glob(
                os.path.join(self.module_path, 'modules', 'VaultManager*.py')):
            self.logger.debug("Module " + file + " found")
            module_name = os.path.splitext(os.path.basename(file))[0]
            module_short_name = module_name.replace("VaultManager", "").lower()
            try:
                module = getattr(importlib.import_module('modules.' + module_name), module_name)
            except ImportError:
                module = getattr(importlib.import_module(
                    'vaultmanager.modules.' + module_name),
                    module_name
                )
            self.modules[module_short_name] = module(self.base_logger_name)
            self.modules[module_short_name].initialize_subparser(subparsers)
        self.parsed_arguments = self.arg_parser.parse_args()
        self.adjust_log_level()
        self.fetch_argument_values()
        if self.parsed_arguments.version:
            try:
                self.logger.info(
                    self.base_logger_name + " v" + vaultmanager.__version__
                )
            except NameError:
                self.logger.error("vaultmanager is not installed")
        elif len(sys.argv) <= 2:
            print()
            print(self.arg_parser.print_help())
        else:
            if self.parsed_arguments.dry_run:
                self.logger.info("RUNNING IN DRY MODE")
            try:
                self.modules[self.parsed_arguments.module_name].run(
                    vars(self.parsed_arguments)
                )
                if logging.getLogger('VaultManager.VaultClient').has_error():
                    self.logger.error("Error found during execution" + "\n")
                    exit(1)
            except ValueError as e:
                self.logger.error(str(e) + "\n")
                self.arg_parser.print_help()
                exit(1)
def initialize_arg_parser ( self ) : self . logger . debug ( "initializing arguments parser" ) self . arg_parser = argparse . ArgumentParser ( description = "Vault configuration manager" ) self . add_arguments ( ) subparsers = self . arg_parser . add_subparsers ( ) self . modules = dict ( ) for file in glob . glob ( os . path . join ( self . module_path , 'modules' , 'VaultManager*.py' ) ) : self . logger . debug ( "Module " + file + " found" ) module_name = os . path . splitext ( os . path . basename ( file ) ) [ 0 ] module_short_name = module_name . replace ( "VaultManager" , "" ) . lower ( ) try : module = getattr ( importlib . import_module ( 'modules.' + module_name ) , module_name ) except ImportError : module = getattr ( importlib . import_module ( 'vaultmanager.modules.' + module_name ) , module_name ) self . modules [ module_short_name ] = module ( self . base_logger_name ) self . modules [ module_short_name ] . initialize_subparser ( subparsers ) self . parsed_arguments = self . arg_parser . parse_args ( ) self . adjust_log_level ( ) self . fetch_argument_values ( ) if self . parsed_arguments . version : try : self . logger . info ( self . base_logger_name + " v" + vaultmanager . __version__ ) except NameError : self . logger . error ( "vaultmanager is not installed" ) elif len ( sys . argv ) <= 2 : print ( ) print ( self . arg_parser . print_help ( ) ) else : if self . parsed_arguments . dry_run : self . logger . info ( "RUNNING IN DRY MODE" ) try : self . modules [ self . parsed_arguments . module_name ] . run ( vars ( self . parsed_arguments ) ) if logging . getLogger ( 'VaultManager.VaultClient' ) . has_error ( ) : self . logger . error ( "Error found during execution" + "\n" ) exit ( 1 ) except ValueError as e : self . logger . error ( str ( e ) + "\n" ) self . arg_parser . print_help ( ) exit ( 1 )
Initialize parser and subparsers then launch the specified module
Initialize parser and subparsers then launch the specified module
"""
        Initialize parser and subparsers then launch the specified module
        """ # Fetch the list of all available submodules # Start the specified module # if logger has logged messages > WARNING
self