diff --git a/geo/Geoserver.py b/geo/Geoserver.py index 12be5c1..8caf90b 100644 --- a/geo/Geoserver.py +++ b/geo/Geoserver.py @@ -728,8 +728,14 @@ def create_layergroup( raise Exception( f"Format not supported. Acceptable formats are : {supported_formats}" ) + # check if it already exist in Geoserver - if self.get_layergroup(name) is not None: + try: + existing_layergroup = self.get_layergroup(name) + except: + existing_layergroup = None + + if existing_layergroup is not None: raise Exception( f"Layergroup: {name} already exist in Geoserver instance" )