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

seed/seedwriter: fail early when system seed directory exists #10220

Merged

Conversation

bboozzoo
Copy link
Collaborator

Fail early when creating a Core 20 seed when the target directory exists. This
helps to prevent a situation when creating seed gets interrupted and gets
restarted.

Fail early when creating a Core 20 seed when the target directory exists. This
helps to prevent a situation when creating seed gets interrupted and gets
restarted.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
@bboozzoo bboozzoo added the Simple 😃 A small PR which can be reviewed quickly label Apr 30, 2021
@bboozzoo bboozzoo requested a review from pedronis April 30, 2021 12:26
Copy link
Member

@anonymouse64 anonymouse64 left a comment

Choose a reason for hiding this comment

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

lgtm

s.opts.Label = "20191003"
for _, t := range tests {
baseLabel := "20191003"
for idx, t := range tests {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we could also remove the dir instead? I don't have a very strong preference but wanted to mention it

Copy link
Member

Choose a reason for hiding this comment

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

using the index as a suffix seems reasonable enough to me

Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

a couple of questions (the one about the tests is not a blocker)

seed/seedwriter/seed20.go Outdated Show resolved Hide resolved
Seedwriter now fails early when the system directory already exists

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

I would prefer a dedicate error

seed/seedwriter/seed20.go Outdated Show resolved Hide resolved
…ry already exists

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
@pedronis pedronis self-requested a review May 18, 2021 13:59
Copy link
Collaborator

@pedronis pedronis 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 but error doesn't follow naming conventions

@@ -421,12 +421,28 @@ func (w *Writer) SetOptionsSnaps(optSnaps []*OptionsSnap) error {
return nil
}

// ErrSystemAlreadyExists is an error returned when given seed system already
// exists.
type ErrSystemAlreadyExists struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

error structs need to be called SystemAlreadyExistsError

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

thanks

Copy link
Member

@anonymouse64 anonymouse64 left a comment

Choose a reason for hiding this comment

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

still lgtm

s.opts.Label = "20191003"
for _, t := range tests {
baseLabel := "20191003"
for idx, t := range tests {
Copy link
Member

Choose a reason for hiding this comment

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

using the index as a suffix seems reasonable enough to me

@bboozzoo
Copy link
Collaborator Author

Feels like restarting the spread jobs for the 3rd time is wasteful. @mvo5 can you merge this PR? The failure on 14.04 is unrelated.

@mvo5 mvo5 merged commit a39410c into snapcore:master May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Simple 😃 A small PR which can be reviewed quickly
Projects
None yet
4 participants