added handling of a duplicate request to create a namespace
This commit is contained in:
parent
ba8e7d3169
commit
067947862c
@ -316,6 +316,7 @@ func (o *BookingController) Post() {
|
||||
|
||||
logger.Info().Msg("Creating new namespace : " + resp.ExecutionsID)
|
||||
if err := o.createNamespace(resp.ExecutionsID); err != nil {
|
||||
logger.Debug().Msg("Error when creating a namespace")
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
|
||||
@ -443,13 +444,16 @@ func (o *BookingController) createNamespace(ns string) error {
|
||||
* It takes the following parameters:
|
||||
* - ns: the namespace you want to create
|
||||
*/
|
||||
logger := oclib.GetLogger()
|
||||
|
||||
serv, err := infrastructure.NewService()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
ok, err := serv.GetNamespace(o.Ctx.Request.Context(), ns)
|
||||
if ok == nil && err == nil {
|
||||
if ok != nil && err == nil {
|
||||
logger.Debug().Msg("A namespace with name " + ns + " already exists")
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user