mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 08:44:14 +01:00
don't dealloate reserved services (#41)
This commit is contained in:
parent
158cc42c07
commit
6841704b90
@ -75,21 +75,26 @@ func (h *unshareHandler) Handle(params service.UnshareParams, principal *rest_mo
|
||||
return service.NewUnshareInternalServerError()
|
||||
}
|
||||
|
||||
// single tag-based service deallocator; should work regardless of sharing mode
|
||||
if err := h.deallocateResources(senv, ssvc, svcName, svcZId, edge); err != nil {
|
||||
logrus.Errorf("error unsharing ziti resources for '%v': %v", ssvc, err)
|
||||
return service.NewUnshareInternalServerError()
|
||||
}
|
||||
if !ssvc.Reserved {
|
||||
// single tag-based service deallocator; should work regardless of sharing mode
|
||||
if err := h.deallocateResources(senv, ssvc, svcName, svcZId, edge); err != nil {
|
||||
logrus.Errorf("error unsharing ziti resources for '%v': %v", ssvc, err)
|
||||
return service.NewUnshareInternalServerError()
|
||||
}
|
||||
|
||||
logrus.Debugf("deallocated service '%v'", svcName)
|
||||
logrus.Debugf("deallocated service '%v'", svcName)
|
||||
|
||||
if err := str.DeleteService(ssvc.Id, tx); err != nil {
|
||||
logrus.Errorf("error deactivating service '%v': %v", svcZId, err)
|
||||
return service.NewUnshareInternalServerError()
|
||||
}
|
||||
if err := tx.Commit(); err != nil {
|
||||
logrus.Errorf("error committing transaction for '%v': %v", svcZId, err)
|
||||
return service.NewUnshareInternalServerError()
|
||||
if err := str.DeleteService(ssvc.Id, tx); err != nil {
|
||||
logrus.Errorf("error deactivating service '%v': %v", svcZId, err)
|
||||
return service.NewUnshareInternalServerError()
|
||||
}
|
||||
if err := tx.Commit(); err != nil {
|
||||
logrus.Errorf("error committing transaction for '%v': %v", svcZId, err)
|
||||
return service.NewUnshareInternalServerError()
|
||||
}
|
||||
|
||||
} else {
|
||||
logrus.Infof("service '%v' is reserved, skipping deallocation", svcName)
|
||||
}
|
||||
|
||||
return service.NewUnshareOK()
|
||||
|
Loading…
Reference in New Issue
Block a user