Skip to content

Commit

Permalink
Merge pull request juju#17225 from wallyworld/merge-3.4-20240418
Browse files Browse the repository at this point in the history
juju#17225

Merge 3.4

juju#17224 [from wallyworld/podspec-nil-map](juju@b75f5f0)
  • Loading branch information
jujubot authored Apr 18, 2024
2 parents f3197e3 + 3209ceb commit 03fffdd
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion api/controller/caasunitprovisioner/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ func (c *Client) ApplicationConfig(applicationName string) (config.ConfigAttribu
if len(results.Results) != len(args.Entities) {
return nil, errors.Errorf("expected %d result(s), got %d", len(args.Entities), len(results.Results))
}
return config.ConfigAttributes(results.Results[0].Config), nil
if err := results.Results[0].Error; err != nil {
return nil, params.TranslateWellKnownError(err)
}
return results.Results[0].Config, nil
}

// WatchApplicationScale returns a NotifyWatcher that notifies of
Expand Down
2 changes: 1 addition & 1 deletion apiserver/facades/client/application/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (s *DeployLocalSuite) TestDeployMinimal(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
s.assertCharm(c, app, s.charm.URL())
s.assertSettings(c, app, charm.Settings{})
s.assertApplicationConfig(c, app, coreconfig.ConfigAttributes(nil))
s.assertApplicationConfig(c, app, coreconfig.ConfigAttributes{})
s.assertConstraints(c, app, constraints.MustParse("arch=amd64"))
s.assertMachines(c, app, constraints.Value{})
}
Expand Down
3 changes: 3 additions & 0 deletions caas/kubernetes/provider/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,9 @@ func (k *kubernetesClient) EnsureService(
}

if params.PodSpec != nil {
if config == nil {
return errors.Errorf("config for k8s app %q cannot be nil", appName)
}
return k.ensureService(appName, deploymentName, statusCallback, params, numUnits, config)
}
if len(params.RawK8sSpec) > 0 {
Expand Down
4 changes: 2 additions & 2 deletions state/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -3232,13 +3232,13 @@ func (a *Application) ApplicationConfig() (config.ConfigAttributes, error) {
cfg, err := readSettings(a.st.db(), settingsC, a.applicationConfigKey())
if err != nil {
if errors.IsNotFound(err) {
return config.ConfigAttributes(nil), nil
return config.ConfigAttributes{}, nil
}
return nil, errors.Annotatef(err, "application config for application %q", a.doc.Name)
}

if len(cfg.Keys()) == 0 {
return config.ConfigAttributes(nil), nil
return config.ConfigAttributes{}, nil
}
return cfg.Map(), nil
}
Expand Down
4 changes: 3 additions & 1 deletion state/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4659,6 +4659,7 @@ var updateApplicationConfigTests = []struct {
}, {
about: "unset missing string",
update: config.ConfigAttributes{"outlook": nil},
expect: config.ConfigAttributes{},
}, {
about: `empty strings are valid`,
initial: config.ConfigAttributes{"outlook": "positive"},
Expand All @@ -4682,6 +4683,7 @@ var updateApplicationConfigTests = []struct {
about: "unset non-string type",
initial: config.ConfigAttributes{"skill-level": 303},
update: config.ConfigAttributes{"skill-level": nil},
expect: config.ConfigAttributes{},
}}

func (s *ApplicationSuite) TestUpdateApplicationConfig(c *gc.C) {
Expand Down Expand Up @@ -4725,7 +4727,7 @@ func (s *ApplicationSuite) TestApplicationConfigNotFoundNoError(c *gc.C) {

cfg, err := app.ApplicationConfig()
c.Assert(err, jc.ErrorIsNil)
c.Check(cfg, gc.IsNil)
c.Assert(cfg, gc.HasLen, 0)
}

func (s *ApplicationSuite) TestStatusInitial(c *gc.C) {
Expand Down
2 changes: 1 addition & 1 deletion worker/uniter/actions/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (r *actionsResolver) NextOp(
// deferred until the unit is running. If the remote charm needs
// updating, hold off on action running.
if remoteState.ActionsBlocked || localState.OutdatedRemoteCharm {
r.logger.Infof("actions are blocked=%v; outdated remote charm=%v - have pending actions: %v", remoteState.ActionsBlocked, localState.OutdatedRemoteCharm, remoteState.ActionsPending)
r.logger.Debugf("actions are blocked=%v; outdated remote charm=%v - have pending actions: %v", remoteState.ActionsBlocked, localState.OutdatedRemoteCharm, remoteState.ActionsPending)
if localState.ActionId == nil {
r.logger.Debugf("actions are blocked, no in flight actions")
return nil, resolver.ErrNoOperation
Expand Down

0 comments on commit 03fffdd

Please sign in to comment.