コード例 #1
0
 def test_factory(self):
     self.assertIsInstance(cache.factory(None), cache.NullCache)
     test_config = Namespace(cache_period=60,
                             cache="test-cloud-custodian.cache")
     self.assertIsInstance(cache.factory(test_config),
                           cache.FileCacheManager)
     test_config.cache = None
     self.assertIsInstance(cache.factory(test_config), cache.NullCache)
コード例 #2
0
ファイル: test_cache.py プロジェクト: kapilt/cloud-custodian
 def test_factory(self):
     self.assertIsInstance(
         cache.factory(None),
         cache.NullCache,
     )
     test_config = Namespace(
         cache_period=60,
         cache='test-cloud-custodian.cache',
     )
     self.assertIsInstance(
         cache.factory(test_config),
         cache.FileCacheManager,
     )
     test_config.cache = None
     self.assertIsInstance(
         cache.factory(test_config),
         cache.NullCache,
     )
コード例 #3
0
ファイル: manager.py プロジェクト: zagaria/cloud-custodian
    def __init__(self, ctx, data):
        self.ctx = ctx
        self.session_factory = ctx.session_factory
        self.config = ctx.options
        self.data = data
        self._cache = cache.factory(self.ctx.options)
        self.log = logging.getLogger('custodian.resources.%s' %
                                     (self.__class__.__name__.lower()))

        if self.filter_registry:
            self.filters = self.filter_registry.parse(
                self.data.get('filters', []), self)
        if self.action_registry:
            self.actions = self.action_registry.parse(
                self.data.get('actions', []), self)
コード例 #4
0
ファイル: manager.py プロジェクト: capitalone/cloud-custodian
    def __init__(self, ctx, data):
        self.ctx = ctx
        self.session_factory = ctx.session_factory
        self.config = ctx.options
        self.data = data
        self._cache = cache.factory(self.ctx.options)
        self.log = logging.getLogger('custodian.resources.%s' % (
            self.__class__.__name__.lower()))

        if self.filter_registry:
            self.filters = self.filter_registry.parse(
                self.data.get('filters', []), self)
        if self.action_registry:
            self.actions = self.action_registry.parse(
                self.data.get('actions', []), self)
コード例 #5
0
 def test_mem_factory(self):
     self.assertEqual(
         cache.factory(config.Bag(cache='memory',
                                  cache_period=5)).__class__,
         cache.InMemoryCache)
コード例 #6
0
 def test_mem_factory(self):
     self.assertEqual(
         cache.factory(config.Bag(cache='memory', cache_period=5)).__class__,
         cache.InMemoryCache)