in src/modules/location_constraints.py [0:0]
def run_module() -> None:
"""
Entry point of the module.
Sets up and runs the location constraints module with the specified arguments.
"""
module_args = dict(
action=dict(type="str", required=True),
ansible_os_family=dict(type="str", required=True),
)
module = AnsibleModule(argument_spec=module_args, supports_check_mode=True)
action = module.params["action"]
ansible_os_family = module.params["ansible_os_family"]
manager = LocationConstraintsManager(ansible_os_family)
if module.check_mode:
module.exit_json(**manager.get_result())
location_constraints = manager.location_constraints_exists()
if location_constraints and action == "remove":
manager.remove_location_constraints(location_constraints)
manager.result.update(
{
"message": "Location constraints removed",
"location_constraint_removed": True,
"status": TestStatus.SUCCESS.value,
}
)
else:
manager.result.update(
{
"status": TestStatus.INFO.value,
"message": "Location constraints do not exist or were already removed.",
}
)
module.exit_json(**manager.get_result())