Skip to content

Add backup / restore admin commands - #747

Draft
thebentern wants to merge 8 commits into
masterfrom
backup-commands
Draft

Add backup / restore admin commands#747
thebentern wants to merge 8 commits into
masterfrom
backup-commands

Conversation

@thebentern

Copy link
Copy Markdown
Contributor

No description provided.

Comment threadpyproject.toml Outdated

@ianmcorvidaeianmcorvidae left a comment

Copy link
Copy Markdown
Contributor

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

Comment threadmeshtastic/node.py
Comment threadmeshtastic/node.py Outdated
Comment threadmeshtastic/__main__.py Outdated
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
Copy Markdown
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:

defbackup_location(string):
try:
returnint(string)
exceptValueError:
returnadmin_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
Copy Markdown
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
@garthvh
garthvh requested a review from CopilotMay 20, 2025 16:56

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds new admin commands to backup, restore, and remove preference backups, along with updating the project version.

  • Updated version in pyproject.toml.
  • Added backupPreferences, restorePreferences, and removePreferencesBackups methods in meshtastic/node.py.
  • Updated main.py to support new admin commands via argparse.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

FileDescription
pyproject.tomlVersion bump to 2.6.0a1 supporting new features.
meshtastic/node.pyIntroduced new admin commands for backup/restore actions.
meshtastic/main.pyExtended the CLI with new arguments for backup operations.


group.add_argument(
"--restore-prefs",
help="Tell the destination node to remove backup preferences files."

CopilotAIMay 20, 2025

Copy link

Choose a reason for hiding this comment

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

The help message for --restore-prefs is incorrect; it should describe restoring preferences rather than removing backup files. Consider changing it to something like "Tell the destination node to restore preferences from backup. Location: 0 for local flash, 1 for SD card."

Suggested change
help="Tell the destination node to remove backup preferences files."
help="Tell the destination node to restore preferences from a backup."

Copilot uses AI. Check for mistakes.
Sign up for freeto 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.

3 participants

@thebentern@ianmcorvidae