Split config.changed into changed and new #61

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
1 participant
Owner

johnsca commented Apr 22, 2016

While it can be argued that config values are "changing" from not having
a previous value in the very first hook that's fired, not distinguishing
that from a "real" change (that is, the config had a definite value
previously and has a new definite value now) makes certain constructs
difficult. On the other hand, it is relatively easy to go the other
way using @when_any.

For example:

@when_not('installed')
def install():
    # do install
    set_state('installed')

@when('config.changed.install_source')
def reinstall():
    install()

Without the distinction, install will end up being called twice.

Split config.changed into changed and new
While it can be argued that config values are "changing" from not having
a previous value in the very first hook that's fired, not distinguishing
that from a "real" change (that is, the config had a definite value
previously and has a new definite value now) makes certain constructs
difficult.  On the other hand, it is relatively easy to go the other
way using @when_any.

@johnsca johnsca closed this Nov 14, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment