Ejemplo n.º 1
0
def get_bodhi_shell():
    """Run python shell initialized with Bodhi models."""
    configfile = get_configfile()
    if configfile is not None:
        call(['pshell-3', configfile])
    else:
        click.echo("Config file not found!", err=True)
        sys.exit(1)
Ejemplo n.º 2
0
def setup():
    """Set up logging from our config file."""
    pyramid_includes = config.config.get('pyramid.includes', '').split('\n')
    if 'pyramid_sawing' in pyramid_includes:
        # This Bodhi deployment is using pyramid_sawing to configure logging. This means that we
        # cannot use paster.setup_logging() because the main config file doesn't have the logging
        # settings. Let's read the main config file to find out where the logging settings are.
        logging_config = config.config['pyramid_sawing.file']
        with open(logging_config) as logging_config_file:
            logging_config = yaml.safe_load(logging_config_file.read())
        logging.config.dictConfig(logging_config)
    else:
        paster.setup_logging(config.get_configfile())
Ejemplo n.º 3
0
    def test_get_config_unable_to_find_file(self, exists, log_error):
        """Test we log an error if get_configfile() doesn't find a config file"""
        config.get_configfile()

        log_error.assert_called_once_with("Unable to find configuration to load!")