Skip to content

Disallow renaming services#1606

Merged
aaronlehmann merged 1 commit intomoby:masterfrom
thaJeztah:disallow-rename
Oct 24, 2016
Merged

Disallow renaming services#1606
aaronlehmann merged 1 commit intomoby:masterfrom
thaJeztah:disallow-rename

Conversation

@thaJeztah
Copy link
Member

Updating a services' name has has various side-effects (e.g., existing tasks are not renamed), and was never intended to be supported.

This produces an error if the service is renamed.

relates to moby/moby#26988

@thaJeztah
Copy link
Member Author

ping @vieux @aaronlehmann ptal

@codecov-io
Copy link

codecov-io commented Oct 10, 2016

Current coverage is 54.66% (diff: 0.00%)

Merging #1606 into master will decrease coverage by 0.19%

@@             master      #1606   diff @@
==========================================
  Files            84         84          
  Lines         14174      14176     +2   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits           7776       7750    -26   
- Misses         5381       5396    +15   
- Partials       1017       1030    +13   

Sunburst

Powered by Codecov. Last update c7ade46...34c8908

@tonistiigi
Copy link
Member

LGTM


var (
errNetworkUpdateNotSupported = errors.New("changing network in service is not supported")
errRenameNotSupported = errors.New("renaming service is not supported")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: service should be plural: renaming services is not supported

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, makes sense let me update

Copy link
Member Author

Choose a reason for hiding this comment

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

done

}

if service.Spec.Annotations.Name != request.Spec.Annotations.Name {
return errRenameNotSupported
Copy link
Collaborator

Choose a reason for hiding this comment

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

It just occurred to me that it might be helpful to show the old and new name of the service, in case a user (especially an API user) encounters this unexpectedly. WDYT? I don't think it's very important though, so feel free to ignore this suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

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

This should also be a proper grpc error.

@aaronlehmann
Copy link
Collaborator

LGTM

@thaJeztah
Copy link
Member Author

I discussed with @aaronlehmann and it may be a nice addition to show the names of the service for easier tracking of errors. Also, it wouldn't hurt to add a unit-test, so I'll have a look at those.

I don't think there's a hurry to get this merged, so I'll ping when I made those changes

Copy link
Member

@aluzzardi aluzzardi left a comment

Choose a reason for hiding this comment

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

LGTM

@aaronlehmann
Copy link
Collaborator

@thaJeztah: Are you still planning to make these changes?

@xiaods
Copy link

xiaods commented Oct 24, 2016

@thaJeztah: Are you still planning to make these changes?

Updating a services' name has has various
side-effects (e.g., existing tasks are not
renamed), and was never intended to be supported.

This produces an error if the service is renamed.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@stevvooe
Copy link
Contributor

LGTM

There are more changes to make the error handling correct that are outside of the scope of this PR.

@thaJeztah
Copy link
Member Author

@aaronlehmann just discussed with @stevvooe, and I'm ok with getting this merged as-is, so that other fixes can be taken care of in a follow up. I'll open an issue for that

@aaronlehmann
Copy link
Collaborator

Just want to confirm we're not going to fix this to return a gRPC error before merging? That seems like a very simple thing to fix.

@aaronlehmann
Copy link
Collaborator

I see that there are other cases where this handler does not return gRPC errors, so I guess that's why...

@thaJeztah
Copy link
Member Author

@aaronlehmann yup 😄

@aaronlehmann
Copy link
Collaborator

LGTM

@aaronlehmann aaronlehmann merged commit 86cb7ea into moby:master Oct 24, 2016
@thaJeztah thaJeztah deleted the disallow-rename branch October 24, 2016 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants