Skip to content

Commit

Permalink
Send filename when creating and updating
Browse files Browse the repository at this point in the history
Calling [Style.create](https://github.com/samvera-labs/geoserver-publish/blob/aec7c64311a17e2e948dd43b6523fdcc604d2837/lib/geoserver/publish/style.rb#L28-L32) without a filename causes Geoserver to throw a 500 error. This commit supplies a filename using the layer name + the ".sld" extension.

Fixes #860
  • Loading branch information
edsu committed Mar 15, 2024
1 parent 79a7be3 commit a2d1f34
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Expand Up @@ -24,7 +24,7 @@ Metrics/CyclomaticComplexity:
# Offense count: 22
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 126
Max: 127

# Offense count: 1
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
Expand Down
5 changes: 3 additions & 2 deletions lib/robots/dor_repo/gis_delivery/load_geoserver.rb
Expand Up @@ -232,8 +232,9 @@ def create_raster(connection, workspace_name)
logger.debug "load-geoserver: #{bare_druid} loaded style #{raster_style}"
if style_exists.nil?
logger.debug "load-geoserver: #{bare_druid} saving new style #{raster_style}"
style.create(style_name: raster_style, filename: nil)
style.update(style_name: raster_style, filename: nil, payload: sldtxt)
filename = "#{raster_style}.sld"
style.create(style_name: raster_style, filename:)
style.update(style_name: raster_style, filename:, payload: sldtxt)
end
else
raster_style = 'raster_grayband' # a simple band-oriented histogram adjusted style
Expand Down
4 changes: 2 additions & 2 deletions spec/robots/dor_repo/gis_delivery/load_geoserver_spec.rb
Expand Up @@ -909,8 +909,8 @@

it 'runs without error and updates style with correct payload' do
test_perform(robot, druid)
expect(style).to have_received(:create).with(style_name: "raster_#{druid}", filename: nil)
expect(style).to have_received(:update).with(style_name: "raster_#{druid}", filename: nil, payload:)
expect(style).to have_received(:create).with(style_name: "raster_#{druid}", filename: "raster_#{druid}.sld")
expect(style).to have_received(:update).with(style_name: "raster_#{druid}", filename: "raster_#{druid}.sld", payload:)
end
end

Expand Down

0 comments on commit a2d1f34

Please sign in to comment.