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

add: rename-space #11143

Merged
merged 30 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
efd63f8
rename-space: init api creation
Jan 22, 2020
bb82252
rename-space: stubs to rename space
Jan 23, 2020
3016c35
rename-space: create initial rename code
Jan 23, 2020
d981a9a
rename-space: initial connection to apiserver
Jan 23, 2020
d8202a7
rename-space: initial working version
Jan 23, 2020
cf946ee
rename-space: rework initial model and indirection
Jan 23, 2020
a7c7194
rename space: resolve merge conflict
Jan 24, 2020
5020480
spaces environ: code to check whether cloud supports providerspaces +…
Jan 24, 2020
48c527f
spaces environ: update settings to take collection
Jan 24, 2020
669519e
spaces environ: redo interface and constraints db access
Jan 28, 2020
d950960
spaces api test: add test
Jan 28, 2020
bfa6bd8
state: change constraints to add another struct
Jan 28, 2020
4d1762d
state space: correct constraint handling
Jan 29, 2020
d11eba9
space: rework indirection. fix rest of comments
Jan 29, 2020
c55477b
space: fix existing unit tests
Jan 29, 2020
5a1ec3a
space apiserver test: add additional test for renaming case
Jan 30, 2020
3f3f389
space apiserver test: fix test
Jan 30, 2020
489965d
space: remove not needed method
Jan 30, 2020
6147288
space: fix renaming issues
Jan 30, 2020
81060f1
space: fix use correct DocID not ID
Jan 30, 2020
1723108
space rename: address simons review
Jan 30, 2020
d2db8e5
space rename: wordings
Jan 30, 2020
778d402
space rename: remove unneeded shim methods
Jan 30, 2020
6e173d5
space rename: add mock model and skip if not controllermodel
Jan 31, 2020
95da83f
space rename: fix copy pasta and ordering of test to ensure better re…
Jan 31, 2020
298e16b
space rename: add first review part of joe
Jan 31, 2020
a765b62
constraints spaces: add additional tests and add negation
Feb 4, 2020
b560fa4
refactoring of spaces
Feb 4, 2020
32eb198
apiserver spaces: error on alpha space
Feb 4, 2020
ed6ae8f
cmd spaces: fix removed to renamed
Feb 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions apiserver/facades/client/spaces/rename.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/juju/juju/apiserver/common"
"github.com/juju/juju/apiserver/params"
jujucontroller "github.com/juju/juju/controller"
"github.com/juju/juju/core/network"
"github.com/juju/juju/core/permission"
"github.com/juju/juju/core/settings"
"github.com/juju/juju/state"
Expand Down Expand Up @@ -150,6 +151,11 @@ func (api *API) RenameSpace(args params.RenameSpacesParams) (params.ErrorResults
results.Results[i].Error = common.ServerError(errors.Trace(err))
continue
}
if fromTag.Id() == network.AlphaSpaceName {
newErr := errors.New("the alpha space cannot be removed")
nammn marked this conversation as resolved.
Show resolved Hide resolved
results.Results[i].Error = common.ServerError(newErr)
continue
}
toTag, err := names.ParseSpaceTag(spaceRename.ToSpaceTag)
if err != nil {
results.Results[i].Error = common.ServerError(errors.Trace(err))
Expand Down
14 changes: 13 additions & 1 deletion apiserver/facades/client/spaces/spaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,19 @@ func (s *SpaceTestMockSuite) TestRenameSpaceErrorRename(c *gc.C) {
c.Assert(res.Results[0].Error, gc.ErrorMatches, bamErr.Error())
}

func (s *SpaceTestMockSuite) TestRenameAlphaSpaceError(c *gc.C) {
ctrl, unreg := s.setupSpacesAPI(c, true, false)
defer ctrl.Finish()
defer unreg()
from, to := "alpha", "blub"

args := s.getRenameArgs(from, to)

res, err := s.api.RenameSpace(args)
c.Assert(err, jc.ErrorIsNil)
c.Assert(res.Results[0].Error, gc.ErrorMatches, "the alpha space cannot be removed")
}

func (s *SpaceTestMockSuite) TestRenameSpaceSuccess(c *gc.C) {
ctrl, unreg := s.setupSpacesAPI(c, true, false)
defer ctrl.Finish()
Expand All @@ -224,7 +237,6 @@ func (s *SpaceTestMockSuite) TestRenameSpaceSuccess(c *gc.C) {
res, err := s.api.RenameSpace(args)
c.Assert(err, jc.ErrorIsNil)
c.Assert(res.Results[0].Error, gc.IsNil)

}

func (s *SpaceTestMockSuite) TestRenameSpaceErrorProviderSpacesSupport(c *gc.C) {
Expand Down