diff --git a/bodhi-server/bodhi/server/models.py b/bodhi-server/bodhi/server/models.py index 34c40d76b3..a38839e6a3 100644 --- a/bodhi-server/bodhi/server/models.py +++ b/bodhi-server/bodhi/server/models.py @@ -3830,22 +3830,16 @@ def check_karma_thresholds(self, db, agent): text = config.get('disable_automatic_push_to_stable') self.comment(db, text, author='bodhi') elif self.stable_karma and self.karma >= self.stable_karma \ - and self.release.composed_by_bodhi: + and self.release.composed_by_bodhi and self.autokarma: if config.get('test_gating.required') and not self.test_gating_passed: log.info("%s reached stable karma threshold, but does not meet gating " "requirements", self.alias) return self.date_approved = datetime.utcnow() - if self.autokarma: - log.info("Automatically marking %s as stable", self.alias) - self.set_request(db, UpdateRequest.stable, agent) - notifications.publish(update_schemas.UpdateKarmaThresholdV1.from_dict( - dict(update=self, status='stable'))) - else: - # Add the stable approval message now - log.info(( - "%s update has reached the stable karma threshold and can be pushed to " - "stable now if the maintainer wishes"), self.alias) + log.info("Automatically marking %s as stable", self.alias) + self.set_request(db, UpdateRequest.stable, agent) + notifications.publish(update_schemas.UpdateKarmaThresholdV1.from_dict( + dict(update=self, status='stable'))) elif self.unstable_karma and self.karma <= self.unstable_karma: log.info("Automatically obsoleting %s (reached unstable karma threshold)", self.alias) self.obsolete(db) diff --git a/bodhi-server/tests/services/test_updates.py b/bodhi-server/tests/services/test_updates.py index a4d533b4bf..ab270c3441 100644 --- a/bodhi-server/tests/services/test_updates.py +++ b/bodhi-server/tests/services/test_updates.py @@ -4890,9 +4890,6 @@ def test_autopush_reached_main(self, autokarma, cbb, critpath, status): up.status = status msgs = self._reach_autopush_threshold(up) - # we always set date_approved if release is composed by bodhi - assert bool(up.date_approved) is cbb - if (cbb and autokarma): # we should have autopushed assert up.request is UpdateRequest.stable @@ -4912,6 +4909,7 @@ def test_autopush_reached_main(self, autokarma, cbb, critpath, status): {'comment': up['comments'][-2], 'agent': 'bowlofeggs'} ) ] + assert up.date_approved is not None else: # we should not assert up.request is None @@ -4922,6 +4920,7 @@ def test_autopush_reached_main(self, autokarma, cbb, critpath, status): {'comment': up['comments'][-1], 'agent': 'bowlofeggs'} ) ] + assert up.date_approved is None def test_autopush_reached_obsolete(self): """Autopush should not happen if it otherwise would, but the update is obsolete."""