Esempio n. 1
0
 def process(self, resources, event=None):
     self.tag = self.data.get('tag', DEFAULT_TAG)
     self.op = self.data.get('op', 'stop')
     self.skew = self.data.get('skew', 0)
     self.skew_hours = self.data.get('skew_hours', 0)
     self.tz = Time.get_tz(self.data.get('tz', 'utc'))
     return super(TagActionFilter, self).process(resources, event)
    def test_timezone_in_datestring(self):
        tz = Time.get_tz('America/Santiago')
        date = (now(tz) -
                datetime.timedelta(hours=1)).strftime('%Y/%m/%d %H%M %Z')
        resources = [
            tools.get_resource(
                {'custodian_status': 'TTL: stop@{0}'.format(date)})
        ]

        self._test_filter_scenario(resources, 1)
Esempio n. 3
0
    def validate(self):
        op = self.data.get('op')
        if self.manager and op not in self.manager.action_registry.keys():
            raise PolicyValidationError("Invalid marked-for-op op:%s in %s" %
                                        (op, self.manager.data))

        tz = Time.get_tz(self.data.get('tz', 'utc'))
        if not tz:
            raise PolicyValidationError(
                "Invalid timezone specified '%s' in %s" %
                (self.data.get('tz'), self.manager.data))
        return self