restic/doc
Michael Pratt fa0be82da8 gs: allow backend creation without storage.buckets.get
If the service account used with restic does not have the
storage.buckets.get permission (in the "Storage Admin" role), Create
cannot use Get to determine if the bucket is accessible.

Rather than always trying to create the bucket on Get error, gracefully
fall back to assuming the bucket is accessible. If it is, restic init
will complete successfully. If it is not, it will fail on a later call.

Here is what init looks like now in different cases.

Service account without "Storage Admin":

Bucket exists and is accessible (this is the case that didn't work
before):

$ ./restic init -r gs:this-bucket-does-exist:/
enter password for new backend:
enter password again:
created restic backend c02e2edb67 at gs:this-bucket-does-exist:/

Please note that knowledge of your password is required to access
the repository. Losing your password means that your data is
irrecoverably lost.

Bucket exists but is not accessible:

$ ./restic init -r gs:this-bucket-does-exist:/
enter password for new backend:
enter password again:
create key in backend at gs:this-bucket-does-exist:/ failed:
service.Objects.Insert: googleapi: Error 403:
my-service-account@myproject.iam.gserviceaccount.com does not have
storage.objects.create access to object this-bucket-exists/keys/0fa714e695c8ecd58cb467cdeb04d36f3b710f883496a90f23cae0315daf0b93., forbidden

Bucket does not exist:

$ ./restic init -r gs:this-bucket-does-not-exist:/
create backend at gs:this-bucket-does-not-exist:/ failed:
service.Buckets.Insert: googleapi: Error 403:
my-service-account@myproject.iam.gserviceaccount.com does not have storage.buckets.create access to bucket this-bucket-does-not-exist., forbidden

Service account with "Storage Admin":

Bucket exists and is accessible: Same

Bucket exists but is not accessible: Same. Previously this would fail
when Create tried to create the bucket. Now it fails when trying to
create the keys.

Bucket does not exist:

$ ./restic init -r gs:this-bucket-does-not-exist:/
enter password for new backend:
enter password again:
created restic backend c3c48b481d at gs:this-bucket-does-not-exist:/

Please note that knowledge of your password is required to access
the repository. Losing your password means that your data is
irrecoverably lost.
2017-09-25 22:25:51 -07:00
..
_static Documentation: Refactor and switch to Sphinx 2017-04-17 20:53:38 +02:00
images/aws_s3 Convert AWS S3 tutorial to rst 2017-04-17 22:41:23 +02:00
logo Update logo 2015-01-03 15:42:48 +01:00
man doc: Update manpages 2017-09-24 23:13:04 +02:00
cache.rst Add cache 2017-09-24 21:54:53 +02:00
conf.py add explanation of restic automation 2017-09-16 10:17:36 -04:00
Design.md doc: Move doc/references/* to doc/ 2017-04-17 22:07:06 +02:00
design.rst doc/design: fix keys.data MAC format description 2017-08-29 00:22:11 +02:00
development.rst Fix link to CONTRIBUTING.md 2017-06-09 00:36:31 +02:00
faq.rst Merge pull request #1272 from jniggemann/doc-faq-add-prio 2017-09-23 20:08:17 +02:00
index.rst Convert AWS S3 tutorial to rst 2017-04-17 22:41:23 +02:00
installation.rst Fixed word-o. ("Package", not "packet".) 2017-08-31 13:34:53 -07:00
Makefile Documentation: Refactor and switch to Sphinx 2017-04-17 20:53:38 +02:00
manual.rst gs: allow backend creation without storage.buckets.get 2017-09-25 22:25:51 -07:00
references.rst Add cache 2017-09-24 21:54:53 +02:00
requirements.txt Documentation: Refactor and switch to Sphinx 2017-04-17 20:53:38 +02:00
rest_backend.rst doc: Move doc/references/* to doc/ 2017-04-17 22:07:06 +02:00
talks.rst Documentation: Refactor and switch to Sphinx 2017-04-17 20:53:38 +02:00
test_irreducibility.gap chunker: Require a random irreducible polynomial 2015-04-05 22:52:43 +02:00
tutorial_aws_s3.rst Fixing tiny typo 2017-06-08 13:27:22 +02:00
tutorials.rst Convert AWS S3 tutorial to rst 2017-04-17 22:41:23 +02:00