Exemple #1
0
func (s *Store) linkTargets() error {
	var updatedHostnames []string

	for name, tgt := range s.hostnameTargetMapping {
		c, err := s.findBestCertificateSatisfying(tgt)
		if err == nil {
			log.Tracef("relink: best certificate satisfying %v is %v", tgt, c)
			lt := "certs/" + c.ID()
			lnk, err := s.db.Collection("live").ReadLink(name)
			log.Tracef("link: %s: %v %q %q", name, err, lnk.Target, lt)
			if err != nil || lnk.Target != lt {
				log.Debugf("relinking: %v -> %v (was %v)", name, lt, lnk.Target)
				err = s.db.Collection("live").WriteLink(name, fdb.Link{Target: lt})
				if err != nil {
					return err
				}

				updatedHostnames = append(updatedHostnames, name)
			}
		}
	}

	err := notify.Notify("", s.path, updatedHostnames) // ignore error
	log.Errore(err, "failed to call notify hooks")

	return nil
}
Exemple #2
0
func cmdRunTestNotify() {
	err := notify.Notify(*hooksFlag, *stateFlag, *testNotifyArg)
	log.Errore(err, "notify")
}