Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Cross-model relations: consume command #6774
Conversation
babbageclunk
added some commits
Jan 4, 2017
wallyworld
approved these changes
Jan 6, 2017
Just a few nitpics.
Also, the api package changes need tests. But can be done as a followup if needed
| @@ -1079,6 +1079,47 @@ func (api *API) charmIcon(backend Backend, curl *charm.URL) ([]byte, error) { | ||
| return common.CharmArchiveEntry(charmPath, "icon.svg", true) | ||
| } | ||
| +// Consume adds remote applications to the model without |
| + return "", errors.Trace(err) | ||
| + } | ||
| + if url.HasEndpoint() { | ||
| + return "", errors.New("remote application shouldn't include endpoint") |
| @@ -450,5 +450,17 @@ type RemoteApplicationInfoResult struct { | ||
| // RemoteApplicationInfoResults represents the result of a RemoteApplicationInfo call. | ||
| type RemoteApplicationInfoResults struct { | ||
| - Results []RemoteApplicationInfoResult | ||
| + Results []RemoteApplicationInfoResult `json:"results"` |
| + $ juju consume local:/u/fred/db2 | ||
| + | ||
| +See also: | ||
| + add-relation |
| +// relating them to other applications. | ||
| +type consumeCommand struct { | ||
| + modelcmd.ModelCommandBase | ||
| + api serviceConsumeAPI |
babbageclunk
Jan 6, 2017
Member
Oh yeah. I actually didn't realise that was what that service prefix referred to - the service/application change was just when I started, so it's not as visceral for me.
Fixed.
| @@ -355,6 +355,9 @@ func registerCommands(r commandRegistry, ctx *cmd.Context) { | ||
| r.Register(application.NewUnexposeCommand()) | ||
| r.Register(application.NewServiceGetConstraintsCommand()) | ||
| r.Register(application.NewServiceSetConstraintsCommand()) | ||
| + if featureflag.Enabled(feature.CrossModelRelations) { | ||
| + r.Register(application.NewConsumeCommand()) |
| @@ -59,6 +59,10 @@ func (u *ApplicationURL) String() string { | ||
| return fmt.Sprintf("%s:/%s", u.Directory, u.Path()) | ||
| } | ||
| +func (u *ApplicationURL) HasEndpoint() bool { |
| @@ -59,6 +59,10 @@ func (u *ApplicationURL) String() string { | ||
| return fmt.Sprintf("%s:/%s", u.Directory, u.Path()) | ||
| } | ||
| +func (u *ApplicationURL) HasEndpoint() bool { | ||
| + return strings.Contains(u.ApplicationName, ":") |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
|
Build failed: Tests failed |
|
Fixed test. $$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
jujubot
merged commit a2a2a71
into
juju:develop
Jan 6, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
babbageclunk commentedJan 6, 2017
Consume adds a remote application to the model without creating any relations to it.
The remote application can also be specified by URL.
At the moment the command takes no more options than the normal model command options - in the future there will also be a way to specify the local name for the application in this model.
QA steps:
juju consume a.mysql- it will show the local name for the application.