Skip to content

Commit

Permalink
[Fixes #9669] Updatelayers unexpectedly fails if layer is 'None' (#9670
Browse files Browse the repository at this point in the history
…) (#9671)

Co-authored-by: Alessio Fabiani <[email protected]>
  • Loading branch information
github-actions[bot] and afabiani authored Jul 15, 2022
1 parent 77eb339 commit a07d8e2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion geonode/geoserver/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,8 @@ def gs_slurp(
cat.save(resource)
except Exception as e:
# Hide the resource until finished
layer.set_processing_state("FAILED")
if layer:
layer.set_processing_state("FAILED")
if ignore_errors:
status = 'failed'
exception_type, error, traceback = sys.exc_info()
Expand All @@ -787,6 +788,15 @@ def gs_slurp(
msg = "Stopping process because --ignore-errors was not set and an error was found."
print(msg, file=sys.stderr)
raise Exception(f"Failed to process {resource.name}") from e
if layer is None:
if ignore_errors:
status = 'failed'
exception_type, error, traceback = sys.exc_info()
else:
if verbosity > 0:
msg = "Stopping process because --ignore-errors was not set and an error was found."
print(msg, file=sys.stderr)
raise Exception(f"Failed to process {resource.name}")
else:
if created:
if not permissions:
Expand Down

0 comments on commit a07d8e2

Please sign in to comment.