Michael Eischer
82ca0030b7
forget: test --unsafe-allow-remove-all and --keep-tags safety check
2024-05-24 20:45:33 +02:00
Michael Eischer
57f9739573
forget: Add --unsafe-allow-remove-all option
...
To prevent accidentally wiping all snapshots from a repository, that
option can only be used if either a snapshot filter or a keep policy is
specified.
Essentially, the option allows `forget --tag something
--unsafe-allow-remove-all` calls to remove all snapshots with a specific
tag.
2024-05-24 20:45:33 +02:00
Michael Eischer
5b7952e426
forget: return error if no policy was specified
2024-05-24 20:45:33 +02:00
Michael Eischer
c0e1f36830
forget: refuse deleting the last snapshot in a snapshot group
...
`--keep-tag invalid-tag` was previously able to wipe all snapshots in a
repository. As a user specified a `--keep-*` option this is likely
unintentional. This forbid deleting all snapshot if a `--keep-*` option
was specified to prevent data loss. (Not specifying such an option
currently also causes the command to abort)
2024-05-24 20:45:33 +02:00
Michael Eischer
a60ee9b764
retry: limit retries based on elapsed time not count
...
Depending on how long an operation takes to fail, the total retry
duration can currently vary between 1.5 and 15 minutes. In particular
for temporarily interrupted network connections, the former timeout is
too short. Thus always use a limit of 15 minutes.
2024-05-24 20:24:02 +02:00
Michael Eischer
a3633cad9e
retry: explicitly log failed requests
...
This simplifies finding the request in the log output that cause an
operation to fail.
2024-05-24 20:24:02 +02:00
greatroar
66d03c797e
ui, termstatus: Move WrapStdio
...
Saves some imports. ui still needs to import ui/termstatus from
message.go.
2024-05-21 11:25:16 +02:00
greatroar
0b56214473
ui: Simplify stdio wrapper
...
The StdioWrapper type is really just a pair of io.WriteClosers, so
remove it in favor of a function that returns two of those. Test
coverage increases because the removed code was not tested.
2024-05-21 11:23:32 +02:00
Michael Eischer
94e863885c
check: move verification of individual pack file to repository
2024-05-18 21:42:50 +02:00
Michael Eischer
ab9077bc13
replace usages of backend.Remove() with repository.RemoveUnpacked()
...
RemoveUnpacked will eventually block removal of all filetypes other than
snapshots. However, getting there requires a major refactor to provide
some components with privileged access.
2024-05-18 21:38:31 +02:00
Michael Eischer
8274f5b101
prune: remove Backend.IsNotExist()
...
Only handling one specific error is not particularly useful.
2024-05-18 21:38:31 +02:00
Michael Eischer
9795198189
debug: remove Backend.Stat() usage
2024-05-18 21:38:31 +02:00
Michael Eischer
8cce06d915
repair packs: drop experimental warning
...
This warning should already have been removed once the feature flag was
dropped.
2024-05-18 21:28:54 +02:00
Michael Eischer
779c8d3527
debug/repair packs/upgrade repo v2: use repository.LoadRaw
...
This replaces calling the low-level backend.Load() method.
2024-05-18 21:26:00 +02:00
Michael Eischer
1d6d3656b0
repository: move backend.LoadAll to repository.LoadRaw
...
LoadRaw also includes improved context cancellation handling similar to the
implementation in repository.LoadUnpacked.
The removed cache backend test will be added again later on.
2024-05-18 21:26:00 +02:00
DRON-666
88c509e3e9
vss: Change ErrorHandler
signature
...
We don't need `error` here: the only existing implementation
of `ErrorHandler` always call `Backup.Error` and all
implementations of `Backup.Error` always return nil.
2024-04-28 22:44:16 +03:00
DRON-666
78dbc5ec58
vss: Add initial support for extended options
2024-04-28 22:44:15 +03:00
Michael Eischer
347e9d0765
complete RESITC_HOST environment handling & test
2024-04-24 21:52:39 +02:00
Altan Orhon
871ea1eaf3
Add support for specifying --host via environment variable
...
This commit adds support for specifying the `--host` option via the `RESTIC_HOST` environment variable. This is done by extending option processing in `cmd_backup.go` and for `restic.SnapshotFilter` in `find.go`.
2024-04-24 21:49:42 +02:00
Michael Eischer
a7b5e09902
Merge pull request #4753 from MichaelEischer/remove-cleanup-handlers
...
Replace cleanup handlers with context based command cancelation
2024-04-24 21:34:19 +02:00
Michael Eischer
3f9d50865d
Merge pull request #4776 from MichaelEischer/cleanup-backend-open
...
unify backend open and create
2024-04-24 21:24:27 +02:00
Michael Eischer
5f263752d7
init: also apply limiter for non-HTTP backend
2024-04-24 20:42:30 +02:00
Michael Eischer
484dbb1cf4
get rid of a few global variables
2024-04-22 22:39:33 +02:00
Michael Eischer
940a3159b5
let index.Each() and pack.Size() return error on canceled context
...
This forces a caller to actually check that the function did complete.
2024-04-22 22:39:32 +02:00
Michael Eischer
31624aeffd
Improve command shutdown on context cancellation
2024-04-22 22:31:38 +02:00
Michael Eischer
910927670f
mount: fix exit code on cancellation
2024-04-22 22:27:19 +02:00
Michael Eischer
6f2a4dea21
remove global shutdown hook
2024-04-22 22:27:19 +02:00
Michael Eischer
699ef5e9de
debug: replace cleanup handler usage in profiling setup
2024-04-22 22:27:19 +02:00
Michael Eischer
eb710a28e8
use standalone shutdown hook for readPasswordTerminal
...
move terminal restoration into readPasswordTerminal
2024-04-22 22:27:19 +02:00
Michael Eischer
86c7909f41
mount: use standalone shutdown hook via goroutine
2024-04-22 22:27:19 +02:00
Michael Eischer
93135dc705
lock: drop cleanup handler
2024-04-22 22:27:19 +02:00
Michael Eischer
21a7cb405c
check: replace cleanup handler
2024-04-22 22:27:19 +02:00
Michael Eischer
b15d867414
Merge pull request #4763 from MichaelEischer/refactor-prune
...
Refactor repair index / prune into the repository package
2024-04-22 22:24:53 +02:00
Michael Eischer
6c6dceade3
global: unify backend open and create
2024-04-19 22:26:14 +02:00
will-ca
6aced61c72
Tiny docs wording clarification.
2024-04-18 07:29:55 +00:00
Michael Eischer
001bb71676
repair packs: Properly close backup files
2024-04-17 18:32:30 +02:00
Michael Eischer
c9191ea72c
forget: cleanup verbose output on snapshot deletion error
2024-04-14 14:17:40 +02:00
Michael Eischer
d8622c86eb
prune: clean up internal interface
2024-04-14 13:45:15 +02:00
Michael Eischer
85e4021619
prune: move additional option checks to repository
2024-04-14 13:44:58 +02:00
Michael Eischer
55d56db31b
Merge pull request #4743 from MichaelEischer/deprecate-s3legacy-layout
...
Deprecate s3legacy layout
2024-04-11 22:09:34 +02:00
Michael Eischer
fc3b548625
prune: move logic into repository package
2024-04-10 21:30:52 +02:00
Michael Eischer
df9d4b455d
prune: prepare for moving code to repository package
2024-04-10 21:30:52 +02:00
Michael Eischer
866ddf5698
repair index: refactor code into repository package
2024-04-10 21:30:52 +02:00
Michael Eischer
32a234b67e
prune/forget/repair index: convert output to use progress.Printer
2024-04-10 21:30:52 +02:00
Michael Eischer
739d11c2eb
forget: replace usage of DeleteFilesChecked
...
This simplifies refactoring prune into the repository package.
2024-04-10 21:30:52 +02:00
Michael Eischer
591b421c4a
Deprecate s3legacy layout
2024-04-10 21:27:56 +02:00
Michael Eischer
9fb017e67a
Merge pull request #4745 from MichaelEischer/full-id-key-list
...
key list: include full key id in JSON output
2024-04-03 21:50:02 +02:00
Michael Eischer
49f98f25fc
Merge pull request #4742 from MichaelEischer/consistent-rtest-import
...
Use consistent alias for interal/test package
2024-04-03 21:47:32 +02:00
Michael Eischer
5145c8f9c0
key list: include full key id in JSON output
2024-03-31 12:25:20 +02:00
Stephan Paul
df07814ec2
forget json output: added id's in snapshots within reasons object
...
In order to evaluate the keep reasons for snapshots, there should be also the id's
to compare it with snapshots within the keep object. (See also Issue #3117 )
In order to avoid output parameters also changed function addJSONSnapshots to asJSONSnapshots
2024-03-29 11:30:00 +01:00
Michael Eischer
ec2b79834a
use consistent alias for interal/test package
2024-03-29 00:24:03 +01:00
Michael Eischer
8155dbe711
correctly lock repository in integration tests
2024-03-28 23:17:02 +01:00
Michael Eischer
d18726cd70
ls: add missing read lock
...
As `ls` reads data from the repository, it must acquire a read lock
unless `--no-lock` was specified. The old behavior is equivalent to `ls
--no-lock`.
2024-03-28 23:17:02 +01:00
Michael Eischer
e8df50fa3c
repository: remove global list of locks
2024-03-28 22:46:33 +01:00
Michael Eischer
cbb5f89252
lock: move code to repository package
2024-03-28 22:46:33 +01:00
Michael Eischer
118a69a84b
lock: replace lockRepo(Exclusive) with openWith(Read/Write/Exclusive)Lock
...
The new functions much better convey the intent behind the lock
request. This allows cleanly integrating noLock (for read) and dryRun
(write/exclusive) handling.
There are only minor changes to existing behavior with two exceptions:
- `tag` no longer accepts the `--no-lock` flag. As it replaces files in
the repository, this always requires an exclusive lock.
- `debug examine` now returns an error if both `--extract-pack` and
`--no-lock` are given.
2024-03-28 22:46:33 +01:00
Michael Eischer
7f9ad1c3db
Merge pull request #4705 from MichaelEischer/snapshot-statistics
...
Store snapshot statistics & print snapshot size
2024-03-28 22:41:45 +01:00
Michael Eischer
cf81f8ced6
stats: only check for hardlinks for files with more than one link
2024-03-28 21:29:27 +01:00
Michael Eischer
63a2350c9e
Merge pull request #4741 from MichaelEischer/ci-upgrade-golangci-lint
...
CI: Update golangci-lint to version 1.57.1
2024-03-28 18:27:05 +01:00
Michael Eischer
1497525e15
CI: Update golangci-lint to version 1.57.1
2024-03-28 18:15:50 +01:00
Michael Eischer
69ca12d2eb
check: treat legacy index format as errors
2024-03-09 18:36:33 +01:00
Michael Eischer
1a8bf358f1
index: deprecate legacy index format
2024-03-09 18:21:14 +01:00
Michael Eischer
a9b64cd7ad
features: print warning for stable/depreacted feature flags
2024-03-09 17:29:52 +01:00
Michael Eischer
fe68d2cafb
add feature flag documentation
2024-03-09 17:29:52 +01:00
Michael Eischer
1c77c51a03
features: initialize based on RESTIC_FEATURES environment variable
2024-03-09 17:29:52 +01:00
Michael Eischer
5974a79497
features: add basic feature flag implementation
2024-03-09 17:29:52 +01:00
Michael Eischer
b6520038fd
snapshots: Print snapshot size stored in snapshots
2024-02-23 20:27:13 +01:00
Michael Eischer
38f91d3b5e
backup: store statistics in snapshot
2024-02-23 20:27:13 +01:00
Michael Eischer
a59f654fa6
archiver: refactor summary collection from ui into the archiver
2024-02-23 20:27:13 +01:00
Aneesh Nireshwalia
eeb1aa5388
Add ability to report warnings to terminal
...
Report warnings to terminal when unrecognized generic attributes are found in the repository.
2024-02-22 17:52:26 -07:00
Aneesh Nireshwalia
0962917974
Support windows metadata using generic attribs
...
Add new generic_attributes attribute in Node.
Use the generic attributes to add support for creation time and file attributes like hidden, readonly, encrypted in windows. Handle permission errors for readonly files in windows.
Handle backup and restore of encrypted attributes using windows system calls.
2024-02-22 17:31:20 -07:00
Michael Eischer
0a65a0f94f
update comment
2024-02-22 22:00:42 +01:00
Brian Harring
30e979d252
Catch SIGTERM, run cleanup
...
The previous code only ran cleanup (lock release for example) on SIGINT. For
anyone running restic in a container, the signal is going to be SIGTERM which
means containerized execution would leave locks behind.
While this could be addressed via interposing dumb-init to translate the signal,
a `kill` invocation is going to default to SIGTERM, so the same problem exists
for non container users.
Signed-off-by: Brian Harring <ferringb@gmail.com>
2024-02-19 11:12:15 +01:00
Michael Eischer
80754dbf0c
Merge pull request #4664 from MichaelEischer/ls-unified-json-output
...
ls: include standard `message_type` field in output
2024-02-18 15:47:41 +00:00
Michael Eischer
527a3ff2b2
check: link to troubleshooting guide
2024-02-12 20:25:15 +01:00
Michael Eischer
544fe38786
check: suggest repair pack for all damaged packs
2024-02-12 20:20:13 +01:00
Michael Eischer
772e3416d1
repair pack: drop feature flag
2024-02-12 20:20:12 +01:00
Michael Eischer
ee1ff3c1d0
backup: improve error message if exclude file cannot be loaded
2024-02-11 22:26:13 +01:00
Alexander Neumann
c0514dd8ba
Fix linter errors (except for tests)
2024-02-10 22:58:10 +01:00
lou
80db02fc35
dump flag --target should be allowed to write existing file
...
Signed-off-by: lou <alex1988@outlook.com>
2024-02-10 18:39:06 +01:00
Michael Eischer
e46b21ab80
key: fix integration test for invalid arguments
2024-02-08 20:52:30 +01:00
Srigovind Nayak
795d33b3ee
key: move add, list, remove, passwd to sub-commands
...
docs: improve the sub-command docs
changelog: add the unreleased changelog for the key command updates
key: update integration tests
2024-02-06 01:47:43 +05:30
Michael Eischer
f5ffa40652
dump: minor cleanups
2024-02-05 20:10:52 +01:00
Srigovind Nayak
175c14b5c9
dump: add --target option
2024-02-05 20:10:52 +01:00
Michael Eischer
b63bfd2257
Merge branch 'patch-release'
2024-02-04 20:21:42 +01:00
Alexander Neumann
0f9fa44de5
Set development version for 0.16.4
2024-02-04 19:50:56 +01:00
Alexander Neumann
3786536dc1
Add version for 0.16.4
2024-02-04 19:50:52 +01:00
Michael Eischer
a72c2b74f3
Apply changelog entry / documentation improvements from review
2024-02-04 19:10:06 +01:00
Michael Eischer
2a0bd2b637
rename --no-verify-pack
to --no-extra-verify
2024-02-04 19:10:05 +01:00
Michael Eischer
dc11d012bb
Make --no-verify-pack globally available
...
Verifying all blobs before upload comes with a notable performance
impact. Allow users to skip it if necessary.
2024-02-04 19:09:49 +01:00
Michael Eischer
5957417b1f
Apply changelog entry / documentation improvements from review
2024-02-04 18:55:41 +01:00
Michael Eischer
86b38a0b17
rename --no-verify-pack
to --no-extra-verify
2024-02-04 17:01:05 +01:00
Michael Eischer
66e8971659
Make --no-verify-pack globally available
...
Verifying all blobs before upload comes with a notable performance
impact. Allow users to skip it if necessary.
2024-02-04 15:31:42 +01:00
Michael Eischer
8b08b522c9
Merge pull request #4669 from MichaelEischer/fix-rewrite-typo
...
rewrite: fix typo in dry-run output
2024-01-31 22:08:12 +01:00
Michael Eischer
eaf9659efc
Merge pull request #4657 from numerigraphe/fix-key-add-id
...
Properly report the ID of newly added keys
2024-01-31 20:59:41 +00:00
Michael Eischer
ba136ff60c
rewrite: fix typo in dry-run output
2024-01-31 21:48:37 +01:00
Lionel Sausin
8fbe328371
Properly report the ID of newly added keys
...
Other commands like key list and key remove show the key's ID.
Showing the ID here lets users easily reuse the ID as a key hint for subsequent
commands.
In particular, a key hint is needed when the repository has many keys - otherwise
opening the repository may fail with "Fatal: maximum number of keys reached" even
when a proper password is provided.
Fixes #4656
2024-01-29 10:12:49 +01:00
Michael Eischer
4273e06a43
Merge pull request #4662 from MichaelEischer/clarify-backup-ignore-inode
...
backup: clarify that --ignore-inode also ignores ctime
2024-01-27 18:25:11 +01:00
Michael Eischer
5dca8a70d5
ls: include standard message_type
field in output
2024-01-27 15:48:24 +01:00
Michael Eischer
765729d009
key: return an error if subcommand is unknown
2024-01-27 15:33:49 +01:00