Exemple #1
0
    def __init__(self,
                 config=None,
                 parser=None,
                 plugin_manager=PluginManager,
                 environment=Environment,
                 debug=False,
                 envname=None):
        log.info('Aminator starting...')
        if not all((config, parser)):
            log.debug('Loading default configuration')
            config, parser = init_defaults(debug=debug)
        self.config = config
        self.parser = parser
        log.debug('Configuration loaded')
        if not envname:
            envname = self.config.environments.default
        self.plugin_manager = plugin_manager(
            self.config,
            self.parser,
            plugins=self.config.environments[envname])
        log.debug('Plugins loaded')
        self.parser.parse_args()
        log.debug('Args parsed')

        log.debug('Creating initial folder structure if needed')
        mkdir_p(self.config.log_root)
        mkdir_p(os.path.join(self.config.aminator_root, self.config.lock_dir))
        mkdir_p(os.path.join(self.config.aminator_root,
                             self.config.volume_dir))

        if self.config.logging.aminator.enabled:
            log.debug('Configuring per-package logging')
            configure_datetime_logfile(self.config, 'aminator')

        self.environment = environment()
Exemple #2
0
    def __init__(self, config=None, parser=None, plugin_manager=PluginManager, environment=Environment, debug=False, envname=None):
        log.info('Aminator starting...')
        if not all((config, parser)):
            log.debug('Loading default configuration')
            config, parser = init_defaults(debug=debug)
        self.config = config
        self.parser = parser
        log.debug('Configuration loaded')
        if not envname:
            envname = self.config.environments.default
        self.plugin_manager = plugin_manager(self.config, self.parser, plugins=self.config.environments[envname])
        log.debug('Plugins loaded')
        self.parser.parse_args()
        log.debug('Args parsed')

        log.debug('Creating initial folder structure if needed')
        mkdir_p(self.config.log_root)
        mkdir_p(os.path.join(self.config.aminator_root, self.config.lock_dir))
        mkdir_p(os.path.join(self.config.aminator_root, self.config.volume_dir))

        if self.config.logging.aminator.enabled:
            log.debug('Configuring per-package logging')
            configure_datetime_logfile(self.config, 'aminator')

        self.environment = environment()
Exemple #3
0
    def __init__(self, config=None, parser=None, plugin_manager=PluginManager, environment=Environment, debug=False):
        log.info("Aminator starting...")
        if not all((config, parser)):
            log.debug("Loading default configuration")
            config, parser = init_defaults(debug=debug)
        self.config = config
        self.parser = parser
        log.debug("Configuration loaded")
        self.plugin_manager = plugin_manager(self.config, self.parser)
        log.debug("Plugins loaded")
        self.parser.parse_args()
        log.debug("Args parsed")

        if self.config.logging.aminator.enabled:
            log.debug("Configuring per-package logging")
            configure_datetime_logfile(self.config, "aminator")

        self.environment = environment()
Exemple #4
0
    def _connect(self, **kwargs):
        cloud_config = self._config.plugins[self.full_name]
        context = self._config.context
        self._instance_metadata = get_instance_metadata()
        instance_region = self._instance_metadata['placement']['availability-zone'][:-1]
        region = kwargs.pop('region', context.get('region', cloud_config.get('region', instance_region)))
        log.debug('Establishing connection to region: {0}'.format(region))

        context.cloud.setdefault('boto_debug', False)
        if context.cloud.boto_debug:
            from aminator.config import configure_datetime_logfile
            configure_datetime_logfile(self._config, 'boto')
            kwargs['debug'] = 1
            log.debug('Boto debug logging enabled')
        else:
            logging.getLogger('boto').setLevel(logging.INFO)
        if 'is_secure' not in kwargs:
            kwargs['is_secure'] = context.get('is_secure', cloud_config.get('is_secure', True))
        self._connection = connect_to_region(region, **kwargs)
        log.info('Aminating in region {0}'.format(region))
Exemple #5
0
    def _connect(self, **kwargs):
        cloud_config = self._config.plugins[self.full_name]
        context = self._config.context
        self._instance_metadata = get_instance_metadata()
        instance_region = self._instance_metadata['placement']['availability-zone'][:-1]
        region = kwargs.pop('region', context.get('region', cloud_config.get('region', instance_region)))
        log.debug('Establishing connection to region: {0}'.format(region))

        context.cloud.setdefault('boto_debug', False)
        if context.cloud.boto_debug:
            from aminator.config import configure_datetime_logfile
            configure_datetime_logfile(self._config, 'boto')
            kwargs['debug'] = 1
            log.debug('Boto debug logging enabled')
        else:
            logging.getLogger('boto').setLevel(logging.INFO)
        if 'is_secure' not in kwargs:
            kwargs['is_secure'] = context.get('is_secure', cloud_config.get('is_secure', True))
        self._connection = connect_to_region(region, **kwargs)
        log.info('Aminating in region {0}'.format(region))
Exemple #6
0
    def __init__(self,
                 config=None,
                 parser=None,
                 plugin_manager=PluginManager,
                 environment=Environment,
                 debug=False):
        log.info('Aminator starting...')
        if not all((config, parser)):
            log.debug('Loading default configuration')
            config, parser = init_defaults(debug=debug)
        self.config = config
        self.parser = parser
        log.debug('Configuration loaded')
        self.plugin_manager = plugin_manager(self.config, self.parser)
        log.debug('Plugins loaded')
        self.parser.parse_args()
        log.debug('Args parsed')

        if self.config.logging.aminator.enabled:
            log.debug('Configuring per-package logging')
            configure_datetime_logfile(self.config, 'aminator')

        self.environment = environment()