Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Add CLI commands to access snapshot functionality #870

Merged
merged 4 commits into from
Dec 3, 2020
Merged

Conversation

evanphx
Copy link
Contributor

@evanphx evanphx commented Dec 2, 2020

This adds access to the snapshot API functionality. It supports reading and writing to and from files, as well as standard input and output.

Closes #682

As we don't yet have a CLI testing framework, I've included the output from adhoc testing here for review:

~/hc-git/waypoint f-snapshot-cli*
❯ ./waypoint server snapshot
failed to open output: stdout is a terminal, refusing to pollute (use '-' to force)

~/hc-git/waypoint f-snapshot-cli* 36s
❯ ./waypoint server snapshot out1.snap
Snapshot written to 'out1.snap'

~/hc-git/waypoint f-snapshot-cli*
❯ less out1.snap
"out1.snap" may be a binary file.  See it anyway?

~/hc-git/waypoint f-snapshot-cli*
❯ ./waypoint server snapshot > out2.snap

~/hc-git/waypoint f-snapshot-cli*
❯ shasum out1.snap
cc4fd6cdc75e3da5f51f5664a310a75814052d34  out1.snap

~/hc-git/waypoint f-snapshot-cli*
❯ shasum out2.snap
cc4fd6cdc75e3da5f51f5664a310a75814052d34  out2.snap

~/hc-git/waypoint f-snapshot-cli*
❯ ./waypoint server restore out1.snap
Server data restored from 'out1.snap'.

~/hc-git/waypoint f-snapshot-cli*
❯ ./waypoint server restore
failed to open output: stdin is a terminal, refusing to use (use '-' to force)

~/hc-git/waypoint f-snapshot-cli*
❯ ./waypoint server restore < out1.snap
Server data restored.

Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

Looks super good. Some wording comments and then suggesting supporting -exit

internal/cli/snapshot_restore.go Outdated Show resolved Hide resolved
Copy link
Member

@briancain briancain left a comment

Choose a reason for hiding this comment

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

Looks good to me! 👍 I found a typo in the help text so requesting changes.

internal/cli/snapshot_restore.go Outdated Show resolved Hide resolved
Copy link
Member

@briancain briancain left a comment

Choose a reason for hiding this comment

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

🎉

@evanphx evanphx merged commit f3cca39 into main Dec 3, 2020
@evanphx evanphx deleted the f-snapshot-cli branch December 3, 2020 23:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server Snapshot/Restore
3 participants