Skip to content

Commit

Permalink
[Hardening] Make gslurp resilient to errors in case 'ignore_errors' h…
Browse files Browse the repository at this point in the history
…as been specified
  • Loading branch information
root committed Sep 23, 2019
1 parent 4d31e91 commit 11b7ae5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions geonode/geoserver/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,12 @@ def gs_slurp(
resources = cat.get_resources(stores=[store])
else:
resources = cat.get_resources(workspaces=[workspace])

elif store is not None:
store = get_store(cat, store)
resources = cat.get_resources(stores=[store])
else:
resources = cat.get_resources()

if remove_deleted:
resources_for_delete_compare = resources[:]
workspace_for_delete_compare = workspace
Expand All @@ -579,7 +579,18 @@ def gs_slurp(
resources = [k for k in resources if filter in k.name]

# filter out layers depending on enabled, advertised status:
resources = [k for k in resources if k.enabled in ["true", True]]
_resources = []
for k in resources:
try:
if k.enabled in ["true", True]:
_resources.append(k)
except BaseException:
if ignore_errors:
continue
else:
raise
# resources = [k for k in resources if k.enabled in ["true", True]]
resources = _resources
if skip_unadvertised:
resources = [k for k in resources if k.advertised in ["true", True]]

Expand Down

0 comments on commit 11b7ae5

Please sign in to comment.