def load_config(filepath=None): config_cls = CIMConfig() if filepath: config_cls.load_dict(read_config(filepath)) else: read(config_cls, 'cim') config_cls.validate() return config_cls
def load_config(filename=None): config_cls = StatsConfig() if filename: config_cls.load_dict(read_config(filename)) else: read(config_cls, CONFIG_BASENAME) config_cls.validate() return config_cls
def load_ad_ldap_config(name='ad_ldap', filepath=None): config = ADLDAPConfig() if filepath: config.load_dict(read_config(filepath)) else: read(config, name) config.validate() return config
def load_config(cls): from Cerebrum.config.loader import read config = EventConfig() read(config, 'scim-event') config.validate() cls.issuer = config.issuer cls.url = config.urltemplate cls.keytemplate = config.keytemplate
def load_config(filepath=None): config_cls = ExchangeConfig() if filepath: config_cls.load_dict(read_config(filepath)) else: read(config_cls, 'exchange') config_cls.validate() return config_cls
def load_config(filepath=None): """ Loads and validates the GPG data configuration. """ config_cls = GPGDataConfig() if filepath: config_cls.load_dict(read_config(filepath)) else: read(config_cls, 'gpg_data') config_cls.validate() return config_cls
def load_config(filepath=None): """Load config for this consumer.""" config_cls = FPEConsumerConfig() if filepath: config_cls.load_dict(read_config(filepath)) else: read(config_cls, 'consumer_affiliations') config_cls.validate() return config_cls
def load_config(filepath=None): """Load config for this consumer.""" config_cls = SAPConsumerConfig() if filepath: config_cls.load_dict(read_config(filepath)) else: read(config_cls, 'consumer_sap') config_cls.validate() return config_cls
def load_config(filepath=None): """Load config for this consumer.""" config_cls = FPEConsumerConfig() if filepath: config_cls.load_dict(read_config(filepath)) else: read(config_cls, 'consumer_enforce_forward_policy') config_cls.validate() return config_cls
def _load_partial_config(cls, root_name, filepath): """ Try to load a given config into a config class `cls`. """ config = cls() if filepath: config.load_dict(read_config(filepath)) else: read(config, root_name) config.validate() return config
def load_config(filepath=None): """ """ config_cls = PasswordNotifierConfig() if filepath: config_cls.load_dict(read_config(filepath)) else: read(config_cls, 'password_notifier') config_cls.validate() return config_cls
def load_config(filepath=None): """ """ config_cls = PasswordGeneratorConfig() if filepath: config_cls.load_dict(read_config(filepath)) else: read(config_cls, 'password_generator') config_cls.validate() return config_cls
def load_config(filepath=None): u"""Load the config in filepath. defaults to event_publisher.json""" config_cls = AMQPClientPublisherConfig() if filepath: config_cls.load_dict(read_config(filepath)) else: read(config_cls, 'event_publisher') config_cls.validate() return config_cls
def load_amqp_client_config(celery_task, filepath=None): """ Loads the Cerebrum.config for the AMQPClient defaults to sys.prefix/etc/config/`celery_task`.json """ config = AMQPClientPublisherConfig() if filepath: config.load_dict(read_config(filepath)) else: read(config, celery_task) config.validate() return config
def get_config(config_file=None, namespace=DEFAULT_TEMPLATES_CONFIG): """ Autoload a TemplatesConfig config file. :param str config_file: Read the logging configuration from this file. :param str namespace: If no `config_file` is given, look for a config with this basename in the configuration directory. :return TemplatesConfig: Returns a configuration object. """ templates_config = TemplatesConfig() if config_file: templates_config.load_dict(loader.read_config(config_file)) else: loader.read(templates_config, root_ns=namespace) return templates_config
def get_config(config_file=None, namespace=DEFAULT_LOGGING_CONFIG): """ Autoload a LoggingEnvironment config file. :param str config_file: Read the logging configuration from this file. :param str namespace: If no `config_file` is given, look for a config with this basename in the configuration directory. :return LoggingEnvironment: Returns a configuration object. """ config = LoggingEnvironment() if config_file: config.load_dict(loader.read_config(config_file)) else: loader.read(config, root_ns=namespace) return config
def load_config(filepath=None, consumer_name=None): u"""Load config. Load config from filepath or the config associated with consumer_name. Defaults to consumer_config.json :type filepath: str :param filepath: The filepath to load :type consumer_name: str :param consumer_name: Load <consumer_name>.json""" config_cls = AMQPClientConsumerConfig() if filepath: config_cls.load_dict(read_config(filepath)) elif consumer_name: read(config_cls, consumer_name) else: read(config_cls, 'consumer_config') config_cls.validate() return config_cls
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-c', '--commit', action='store_true', default=False, help="Do commit the changes to db") parser.add_argument('--config', action='store', default=None, help='Config file') parser.add_argument('types', action='store', nargs='+', help='The types to create (see config)') args = parser.parse_args() if args.config: conf = CreateOuGroupConfig(read_config(args.config)) else: conf = read(CreateOuGroupConfig(), 'create-ougroups') configs = {} for t in conf.types: configs[t.name] = t db = Factory.get('Database')(client_encoding='UTF-8') db.cl_init(change_program="create-ougroups") co = Factory.get('Constants')(db) for tp in args.types: if tp in configs: logger.info('Setting up groups for rule %s', tp) conf = configs[tp] aff, status = parse_aff(conf.aff, co) source = co.AuthoritativeSystem(conf.source) roots = conf.root recursion = co.VirtualGroupOURecursion(conf.recursion) members = co.VirtualGroupOUMembership(conf.members) perspective = co.OUPerspective(conf.perspective) spreads = map(co.Spread, conf.spreads) for root in roots: logger.info('Setting up root %s', root) setup_types(db, root, recursion, aff, status, source, members, perspective, conf.nametemplate, conf.descriptiontemplate, spreads, co) logger.info('Done setting up %s', tp) else: sys.exit(1) if args.commit: logger.info('Committing') db.commit() else: logger.info('Doing rollback') db.rollback()