Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws[s3]: Add versioning support #1085

Merged
merged 1 commit into from Jan 29, 2019

Conversation

Projects
None yet
3 participants
@PsyanticY
Copy link
Contributor

commented Jan 28, 2019

No description provided.

@@ -40,6 +40,12 @@ with lib;
description = "The JSON lifecycle management string to apply to the bucket.";
};

versioning = mkOption {
default = "Suspended";
type = types.str;

This comment has been minimized.

Copy link
@grahamc

grahamc Jan 28, 2019

Member

Instead of a string, should use an enum:

unit = mkOption {

This comment has been minimized.

Copy link
@grahamc

grahamc Jan 28, 2019

Member
Suggested change
type = types.str;
type = types.enum [ "Suspended" "Enabled" ];

should do it, I think (please test it).

This comment has been minimized.

Copy link
@PsyanticY

PsyanticY Jan 28, 2019

Author Contributor

Thanks, Updated ( and tested)

@PsyanticY PsyanticY force-pushed the PsyanticY:s3-versionning branch from ba89fff to fd70e49 Jan 28, 2019

@@ -105,10 +107,21 @@ def create(self, defn, check, allow_reboot, allow_recreate):
except botocore.exceptions.ClientError as e:
if e.response['Error']['Code'] != "BucketAlreadyOwnedByYou": raise

try:
current = s3client.get_bucket_versioning(Bucket=defn.bucket_name)

This comment has been minimized.

Copy link
@AmineChikhaoui

AmineChikhaoui Jan 28, 2019

Member

I guess this is more correct but we typically check against the api only with --check or within the _check() method. The assumption is that nixops is the only thing updating the bucket config, so we should check against self.versioning.

@PsyanticY PsyanticY force-pushed the PsyanticY:s3-versionning branch from fd70e49 to 8846d02 Jan 28, 2019

@@ -105,10 +107,21 @@ def create(self, defn, check, allow_reboot, allow_recreate):
except botocore.exceptions.ClientError as e:
if e.response['Error']['Code'] != "BucketAlreadyOwnedByYou": raise

try:

This comment has been minimized.

Copy link
@AmineChikhaoui

AmineChikhaoui Jan 28, 2019

Member

Can you move this out of the if check or self.state != self.UP: block

This comment has been minimized.

Copy link
@PsyanticY

PsyanticY Jan 29, 2019

Author Contributor

Done

@PsyanticY PsyanticY force-pushed the PsyanticY:s3-versionning branch from 8846d02 to 75bd887 Jan 29, 2019

@AmineChikhaoui AmineChikhaoui merged commit 725ee81 into NixOS:master Jan 29, 2019

1 check passed

Travis CI - Pull Request Build Passed
Details

@PsyanticY PsyanticY deleted the PsyanticY:s3-versionning branch Jan 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.