예제 #1
0
파일: kv_lock.go 프로젝트: agy/consul-cli
// 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))
		}
	}
}
예제 #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
}