Skip to content

promise: Introduce GenericPromise.allowBang()

Alternative to https://lab.nexedi.com/nexedi/slapos.core/-/merge_requests/785

Intended to be used in promise implementations like this:

@implementer(interface.IPromise)
class RunPromise(GenericPromise):
  def __init__(self, config):
    super(RunPromise, self).__init__(config)
    self.allowBang(False)

  def sense(self):
    # ...

  def anomaly(self):
    # no need to return TestResult to avoid calling bang
    # ...

Further, promise configuration in buildout like this

[promise]
...
config-bang-on-failure = false

is propagated directly to GenericPromise.allowBang(), independently of the specific promise implementation. The promise remains free to override this with an explicit allowBang() after the call to GenericPromise.__init__().

Edited by Xavier Thompson

Merge request reports