diff --git a/shuffle-tools/1.2.0/src/app.py b/shuffle-tools/1.2.0/src/app.py index a2e0b62a..a03d2447 100644 --- a/shuffle-tools/1.2.0/src/app.py +++ b/shuffle-tools/1.2.0/src/app.py @@ -2788,7 +2788,11 @@ def list_cidr_ips(self, cidr): return returnvalue - def if_else_routing(self, conditions): + def switch(self, conditions): + # Check if conditions is a list or not + if not isinstance(conditions, list): + conditions = [conditions] + # True by default to_return = { "success": True, diff --git a/shuffle-tools/1.2.0/src/switch.py b/shuffle-tools/1.2.0/src/switch.py index 5d413a9a..78ede505 100644 --- a/shuffle-tools/1.2.0/src/switch.py +++ b/shuffle-tools/1.2.0/src/switch.py @@ -1,5 +1,5 @@ # self, sourcevalue, condition, destinationvalue -def run_validation(sourcevalue, check, destinationvalue): +def validate_condition(sourcevalue, check, destinationvalue): if check == "=" or check == "==" or check.lower() == "equals": if str(sourcevalue).lower() == str(destinationvalue).lower(): return True @@ -113,7 +113,7 @@ def evaluate_conditions(condition_structure): destination = condition_structure['destination'] # self. - return run_validation(source, condition, destination) + return validate_condition(source, condition, destination) # Recursive case: Logical operator elif operator == "AND":