[Geoserver-devel] [JIRA] (GEOS-8339) Community Scripting Plugin looks for WFS TX Hooks in wrong place

Tom Feist-Hassan created an issue

GeoServer / BugGEOS-8339

Community Scripting Plugin looks for WFS TX Hooks in wrong place

Issue Type:

BugBug

Affects Versions:

2.11.0, 2.12.0

Assignee:

Unassigned

Components:

Community modules

Created:

12/Oct/17 2:53 PM

Priority:

LowLow

Reporter:

Tom Feist-Hassan

Summary

Documentation for the scripting plugin’s scripting hooks states that WFS transaction hook scripts should be placed in the DATA_DIR/scripts/wfs/tx directory. Scripts placed here are not executed as expected.

The correct location is actually DATA_DIR/scripts/scripts/wfs/tx.

Steps to Reproduce- Install community python-scripting plugin

  • add any valid script to scripts/wfs/tx, e.g.:

    from org.geoserver.wfs import WFSException
    def begin(*args, **kwargs):
      raise WFSException("hook was called")
    
    
  • Make a WFS-T request

  • Observe exception is not triggered, hook was not called.

  • Place same file in DATA_DIR/scripts/scripts/wfs/tx

  • Repeat request

  • Hook now triggers

Expected behaviour

I would probably expect that the documented scripts/wfs/tx/ dir be the correct location, since that is in line with the other script-hook directories such as scripts/wps/ and scripts/function/,
but changing this dir might now break existing working installations that use these hooks.

Investigation

The cause of the problem seems to be the wfsTx() method in ScriptManager.java, which is already rooted under DATA_DIR/scripts, but adds an additional scripts/ itself. The other location methods don’t do this.

I’m not sure if it’s actually possible to manipulate scripts in the correct location via the scripting-REST API, but the script-web module that integrates with geoserver admin pages does place files in the right place.

Fixes

I can look at making a PR for either removing the duplicated "scripts/" path component in ScriptManager, or just updating the docs to point at the correct location. I’d prefer the former, but don’t want to break compat with existing setups.

Add Comment

Add Comment

Get Jira notifications on your phone! Download the Jira Cloud app for Android or iOS


This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100065-sha1:640eedb)

Atlassian logo