Skip to content

hishtory: pre-flight remote reachability check with offline fallback (don't abort the run) #28

Description

@jdevera

Found during the fresh-macOS install documented in #20.

Problem

home/.chezmoiscripts/run_once_after_040-setup-hishtory.sh.tmpl chooses between an online install (when .hishtory_server is set) and an offline install. When the configured server can't be reached, the online branch hard-fails and kills the whole chezmoi init --apply:

... failed to register device with backend: ... dial tcp: lookup hishtory.vrt.homes: no such host
✗  Step 1 fatal: could not initializing hishtory
chezmoi: .chezmoiscripts/040-setup-hishtory.sh: exit status 1

and on a later attempt, a server-side status_code=503 during import did the same thing.

Desired behaviour

Before committing to the remote-config branch, verify the remote is actually reachable. If it is, proceed online. If it isn't, fall back to the offline install branch rather than aborting the entire run. The "we couldn't reach the remote, finish hishtory setup later" notice should be recorded via the run-level warnings mechanism (see companion issue) so it surfaces at the end instead of taking everything down.

Also: false "already configured" skip

The idempotency guard is just:

if [[ -f "${HOME}/.hishtory/config.sh" ]]; then
    dot::chezmoi_script_skipped "hishtory is already configured"
fi

After a partial/failed run, config.sh exists but device registration never completed, so a re-run skips with "hishtory is already configured" when it actually isn't. The guard should reflect real configuration state (e.g. registered device / secret key), not just the presence of the config file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bootstrapFresh-machine bootstrap / first-run setup

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions