Unassigning a schedule from a task using python-gvm

Hey guys,

is there a way to programmatically unassign an existing schedule from an existing task using that schedule? gmp.modify_task(task_id=id, schedule_id=schedule) allows to assign a schedule to a task without issues, but I also need a way to remove this association and delete the schedule afterwards.

I already tried to use an empty string, like gmp.modify_task(task_id=id, schedule_id=""), but this just seems to be ignored, probably because it gets treated the same as None.

Any help would be highly appreciated. I’m using python-gvm 20.9.0 and GOS 20.08.4 on our GSM-CENO virtual appliance.

All the best,

Jonas

It seems, that this is currently not working with python-gvm. I will fix this asap. Thank you for figuring this out!

2 Likes

I have added an Issue, if you want to follow up: https://github.com/greenbone/python-gvm/issues/303

2 Likes

Awesome! Thanks a lot…

Sadly we did not think about this properly in the first stage.
It is already possible to unassign an existing schedule from an task (that is not in use!)
You just need to pass the scheudle_id="0" to the function.

gmp.modify_task(task_id=id, schedule_id="0")

Sorry for the late flash of thought.

2 Likes

Thank you, works flawlessly indeed… :slight_smile:

Greetings from Germany,

Jonas

1 Like