Help recover a broken juju controller upgrade

Off hand, I have no idea how the api server address info and apipassword went missing. A recent 2.8 PR added a change to not write out empty addresses, as the issue has not been able to be observed “in the lab”. I don’t think though this affects empty apipasswords (first we’ve heard of it). It’s been very illusive to try and track down the smoking gun here.

The password in mongo is stored as a sha512 hash

func AgentPasswordHash(password string) string {
	sum := sha512.New()
	sum.Write([]byte(password))
	h := sum.Sum(nil)
	return base64.StdEncoding.EncodeToString(h[:18])
}

so you could generate a new hash of a new password that you put into agent.conf and update mongo (the “passwordhash” field on the releavant doc in the “units” or “machines” collection).