|
124 | 124 | from ..module_utils.msd.delete_child_fab import childFabricDelete |
125 | 125 | from ..module_utils.msd.add_child_fab import childFabricAdd |
126 | 126 | from ..module_utils.msd.fabric_associations import FabricAssociations |
127 | | -from ..module_utils.fabric.verify_playbook_params import VerifyPlaybookParams |
128 | 127 | from ..module_utils.network.dcnm.dcnm import validate_list_of_dicts |
129 | 128 |
|
| 129 | + |
130 | 130 | @Properties.add_rest_send |
131 | 131 | class childCommon(): |
132 | 132 | """ |
@@ -217,25 +217,19 @@ def verify_child_fabric_is_already_member(self, item) -> bool: |
217 | 217 | if (self.data[fabric]['fabricParent'] == item["destFabric"]): |
218 | 218 | return True |
219 | 219 | return False |
220 | | - |
| 220 | + |
221 | 221 | def validate_input(self): |
222 | | - if self.state != "query": |
223 | | - fab_member_spec = dict( |
224 | | - FABRIC_NAME=dict(required=True, type="str"), |
225 | | - CHILD_FABRIC_NAME=dict(required=True, type="str"), |
226 | | - DEPLOY=dict(type="bool", default=False), |
227 | | - ) |
228 | | - else: |
229 | | - fab_member_spec = dict( |
230 | | - FABRIC_NAME=dict(type="str"), |
231 | | - ) |
| 222 | + method_name = inspect.stack()[0][3] |
| 223 | + fab_member_spec = dict( |
| 224 | + FABRIC_NAME=dict(required=True, type="str"), |
| 225 | + CHILD_FABRIC_NAME=dict(required=True, type="str"), |
| 226 | + DEPLOY=dict(type="bool", default=False), |
| 227 | + ) |
232 | 228 | fab_mem_info, invalid_params = validate_list_of_dicts(self.config, fab_member_spec, None) |
233 | 229 | if invalid_params: |
234 | | - mesg = "Invalid parameters in playbook: {0}".format( |
235 | | - "while processing config " |
236 | | - + "\n".join(invalid_params) |
237 | | - ) |
238 | | - raise ValueError(mesg) |
| 230 | + msg = "Invalid parameters in playbook: {invalid_params}" |
| 231 | + msg += "while processing config \n" |
| 232 | + raise ValueError(msg) |
239 | 233 | for config in self.config: |
240 | 234 | if not isinstance(config, dict): |
241 | 235 | msg = f"{self.class_name}.{method_name}: " |
@@ -389,7 +383,6 @@ def commit(self) -> None: |
389 | 383 |
|
390 | 384 | msg = f"ENTERED: {self.class_name}.{method_name}" |
391 | 385 | self.log.debug(msg) |
392 | | - |
393 | 386 | self.validate_input() |
394 | 387 | self.get_want() |
395 | 388 |
|
@@ -482,7 +475,7 @@ def commit(self) -> None: |
482 | 475 | msg = f"ENTERED: {self.class_name}.{method_name}" |
483 | 476 | self.log.debug(msg) |
484 | 477 | self.get_controller_version() |
485 | | - ### Version validation needs to be added |
| 478 | + # Version validation needs to be added |
486 | 479 | self.validate_input() |
487 | 480 | self.get_want() |
488 | 481 |
|
|
0 commit comments