Support removing a relation by its id #7744

Merged
merged 1 commit into from Aug 16, 2017

Conversation

Projects
None yet
3 participants
Owner

wallyworld commented Aug 15, 2017

Description of change

When looking at relations to offers, only the relation id is known to the user. We need to provide a way for those relations to be removed. This PR adds support the the remove-relation command to allow a relation id to be used. The capability isn't CMR specific.

QA steps

Deploy a CMR scenario.
Use juju status to find a relation id to remove
$ juju remove-relation
Both consuming and offering sides should reflect broken relation.

Documentation changes

juju remove-relation CLI doc needs updating.

axw approved these changes Aug 16, 2017

apiserver/allfacades.go
@@ -124,7 +124,8 @@ func AllFacades() *facade.Registry {
reg("Application", 2, application.NewFacade)
reg("Application", 3, application.NewFacade)
reg("Application", 4, application.NewFacade)
- reg("Application", 5, application.NewFacade) // adds AttachStorage
+ reg("Application", 5, application.NewFacade) // adds AttachStorage
+ reg("Application", 6, application.NewFacadeV6) // adds remove relation by id
@axw

axw Aug 16, 2017

Member

version 5 hasn't been released yet, no need to bump it again

apiserver/params/params.go
type DestroyRelation struct {
- Endpoints []string `json:"endpoints"`
+ Endpoints []string `json:"endpoints"`
@axw

axw Aug 16, 2017

Member

,omitempty

cmd/juju/application/removerelation.go
+ mysql wordpress, or
+ mediawiki:db mariadb:db
+
+It is also possible to specify the relation id, if known. This is useful to
@axw

axw Aug 16, 2017

Member

s/id/ID/
here and the next line, and in user-visible error messages

cmd/juju/application/removerelation.go
-func (c *removeRelationCommand) Init(args []string) error {
+func (c *removeRelationCommand) Init(args []string) (err error) {
+ if len(args) == 1 {
+ if c.RelationId, err = strconv.Atoi(args[0]); err != nil {
@axw

axw Aug 16, 2017

Member

maybe check sign? err != nil || c.RelationId < 0?

Owner

wallyworld commented Aug 16, 2017

$$merge$$

Contributor

jujubot commented Aug 16, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

Contributor

jujubot commented Aug 16, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/136

Owner

wallyworld commented Aug 16, 2017

$$merge$$

Contributor

jujubot commented Aug 16, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 41a6d9b into juju:develop Aug 16, 2017

1 check passed

continuous-integration/jenkins/pr-merge This commit looks good
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment