def store_name(sync_job):
    if sync_job["job_type"] == "live_store":
        return sync_job["name"]
    elif sync_job["job_type"] == "live_layer":
        return sync_job["datastore"]
    elif sync_job["job_type"] == "feature":
        return GEOSERVER_DATASTORE_NAMESPACE.format(sync_job["workspace"])
    else:
        raise Exception("{} not support".format(sync_job["job_type"]))
Exemplo n.º 2
0
)
from slave_sync_task import (
    update_feature_job,
    update_metadata_feature_job,
    gs_feature_task_filter,
    remove_feature_job,
    gs_style_task_filter,
    update_access_rules_job,
    update_wmsstore_job,
    gs_task_filter,
    update_layergroup_job,
)

logger = logging.getLogger(__name__)

store_name = lambda sync_job: GEOSERVER_DATASTORE_NAMESPACE.format(sync_job["workspace"])

task_workspace_name = lambda t: t["workspace"]
task_store_name = lambda sync_job: "{0}:{1}".format(
    sync_job["workspace"], GEOSERVER_DATASTORE_NAMESPACE.format(sync_job["workspace"])
)
task_feature_name = lambda sync_job: "{0}:{1}".format(sync_job["workspace"], sync_job["name"])
task_style_name = lambda sync_job: "{0}:{1}".format(sync_job["workspace"], sync_job["name"])


def get_datastore(sync_job):
    d_gs = gs.get_store(store_name(sync_job))

    if not d_gs:
        raise Exception("Datastore ({0}) does not exist".format(store_name(sync_job)))