예제 #1
0
    def run(self):
        """
        Perform an actual run of cloud-custodian.

        This replicates the command:
        custodian run --region '${region}' --metrics -v -s \
          cloud-custodian-${account_id}-${region}/logs \
          --log-group=/cloud-custodian/${account_id}/${region} \
          -c custodian_${region}.yml \
          --cache '/tmp/.cache/cloud-custodian.cache'
        """
        conf = Config.empty(
            configs=['custodian_%s.yml' % self.region_name],
            region=self.region_name,
            regions=[self.region_name],
            log_group=self.config.custodian_log_group,
            verbose=1,
            metrics_enabled=True,
            subparser='run',
            cache='/tmp/.cache/cloud-custodian.cache',
            command='c7n.commands.run',
            output_dir='%s/logs' % self.config.output_s3_bucket_name,
            vars=None,
            dryrun=False
        )
        run(conf)
예제 #2
0
    def dryrun(self):
        """
        Perform a dry-run of custodian.

        This replicates the command:

        custodian run --region '${region}' --dryrun -v -s dryrun/${region} \
          -c custodian_${region}.yml \
          --cache '/tmp/.cache/cloud-custodian.cache'
        """
        conf = Config.empty(configs=['custodian_%s.yml' % self.region_name],
                            region=self.region_name,
                            regions=[self.region_name],
                            verbose=1,
                            metrics_enabled=False,
                            subparser='run',
                            cache='/tmp/.cache/cloud-custodian.cache',
                            command='c7n.commands.run',
                            output_dir='dryrun/%s' % self.region_name,
                            vars=None,
                            dryrun=True)
        run(conf)