class ConfigCmd(Cmd): """Configures message bus and sspl sensor monitor state.""" name = "config" def __init__(self, args): """Initialize config command.""" from files.opt.seagate.sspl.setup.sspl_config import SSPLConfig super().__init__(args) self.sspl_config = SSPLConfig() logger.info("%s - Init done" % self.name) @staticmethod def add_args(parser: str, cls: str, name: str): """Add Command args for parsing.""" parsers = parser.add_parser(cls.name, help='%s' % cls.__doc__) parsers.add_argument('args', nargs='*', default=[], help='args') parsers.add_argument('--config', nargs='*', default=[], help='Global config url') parsers.set_defaults(command=cls) def validate(self): """Validate config command arguments.""" if not self.args.config: msg = "%s - Argument validation failure. %s" % ( self.name, "Global config URL is required.") logger.error(msg) raise SetupError(errno.EINVAL, msg) # Validate config inputs Conf.load(PRVSNR_CONFIG_INDEX, self.args.config[0]) self.sspl_config.validate() logger.info("%s - validation done" % self.name) def process(self): """Setup SSPL configuration.""" self.copy_input_config() self.sspl_config.process() logger.info("%s - Process done" % self.name)
def process(self): """Setup SSPL configuration""" from files.opt.seagate.sspl.setup.sspl_config import SSPLConfig sspl_config = SSPLConfig() sspl_config.validate() sspl_config.process()
def __init__(self, args): """Initialize config command.""" from files.opt.seagate.sspl.setup.sspl_config import SSPLConfig super().__init__(args) self.sspl_config = SSPLConfig() logger.info("%s - Init done" % self.name)
def __init__(self, args): """Initialize config command.""" from files.opt.seagate.sspl.setup.sspl_config import SSPLConfig super().__init__(args) self.sspl_config = SSPLConfig()