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
591b421c4a
Deprecate s3legacy layout
2024-04-10 21:27:56 +02:00
Adam Eijdenberg
6e775d3787
Enhancement: option to send HTTP over unix socket
...
add tests for unix socket connection
switch HTTP rest-server test to use any free port
allow rest-server test graceful shutdown opportunity
2024-03-28 17:41:41 +01:00
Alexander Neumann
c0514dd8ba
Fix linter errors (except for tests)
2024-02-10 22:58:10 +01:00
Michael Eischer
a763a5c67d
s3: minor cleanups for archive storage class handling
2024-01-20 11:25:28 +01:00
Vladislav Belous
8ca58b487c
S3: do not set storage class for metadata when using archive storage
2024-01-20 11:04:15 +01:00
Michael Eischer
bd883caae1
CI: enable bodyclose linter
2024-01-19 21:17:18 +01:00
Michael Eischer
b1a8fd1d03
rest: fix and cleanup closing of http response body
...
If client.Do returns an error, then there's no body that has to be
closed. For requests for which we are not interested in the response
body, immediately drain and close the body to make sure it isn't
forgotten later on.
This change in particular adds the missing `Close()` call for the
`List()` command.
2024-01-19 21:17:17 +01:00
Michael Eischer
7b2de84763
Merge pull request #4618 from MichaelEischer/workaround-rclone-list-errors
...
rclone: Workaround for incorrect "not found" errors while listing files
2024-01-09 18:28:31 +01:00
Michael Eischer
2e8de9edfd
rclone: Workaround for incorrect "not found" errors while listing files
...
rclone returns a "not found" error if an internal error occurs while
listing a folder. Ignoring this error lets restic erroneously think that
there are no files, which can cause `prune` to wipe the whole
repository.
2024-01-09 18:20:16 +01:00
Michael Eischer
02bc73f5eb
s3: minor code cleanups
2024-01-06 21:44:53 +01:00
Michael Eischer
20cf4777cb
s3: check for EnvAWS credentials before Static credentials
...
EnvAWS considers more environment variables, including AWS_SESSION_TOKEN
and thus should be checked first.
2024-01-06 21:43:47 +01:00
Erik Kristensen
5ffb536aae
feat: support AWS assume role
2024-01-06 21:19:58 +01:00
Andrea Gelmini
241916d55b
Fix typos
2023-12-06 13:11:55 +01:00
Michael Eischer
c7b770eb1f
convert MemorizeList to be repository based
...
Ideally, code that uses a repository shouldn't directly interact with
the underlying backend. Thus, move MemorizeList one layer up.
2023-10-25 23:01:35 +02:00
Michael Eischer
1b8a67fe76
move Backend interface to backend package
2023-10-25 23:00:18 +02:00
Michael Eischer
ceb0774af1
backend: make LoadAll independent of restic package
2023-10-25 22:58:39 +02:00
Michael Eischer
b6d79bdf6f
restic: decouple restic.Handle
2023-10-25 22:54:07 +02:00
Michael Eischer
7881309d63
backend: move backend implementation helpers to util package
...
This removes code that is only used within a backend implementation from
the backend package. The latter now only contains code that also has
external users.
2023-10-25 22:54:07 +02:00
Michael Eischer
8e6fdf5edf
Merge pull request #4520 from awannabeengineer/load-retry-nonexistent
...
retry: Do not retry Load() if file does not exist
2023-10-25 20:42:05 +00:00
Arash Farr
d15ffd9c92
retry: Do not retry Load() if file does not exist
2023-10-22 13:25:32 -05:00
Michael Eischer
7f05af02b9
Merge pull request #4480 from AgathaSorceress/add-rest-auth-env
...
Support reading basic auth credentials for REST server from environment variables
2023-10-21 17:41:08 +00:00
Michael Eischer
ab6defbace
Merge pull request #4519 from adamantike/backend/sftp/add-args-option
...
backend/sftp: Add sftp.args option
2023-10-21 17:37:46 +00:00
Michael Eischer
6a4d6d5da4
sftp: test that Args and Command options cannot be set at the same time
2023-10-21 19:26:39 +02:00
Michael Manganiello
41f70f1f4f
backend/sftp: Add sftp.args option
...
Allow setting custom arguments for the `sftp` backend, by using the
`sftp.args` option. This is similar to the approach already implemented
in the `rclone` backend, to support new arguments without requiring
future code changes for each different SSH argument.
Closes #4241
2023-10-21 19:25:44 +02:00
Michael Eischer
6c7560e537
backend/b2: Switch to official library Backblaze/blazer
...
According to https://github.com/kurin/blazer Readme, the repository is
no longer maintained, and the official one at
https://github.com/Backblaze/blazer took over.
Closes #4148
2023-10-21 19:18:13 +02:00
Agatha V. Lovelace
f1877e721e
feat: support reading REST credentials from env
2023-10-20 13:04:58 +02:00
Michael Eischer
f750aa8dfb
backend/limiter: replace juju/ratelimit with x/time/rate
2023-10-17 22:49:25 +02:00
Michael Eischer
4a33370072
backend: Fix unreliable TestListCancel/Timeout test
...
The test uses `WithTimeout` to create a context that cancels the List
operation after a given delay. Several backends internally use a derived
child context created using WithCancel.
The cancellation of a context first closes the done channel of the
context (here: the `WithTimeout` context) and _afterwards_ propagates
the cancellation to child contexts (here: the `WithCancel` context).
Therefor if the List implementation uses a child context, then it may
take a moment until that context is also cancelled. Thus give the
context cancellation a moment to propagate.
2023-07-23 11:47:56 +02:00
Michael Eischer
96eada3d5f
backend/sema: add test for freeze functionality
2023-07-22 23:23:17 +02:00
Michael Eischer
f490288738
lock: freeze backend operations while refreshing stale lock
...
Freeze new backend operations while trying to refresh a stale lock.
2023-07-22 19:55:44 +02:00
Michael Eischer
978ebaac49
rest: use http status code constants
2023-07-14 22:39:38 +02:00
Michael Eischer
307aeb6849
rest: Don't return error if listing non-existent directory
...
When transferring a repository from S3 to, for example, a local disk
then all empty folders will be missing.
When saving files, the missing intermediate folders are created
automatically. Therefore, missing directories can be ignored by the
`List()` operation.
2023-07-14 22:39:38 +02:00
Michael Eischer
e990d3d483
azure: Support authentication using managed / workload identity
...
See https://github.com/Azure/azure-sdk-for-go/tree/sdk/azidentity/v1.3.0/sdk/azidentity
2023-07-09 14:47:03 +02:00
Michael Eischer
e36d17a6f8
azure: tweak documentation for endpoint suffix
2023-07-07 23:10:26 +02:00
arjunajesh
068b115abc
added azure domain parameter
2023-07-07 23:10:26 +02:00
Michael Eischer
93038ed8f4
s3: restore retries for minio tests
2023-06-17 15:25:08 +02:00
Michael Eischer
b5511e8e4c
Fix linter warnings
2023-06-17 15:15:58 +02:00
Michael Eischer
50e0d5e6b5
backend: Hardcode backend scheme in Factory
...
Our ParseConfig implementations always expect a specific scheme, thus no
other scheme would work.
2023-06-17 15:15:58 +02:00
Michael Eischer
705ad51bcc
backend: check that StripPassword can be called
2023-06-17 15:15:58 +02:00
Michael Eischer
13a8b5822f
backend: Adjust tests to use the Factory to instantiate the backend
...
This drastically reduces the amount of duplicated test code.
2023-06-17 15:15:58 +02:00
Michael Eischer
3d3bb88745
b2: remove duplicate check for config file during repository creation
...
No other backend implements that check. The check that a repository is
not yet initialized is handled by the Repository later on.
2023-06-17 15:15:58 +02:00
Michael Eischer
3a3cf608f5
b2/s3: Move config validation from ApplyEnvironment to Open/Create
...
Conceptually the backend configuration should be validated when creating
or opening the backend, but not when filling in information from
environment variables into the configuration.
2023-06-17 15:15:58 +02:00
Michael Eischer
19ac12d95b
location: make genericBackendFactory private
2023-06-17 15:15:58 +02:00
Michael Eischer
3325a7c862
location: extract backend specific part of StripPassword
...
The tests for the rest backend now reside there.
2023-06-17 15:15:58 +02:00
Michael Eischer
555be49a79
location: Make ParseConfig-test backend agnostic
...
The backend specific parts of the test are now directly handled by the
respective backend. Duplicate tests were removed.
2023-06-17 15:15:58 +02:00
Michael Eischer
9aa9e0d1ec
local/sftp: move limiter setup into backend
2023-06-17 15:15:58 +02:00
Michael Eischer
7d12c29286
backend: Unify backend construction using factory and registry
...
This unified construction removes most backend-specific code from
global.go. The backend registry will also enable integration tests to
use custom backends if necessary.
2023-06-17 15:15:57 +02:00
Michael Eischer
56836364a4
backend: pass context into every backend constructor
2023-06-17 15:15:57 +02:00
DRON-666
c37d587f81
Use PreallocateFile in local backend
2023-06-09 11:49:06 +03:00
Michael Eischer
609367195a
backend: Fix test compilation with Go 1.18 and 1.19
2023-06-07 22:31:15 +02:00
Michael Eischer
18eb1d3ab0
backend: test cleanup
2023-06-07 22:31:15 +02:00
Michael Eischer
32a6b66267
backend: add standardized Config.ApplyEnvironment
...
This removes the backend specific special cases while parsing the
configuration in `global.go`.
2023-06-07 22:31:15 +02:00
Michael Eischer
f903db492c
backend: let ParseConfig return a Config pointer
...
In order to change the backend initialization in `global.go` to be able
to generically call cfg.ApplyEnvironment() for supported backends, the
`interface{}` returned by `ParseConfig` must contain a pointer to the
configuration.
An alternative would be to use reflection to convert the type from
`interface{}(Config)` to `interface{}(*Config)` (from value to pointer
type). However, this would just complicate the type mess further.
2023-06-07 22:31:15 +02:00
Michael Eischer
25a0be7f26
backend: fix linter warnings
2023-06-07 22:31:15 +02:00
Michael Eischer
a27b7f1370
backend: use generic instead of any type for test suite
2023-06-07 22:31:14 +02:00
Michael Eischer
fa361dbfbd
backend: use generic implementation for ParseConfig tests
2023-06-07 22:30:35 +02:00
Michael Eischer
5260d38980
backend: let ParseConfig return concrete type
2023-06-07 22:30:35 +02:00
Michael Eischer
2f7b4ceae1
backend: Move environment based configuration into backend
2023-06-07 22:30:35 +02:00
sohalt
ed5b2c2c9b
gs: support other regions than us
2023-05-26 19:54:42 +02:00
Michael Eischer
658aa4c0f7
Merge pull request #4339 from greatroar/ioctl
...
backend, termstatus: fix ioctl calls for 64-bit big-endian platforms
2023-05-26 19:34:14 +02:00
greatroar
51dc80be5b
backend: Use IoctlSetPointerInt for tcsetpgrp
...
This function casts its argument to int32 before passing it to the
system call, so that big-endian CPUs read the lower rather than the
upper 32 bits of the pid.
This also gets rid of the last import of "unsafe" in the Unix build.
I changed syscall to x/sys/unix while I was at it, to remove one more
import line. The constants and types there are aliases for their syscall
counterparts.
2023-05-25 17:31:51 +02:00
Michael Eischer
16ba237d8b
azure: Fix missing rate limiting
2023-05-18 21:17:53 +02:00
Michael Eischer
22c9276719
rest: remove unused parameter
2023-05-18 21:17:53 +02:00
Michael Eischer
472bf5184f
Replace lots of unused parameters with _
...
The parameters are required by the implemented function signature or interface.
2023-05-18 21:17:53 +02:00
Michael Eischer
d1a5ec7839
Rename unused testing parameter to _
...
The parameter is an additional marker that the test helper must only be
used for tests.
2023-05-18 21:17:53 +02:00
Michael Eischer
1514593f22
Remove unused context or testing parameters
2023-05-18 21:17:53 +02:00
Michael Eischer
5e4e268bdc
Use _ as parameter name for unused Context
...
The context is required by the implemented interface.
2023-05-18 21:15:45 +02:00
Michael Eischer
2fa8b96843
Don't shadow builtins
2023-05-18 21:15:45 +02:00
Michael Eischer
319087c056
Remove redundant if ...; err != nil; return pattern
2023-05-18 21:15:45 +02:00
Michael Eischer
f9850b79b5
rest/sftp: Remove redundant fatal from error message
...
This caused restic to exit with error messages like
`Fatal: parsing repository location failed: Fatal: sftp path [...]`
`Fatal: create repository at rest:http://localhost:12345/ failed: Fatal: config file already exists`
2023-05-18 17:22:26 +02:00
Michael Eischer
d05f6211d1
lock: Do not limit backend concurrency for lock files
...
restic must be able to refresh lock files in time. However, large
uploads over slow connections can cause the lock refresh to be stuck
behind the large uploads and thus time out.
2023-05-08 19:04:46 +02:00
Michael Eischer
831f593b87
backend/sema: Add tests
2023-04-22 13:20:20 +02:00
Michael Eischer
ebba233a3a
backend/sema: rename constructor to NewBackend
2023-04-22 12:32:57 +02:00
Michael Eischer
f27750e270
backend/sema: rename type to connectionLimitedBackend
2023-04-21 22:53:09 +02:00
Michael Eischer
6042df075f
migrations: Fix S3 backend detection
2023-04-14 22:32:16 +02:00
Michael Eischer
c934c99d41
gs: replace usage of context.Background()
2023-04-14 22:32:15 +02:00
Michael Eischer
616926d2c1
gs: use IsNotExist to check error
2023-04-14 22:32:15 +02:00
Michael Eischer
05abc6d6f5
backend: deduplicate implementation of Delete() method
2023-04-14 22:32:15 +02:00
Michael Eischer
45244fdf68
backend: remove parameter validation tests
...
These parameter validations have been factored out into
SemaphoreBackend.
2023-04-14 22:32:15 +02:00
Michael Eischer
803640ba4b
backend: remove a few unnecessary debug logs
2023-04-14 22:32:15 +02:00
Michael Eischer
8e1e3844aa
backend: factor out connection limiting and parameter validation
...
The SemaphoreBackend now uniformly enforces the limit of concurrent
backend operations. In addition, it unifies the parameter validation.
The List() methods no longer uses a semaphore. Restic already never runs
multiple list operations in parallel.
By managing the semaphore in a wrapper backend, the sections that hold a
semaphore token grow slightly. However, the main bottleneck is IO, so
this shouldn't make much of a difference.
The key insight that enables the SemaphoreBackend is that all of the
complex semaphore handling in `openReader()` still happens within the
original call to `Load()`. Thus, getting and releasing the semaphore
tokens can be refactored to happen directly in `Load()`. This eliminates
the need for wrapping the reader in `openReader()` to release the token.
2023-04-14 22:32:15 +02:00
Michael Eischer
8b5ab5b59f
dryrun: fix outdated comments
2023-04-14 22:32:15 +02:00
Michael Eischer
4703473ec5
backend: extract most debug logs into logger backend
2023-04-14 22:32:15 +02:00
Michael Eischer
8bfc2519d7
backend: Deduplicate sanity checks for parameters of Load() method
...
The check is now handled by backend.DefaultLoad. This also guarantees
consistent behavior across all backends.
2023-04-14 22:32:15 +02:00
Michael Eischer
faa83db9e4
azure: Adapt code to API change
2023-04-07 15:05:55 +02:00
Michael Eischer
90fb6f70b4
Merge pull request #4089 from greatroar/errors
...
Clean up error handling further
2022-12-24 10:41:56 +01:00
greatroar
d9002f050e
backend: Don't Wrap errors from url.Parse
...
The messages from url.Error.Error already start with the word "parse".
2022-12-17 09:41:07 +01:00
Xun Jiang
cc5325d22b
Fix: change error code in function isAccessDenied to AccessDenied
...
Signed-off-by: Xun Jiang <blackpiglet@gmail.com>
2022-12-16 21:41:16 +01:00
Michael Eischer
1bfe98bdc0
Merge pull request #2398 from DanielG/b2-hide-file
...
b2: Fallback to b2_hide_file when delete returns unauthorized
2022-12-13 22:52:23 +01:00
Michael Eischer
1c071a462e
Merge pull request #4084 from ekarlso/azure-stat-fix
...
fix: Make create not error out when ContainerNotFound
2022-12-13 22:49:05 +01:00
Endre Karlson
7dd33c0ecc
azure: Make create not error out when ContainerNotFound
2022-12-11 22:57:23 +01:00
Michael Eischer
049a105ba5
Merge pull request #4077 from greatroar/cleanup
...
test: Use testing.T.Cleanup to remove tempdirs
2022-12-09 22:17:46 +01:00
Michael Eischer
4b98b5562d
Merge pull request #4075 from greatroar/sftp-enospc
...
sftp: Fix ENOSPC check
2022-12-09 22:00:13 +01:00
greatroar
f90bf84ba7
test: Use testing.T.Cleanup to remove tempdirs
2022-12-09 14:23:55 +01:00
Endre Karlson
25648e2501
azure: Switch to azblob sdk
2022-12-07 21:46:07 +01:00
greatroar
62520bb7b4
sftp: Fix ENOSPC check
...
We now check for space that is not reserved for the root user on the
remote, and the check is no longer in a defer block because it wouldn't
fire. Some change in the surrounding code may have led the deferred
function to capture the wrong err variable.
Fixes #3336 .
2022-12-07 21:06:46 +01:00
Michael Eischer
2b67862420
backend/test: check that IsNotExist actually works
2022-12-03 18:56:55 +01:00
Michael Eischer
2f934f5803
gs: check against the correct error in IsNotExist
2022-12-03 18:49:54 +01:00
Michael Eischer
04d101fa94
gs/s3: remove useless os.IsNotExist check
2022-12-03 18:49:54 +01:00