Exemplo n.º 1
0
// Destroy the session on error. Only performed when
// c.cleanSession == true
//
func (c *KVLockCommand) destroySession(s *consulapi.Session) {
	if c.cleanSession {
		writeOpts := c.WriteOptions()
		_, err := s.Destroy(c.session, writeOpts)
		if err != nil {
			c.UI.Error(fmt.Sprintf("Session not destroyed: %s", c.session))
		}
	}
}
Exemplo n.º 2
0
// Destroy the session on error. Only performed when
// klo.cleanSession == true
//
func (k *Kv) destroySession(s *consulapi.Session, klo *KvLockOptions) error {
	if klo.cleanSession {
		writeOpts := k.WriteOptions()
		_, err := s.Destroy(klo.Session, writeOpts)
		if err != nil {
			return fmt.Errorf("Session not destroyed: %s", klo.Session)
		}
	}

	return nil
}