Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow variables plugin to replace arbitrary sections of config #2222

Merged
merged 2 commits into from Oct 11, 2018

Conversation

gazpachoking
Copy link
Member

@gazpachoking gazpachoking commented Oct 11, 2018

Motivation for changes:

Variables plugin could not be used for anything except for string fields in config (or parts of string fields.)

Detailed changes:

  • Allows variables plugin to replace complex bits of config, like numbers, lists, ore whole dictionaries.
  • Allows variables to be defined directly in the main config.

Addressed issues:

Config usage if relevant (new plugin or updated schema):

variables:
  mock_entry_list:
  - title: a
  - title: b
  integer: 2
tasks:
  test_int_var:
    limit_new: "{? integer ?}"
  test_var_mock:
    mock: "{? mock_entry_list ?}"

To Do:

  • Update upgrade actions. Users that were relying on the string conversion will have to add some quotes to achieve old behavior.
  • Make sure there aren't any other side effects. (adding extra quotes in replacement should guarantee old behavior, as noted in upgrade actions)

@liiight
Copy link
Member

liiight commented Oct 11, 2018

So you can basically use this now instead of yaml anchors ?
Also you had that native environment idea back in the day, would that fit this PR as well?

@gazpachoking
Copy link
Member Author

gazpachoking commented Oct 11, 2018

So you can basically use this now instead of yaml anchors ?

Yeah, I think. Can't do any of the anchor dict merging stuff though.

Also you had that native environment idea back in the day, would that fit this PR as well?

This is that idea. 😉 It turns out it can do more than I thought.

@liiight
Copy link
Member

liiight commented Oct 11, 2018

This is that idea. 😉 It turns out it can do more than I thought.

Cool 😄

@gazpachoking gazpachoking merged commit f462bb7 into develop Oct 11, 2018
@gazpachoking gazpachoking deleted the native_variables branch January 28, 2019 17:50
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.

Cannot use variables with integer-only values
2 participants