Skip to content

Add scheduled repair.deletion#43

Merged
joaquincasares merged 5 commits intoadd_scheduled_repairfrom
add_scheduled_repair.deletion
Dec 9, 2025
Merged

Add scheduled repair.deletion#43
joaquincasares merged 5 commits intoadd_scheduled_repairfrom
add_scheduled_repair.deletion

Conversation

@joaquincasares
Copy link
Contributor

@joaquincasares joaquincasares commented Dec 9, 2025

Fix a few issues with #42.

If everything looks good, please merge this into #42 , then squash #42 into master, and update the client.

scheduled_repair.remove_old_repairs_from_axonops()
if args.deleteall:
scheduled_repair.remove_all_repairs_from_axonops()
return
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked this functionality, especially for testing purposes, but if we were creating one scheduled repair at a time, we would always delete all previously scheduled repairs. Instead, I put it behind a parameter flag.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks very good

)
if not response:
if self.args.v:
print("Getting scheduled repair with tag:", self.args.tags)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was never done since GET doesn't support filtering by tags.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point

else:
if self.args.v:
print("No tag provided, this will be threaded as a new scheduled repair")
print("No scheduled repairs found")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have found adaptive repairs, but we're not looking at those.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, only the scheduled is needed here

elif 'ScheduledRepairs' in response and response['ScheduledRepairs']:
for repair in response['ScheduledRepairs']:
if self.args.tags != repair['Params'][0]['tag']:
continue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We filter out here to delete one tagged schedule repair at a time.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing scheduled repair mixed with tags and without. I had an error while deleting a tag:

$  pipenv run python axonops.py -v scheduledrepair --delete --tags asd
[...]
  File "/home/marionugnes/git/axonops-ansible-collection/cli/axonopscli/application.py", line 218, in run_scheduled_repair
    scheduled_repair.set_repair()
  File "/home/marionugnes/git/axonops-ansible-collection/cli/axonopscli/components/scheduled_repair.py", line 108, in set_repair
    if self.args.tags != repair['Params'][0]['tag']:
                         ~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: 'tag'

I added a little if to check this case.

else:
if self.args.v:
print("Tags are always required for deletions")
raise
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double check what our parser logic does.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorted

@@ -101,8 +94,30 @@ def set_repair(self):
print("POST", self.full_add_repair_url, self.repair_data)

if self.args.delete:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We lost the ability to modify only a schedule with the same tag, instead of creating two separate schedules. Seeing if I can fix it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sorted now

@joaquincasares joaquincasares merged commit 42893b8 into add_scheduled_repair Dec 9, 2025
@joaquincasares joaquincasares deleted the add_scheduled_repair.deletion branch December 9, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants