GeoNode/geonode — pull request #1250 by mwengren (2013-11-01 20:49:05+00:00)
Title: Add --remove-deleted option to updatelayers to sync GeoNode layers with deleted/disabled GeoServer layers

The --remove-deleted option provides the following capability:

If any layers in GeoNode don't correspond to a layer in GeoServer (within the same workspace/store), and, if --skip-unavailable option is passed are marked 'unavailable' in GeoServer, remove from GeoNode via Layer.delete().

This allows content in GeoNode to be kept in sync with any changes made downstream in GeoServer.

The --remove-deleted option will work whether or not workspace/store are passed, so you can run an updatelayers call to clean/sync a particular workspace/store if you want, or you can run globally. If no workspace or store is passed, it will first compare layers names in GeoNode with those in GeoServer and remove any GeoNode layers with no name match. If there is a name match, it will check if the layer is within the same workspace/store in GeoNode as it is in GeoServer, and if not remove.

Includes verbose logging to the updatelayers stdout similar to below:

Inspecting the available layers in GeoServer ...
Found 2 layers, starting processing
[updated] Layer severe_thunderstorm_warning (1/2)
[updated] Layer tornado_warning (2/2)

Found 2 layers to delete, starting processing
[delete_succeeded] Layer flash_flood_warning (1/2)
[delete_succeeded] Layer special_marine_warning (2/2)

Detailed report of failures:
Detailed report of layers to be deleted from GeoNode that failed:

Finished processing 2 layers in 13.0 seconds.

0 Created layers
2 Updated layers
0 Failed layers
6.500000 seconds per layer

2 Deleted layers