예제 #1
0
    def _calc_purge_before(self):
        """Calculates time after which manifests should be purged."""

        if self.args.purge_before:
            return dt_util.parse_date_input(self.args.purge_before)

        assert (self.args.keep_days or -1) > 0
        return dt_util.now() - datetime.timedelta(self.args.keep_days)
예제 #2
0
 def _calc_purge_before(self):
     """Calculates time after which manifests should be purged."""
     
     if self.args.purge_before:
         return dt_util.parse_date_input(self.args.purge_before)
     
     assert (self.args.keep_days or -1) > 0
     return dt_util.now() - datetime.timedelta(self.args.keep_days)
예제 #3
0
    def _manifest_days(self, purge_before):
        """Returns a list of backup days we want to read the manifest for.
        These are the days we potentially want to keep.

        """

        # Normalise the purge_before to be a whole day.
        from_day = datetime.datetime(purge_before.year, purge_before.month,
                                     purge_before.day)
        now = dt_util.now()
        to_day = datetime.datetime(now.year, now.month, now.day)

        assert from_day <= to_day
        diff = to_day - from_day

        return [from_day + datetime.timedelta(d) for d in range(diff.days + 1)]
예제 #4
0
 def _manifest_days(self, purge_before):
     """Returns a list of backup days we want to read the manifest for. 
     These are the days we potentially want to keep.
     
     """
     
     # Normalise the purge_before to be a whole day. 
     from_day = datetime.datetime(purge_before.year, purge_before.month, 
         purge_before.day)
     now = dt_util.now()
     to_day = datetime.datetime(now.year, now.month, now.day)
     
     assert from_day <= to_day
     diff = to_day - from_day
     
     return [
         from_day + datetime.timedelta(d)
         for d in range(diff.days + 1)
     ]