예제 #1
0
 def dryrun(self):
     # This is largely based off of mugc.main()
     logging.getLogger('botocore').setLevel(logging.ERROR)
     logging.getLogger('urllib3').setLevel(logging.ERROR)
     logging.getLogger('c7n.cache').setLevel(logging.WARNING)
     conf = Config.empty(
         config_files=['custodian_%s.yml' % self.region_name],
         regions=[self.region_name],
         prefix=self.config.function_prefix,
         policy_regex='^' + re.escape(self.config.function_prefix) + '.*',
         assume=None,
         policy_filter=None,
         log_group=None,
         external_id=None,
         cache_period=0,
         cache=None,
         present=False,
         dryrun=True
     )
     # use cloud provider to initialize policies to get region expansion
     policies = AWS().initialize_policies(
         PolicyCollection(
             [
                 p for p in load_policies(conf, conf)
                 if p.provider_name == 'aws'
             ],
             conf
         ),
         conf
     )
     resources_gc_prefix(conf, conf, policies)
예제 #2
0
 def run(self):
     logging.getLogger('botocore').setLevel(logging.ERROR)
     logging.getLogger('c7n.cache').setLevel(logging.WARNING)
     conf = Config.empty(
         config_files=['custodian_%s.yml' % self.region_name],
         region=self.region_name,
         prefix='custodian-',
         assume=None,
         policy_filter=None,
         log_group=None,
         external_id=None,
         cache_period=0,
         cache=None)
     resources.load_resources()
     policies = load_policies(conf)
     resources_gc_prefix(conf, policies)