Proper error should be thrown when server group is created with existing name. Fixes #3693

This commit is contained in:
Aditya Toshniwal 2019-01-15 18:38:01 +05:30 committed by Akshay Joshi
parent 7b0c81126c
commit 2a359d9d77
3 changed files with 7 additions and 0 deletions

View File

@ -9,6 +9,7 @@ for it.
.. toctree::
release_notes_4_2
release_notes_4_1
release_notes_4_0
release_notes_3_6

View File

@ -14,4 +14,5 @@ Features
Bug fixes
*********
| `Bug #3693 <https://redmine.postgresql.org/issues/3693>`_ - Proper error should be thrown when server group is created with existing name.
| `Bug #3695 <https://redmine.postgresql.org/issues/3695>`_ - Ensure long string should be wrap in alertify dialogs.

View File

@ -145,6 +145,7 @@ class ServerGroupView(NodeView):
db.session.delete(sg)
db.session.commit()
except Exception as e:
db.session.rollback()
return make_json_response(
status=410, success=0, errormsg=e.message
)
@ -178,10 +179,12 @@ class ServerGroupView(NodeView):
servergroup.name = data[u'name']
db.session.commit()
except exc.IntegrityError:
db.session.rollback()
return bad_request(gettext(
"The specified server group already exists."
))
except Exception as e:
db.session.rollback()
return make_json_response(
status=410, success=0, errormsg=e.message
)
@ -251,11 +254,13 @@ class ServerGroupView(NodeView):
)
)
except exc.IntegrityError:
db.session.rollback()
return bad_request(gettext(
"The specified server group already exists."
))
except Exception as e:
db.session.rollback()
return make_json_response(
status=410,
success=0,