Skip to content

Feature: profile-level override for rclone Google Drive default OAuth client #4

Description

@CruxExperts

Summary

Add an explicit snapshot-profile option that allows a Google Drive rclone remote to use rclone's default/shared Drive OAuth client when the operator has intentionally chosen to reuse an existing machine-level rclone synchronization setup.

Problem

bbackup currently treats any Google Drive rclone: snapshot profile without a configured client_id as unhealthy:

Google Drive remote ALIEN001-GD has no client_id; configure a dedicated OAuth client before treating this snapshot profile as reliable

That is a good safe default, but it blocks hosts where the same rclone remote is already the configured and monitored Google Drive synchronization surface. On SCAR01, the mounted Google Drive service and the backup profile both use the same working remote:

ALIEN001-GD:

The remote is reachable, mounted, and has a valid token, but no dedicated client_id field. Because the health check is hard-fail only, local snapshot automation refuses to run with:

Refusing to run snapshot profile with critical alerts

Requested behavior

Keep the current safety default, but add an explicit profile-level opt-in such as:

snapshot_profiles:
  essentials-daily:
    repository: rclone:ALIEN001-GD:backups/SCAR01/restic/essentials-daily
    allow_default_rclone_drive_client: true

When this flag is absent or false, preserve the current behavior: Google Drive remotes without client_id fail health checks.

When true, allow the profile health check to pass with a clear message such as:

Google Drive remote ALIEN001-GD uses the default rclone Drive client by explicit profile configuration

Local proof-of-concept

A focused local patch was tested with:

uv run pytest tests/test_snapshot.py -q

Result:

16 passed

The patch shape is small:

  • Add SnapshotProfile.allow_default_rclone_drive_client: bool = False.
  • Parse allow_default_rclone_drive_client from profile config.
  • In _rclone_drive_client_id_check, accept a Drive remote without client_id only when the profile flag is true.
  • Add a regression test proving default rejection remains and explicit opt-in passes.

Rationale

This keeps the conservative default for reliability-sensitive backups while giving operators an auditable way to acknowledge and accept the existing rclone Drive client configuration for a specific profile. The opt-in is profile-local, visible in config review, and avoids weakening health checks globally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions