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

[JUJU-3315] Force "stable" channel to be "latest/stable" when reading apps. #204

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/juju/applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ func (c applicationsClient) ReadApplication(input *ReadApplicationInput) (*ReadA

response := &ReadApplicationResponse{
Name: charmURL.Name,
Channel: appStatus.CharmChannel,
Channel: appInfo.Channel,
Revision: charmURL.Revision,
Series: appInfo.Series,
Units: unitCount,
Expand Down
12 changes: 8 additions & 4 deletions internal/provider/resource_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func resourceApplication() *schema.Resource {
"channel": {
Description: "The channel to use when deploying a charm. Specified as \\<track>/\\<risk>/\\<branch>.",
Type: schema.TypeString,
Default: "latest/stable",
Optional: true,
Computed: true,
},
"revision": {
Description: "The revision of the charm to deploy.",
Expand Down Expand Up @@ -129,9 +129,9 @@ func resourceApplication() *schema.Resource {
},
"placement": {
Description: "Specify the target location for the application's units",
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"principal": {
Description: "Whether this is a Principal application",
Expand All @@ -155,6 +155,10 @@ func resourceApplicationCreate(ctx context.Context, d *schema.ResourceData, meta
charm := d.Get("charm").([]interface{})[0].(map[string]interface{})
charmName := charm["name"].(string)
channel := charm["channel"].(string)
if channel == "" {
// if no channel was set we will request the stable by default
channel = "stable"
}
series := charm["series"].(string)
units := d.Get("units").(int)
trust := d.Get("trust").(bool)
Expand Down