This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prune_empty(items): | |
return list(filter(None, items)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config = { | |
"foo": "bar", | |
"biz": "baz", | |
"stuff": prune_empty([ | |
"a", | |
Include.when("site-x" in ["site-a", "site-b", "site-c"], "b"), | |
"c", | |
"d" | |
]) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config = { | |
"foo": "bar", | |
"db_backend": Include.when(env("SITE") in ["site-a", "site-b", "site-c"], "10.2.3.4", "10.6.3.4"), | |
"biz": "baz", | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config = { | |
"foo": "bar", | |
"biz": "baz" | |
} | Include.when("site-x" in ["site-a", "site-b", "site-c"], { | |
"enable_x": True | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Include(object): | |
@staticmethod | |
def when(expression, if_block, else_block={}): | |
return if_block if expression else else_block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"foo": "bar", | |
if env in ["site-a", "site-b", "site-b"]: | |
"enable_x": true, | |
"biz": "baz" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo: bar | |
#@ if data.values.environment in ['site-a', 'site-b', 'site-c']: | |
enable_x: true | |
#@ end | |
biz: baz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
# Non-Looped elements | |
] + [ | |
{ | |
"foo": item | |
} for item in [ | |
"x", "y", "z" | |
] | |
] + [ | |
# Non-Looped elements |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jobs: | |
- name: create-orgs | |
plan: | |
... | |
- task: create-orgs | |
image: cf-mgmt | |
config: | |
... | |
params: | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"jobs": [ | |
{ | |
"name": cf_mgmt_command, | |
"plan": [ | |
... | |
{ | |
"task": cf_mgmt_command, | |
"image": "cf-mgmt", | |
"config": { | |
... |