~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/cmd/jujud/agent/machine/servinginfo_setter.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
                        if err != nil {
58
58
                                return nil, err
59
59
                        }
 
60
                        existing, hasInfo := agent.CurrentConfig().StateServingInfo()
60
61
                        for _, job := range machine.Jobs() {
61
62
                                if job.NeedsState() {
62
63
                                        info, err := apiState.StateServingInfo()
63
64
                                        if err != nil {
64
65
                                                return nil, errors.Errorf("cannot get state serving info: %v", err)
65
66
                                        }
 
67
                                        if hasInfo {
 
68
                                                // Use the existing Cert as it may have been updated already
 
69
                                                // by the cert updater worker to have this machine's IP address
 
70
                                                // as part of the cert. This changed cert is never put back into
 
71
                                                // the database, so it isn't reflected in the copy we have got
 
72
                                                // from apiState.
 
73
                                                info.Cert = existing.Cert
 
74
                                        }
66
75
                                        err = agent.ChangeConfig(func(config coreagent.ConfigSetter) error {
67
76
                                                config.SetStateServingInfo(info)
68
77
                                                return nil