Skip to content

Commit 351b5c0

Browse files
Minor fixes for undefined attributes at profile model for version setup < 3.3.0.
1 parent 7ea5982 commit 351b5c0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

calm/dsl/builtins/models/profile.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,18 @@ def get_config_action_name(config, config_type):
114114
r"[^A-Za-z0-9-_]+", "_", suffix
115115
)
116116

117-
if cdict["restore_config_list"] and not cdict["snapshot_config_list"]:
117+
if cdict.get("restore_config_list") and not cdict.get("snapshot_config_list"):
118118
LOG.error(
119119
"No RestoreConfig found. Please add/associate a RestoreConfig with the SnapshotConfig(s)."
120120
)
121121
sys.exit("Missing snapshot configs")
122122

123-
if cdict["snapshot_config_list"] and not cdict["restore_config_list"]:
123+
if cdict.get("snapshot_config_list") and not cdict.get("restore_config_list"):
124124
LOG.error(
125125
"No snapshot config found. Cannot use RestoreConfig without a SnapshotConfig."
126126
)
127127
sys.exit("Missing restore configs")
128-
for config in cdict["patch_list"]:
128+
for config in cdict.get("patch_list", []):
129129
if not isinstance(config, PatchConfigSpecType):
130130
LOG.error(
131131
"{} is not an object of PatchConfig. patch_config is an array of PatchConfig objects".format(
@@ -135,7 +135,7 @@ def get_config_action_name(config, config_type):
135135
sys.exit("{} is not an instance of PatchConfig".format(config))
136136
config = set_config_type_based_on_target(config, "patch")
137137

138-
for config in cdict["restore_config_list"]:
138+
for config in cdict.get("restore_config_list", []):
139139
if not isinstance(config, RestoreConfigSpecType):
140140
LOG.error(
141141
"{} is not an object of RestoreConfig. restore_configs is an array of AppProtection.RestoreConfig objects".format(
@@ -149,7 +149,7 @@ def get_config_action_name(config, config_type):
149149
if config_action:
150150
cdict["action_list"].append(config_action)
151151

152-
for config in cdict["snapshot_config_list"]:
152+
for config in cdict.get("snapshot_config_list", []):
153153
if not isinstance(config, SnapshotConfigSpecType):
154154
LOG.error(
155155
"{} is not an object of SnapshotConfig. snapshot_configs is an array of AppProtection.SnapshotConfig objects".format(

0 commit comments

Comments
 (0)