-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing up volumes mounts when using hosts
- Loading branch information
1 parent
376569d
commit 32b7022
Showing
4 changed files
with
91 additions
and
74 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# SPDX-License-Identifier: MPL-2.0 | ||
# Copyright 2020-2022 John Mille <[email protected]> | ||
|
||
from compose_x_common.compose_x_common import keyisset | ||
from compose_x_common.compose_x_common import keyisset, set_else_none | ||
from troposphere import NoValue | ||
|
||
|
||
|
@@ -20,26 +20,25 @@ def evaluate_plugin_efs_properties(definition, driver_opts_key): | |
), | ||
} | ||
props = {} | ||
if keyisset(driver_opts_key, definition) and isinstance( | ||
definition[driver_opts_key], dict | ||
): | ||
opts = definition[driver_opts_key] | ||
if keyisset("lifecycle_policy", opts) and isinstance( | ||
opts["lifecycle_policy"], str | ||
): | ||
props["LifecyclePolicies"] = [{"TransitionToIA": opts["lifecycle_policy"]}] | ||
if keyisset("backup_policy", opts) and isinstance(opts["backup_policy"], str): | ||
props["BackupPolicy"] = {"Status": opts["backup_policy"]} | ||
for name, config in efs_keys.items(): | ||
if not keyisset(name, opts): | ||
props[config[0]] = NoValue | ||
elif not isinstance(opts[name], config[1]): | ||
raise TypeError( | ||
f"Property {name} is of type", | ||
type(opts[name]), | ||
"Expected", | ||
config[1], | ||
) | ||
else: | ||
props[config[0]] = opts[name] | ||
opts = set_else_none(driver_opts_key, definition, {}) | ||
if not opts: | ||
return props | ||
lifecycle_policy = set_else_none("lifecycle_policy", opts) | ||
backup_policy = set_else_none("backup_policy", opts) | ||
if lifecycle_policy: | ||
props["LifecyclePolicies"] = [{"TransitionToIA": lifecycle_policy}] | ||
if backup_policy: | ||
props["BackupPolicy"] = {"Status": backup_policy} | ||
for name, config in efs_keys.items(): | ||
if not keyisset(name, opts): | ||
props[config[0]] = NoValue | ||
elif not isinstance(opts[name], config[1]): | ||
raise TypeError( | ||
f"Property {name} is of type", | ||
type(opts[name]), | ||
"Expected", | ||
config[1], | ||
) | ||
else: | ||
props[config[0]] = opts[name] | ||
return props |
This file contains 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