def option_schema_check(action, option_dict): clean_options = SchemaCheck( prune_nones(option_dict), options.get_schema(action), 'options', '{0} singleton action "options"'.format(action) ).result() return prune_excluded(clean_options)
def check_options(self, option_dict): try: self.logger.debug( 'Validating provided options: {0}'.format(option_dict)) # Kludgy work-around to needing 'repository' in options for these actions # but only to pass the schema check. It's removed again below. if self.action in ['delete_snapshots', 'restore']: option_dict['repository'] = self.repository _ = SchemaCheck( prune_nones(option_dict), options.get_schema(self.action), 'options', '{0} singleton action "options"'.format(self.action)).result() self.options = self.prune_excluded(_) # Remove this after the schema check, as the action class won't need it as an arg if self.action in ['delete_snapshots', 'restore']: del self.options['repository'] except ConfigurationError as e: self.logger.critical('Unable to parse options: {0}'.format(e)) sys.exit(1)
def check_options(self, option_dict): try: self.logger.debug('Validating provided options: {0}'.format(option_dict)) # Kludgy work-around to needing 'repository' in options for these actions # but only to pass the schema check. It's removed again below. if self.action in ['delete_snapshots', 'restore']: option_dict['repository'] = self.repository _ = SchemaCheck( prune_nones(option_dict), options.get_schema(self.action), 'options', '{0} singleton action "options"'.format(self.action) ).result() self.options = self.prune_excluded(_) # Remove this after the schema check, as the action class won't need it as an arg if self.action in ['delete_snapshots', 'restore']: del self.options['repository'] except ConfigurationError as e: self.logger.critical('Unable to parse options: {0}'.format(e)) sys.exit(1)
def option_schema_check(action, option_dict): """Validate command-line options against the option schema""" clean_options = SchemaCheck( prune_nones(option_dict), options.get_schema(action), 'options', '{0} singleton action "options"'.format(action)).result() return prune_excluded(clean_options)