Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add backup / restore admin commands #747

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft

Conversation

thebentern
Copy link
Contributor

No description provided.

Copy link
Contributor

@ianmcorvidae ianmcorvidae left a comment

Choose a reason for hiding this comment

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

A couple small things, mostly seems good to me though

group.add_argument(
"--backup-prefs",
help="Tell the destination node to create a backup preferences file."
"Location: 0 for local flash, 1 for SD card.",
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be nice if we allow people to pass FLASH and SD here. I think we could do that by trying to parse as an int, and if it fails, throw it at something like admin_pb2.AdminMessage.BackupLocation.__getattr__('FLASH') to convert.

I think this could be done by adding a helper function and passing it as type to these add_argument calls:

def backup_location(string):
    try:
        return int(string)
    except ValueError:
        return admin_pb2.AdminMessage.BackupLocation.__getattr__(string)

I'm a bit tired so hopefully I'm relaying this properly, heh.

Comment on lines +1817 to +1819
default=admin_pb2.AdminMessage.BackupLocation.FLASH,
nargs="?",
const=0,
Copy link
Contributor

Choose a reason for hiding this comment

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

You probably want default to stay None (that's what's passed if the argument isn't passed on the command line at all) and to set the admin_pb2.<...> value as const (which is what's passed if the argument is passed bare, without a real value).

@thebentern thebentern marked this pull request as draft March 10, 2025 23:11
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