Skip to content

Conversation

@johnsca
Copy link
Contributor

@johnsca 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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant