Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in updatelayers when no default style selected #869

Closed
jj0hns0n opened this issue May 8, 2013 · 15 comments
Closed

Error in updatelayers when no default style selected #869

jj0hns0n opened this issue May 8, 2013 · 15 comments
Assignees

Comments

@jj0hns0n
Copy link
Member

jj0hns0n commented May 8, 2013

If a layer has no default style specified in GeoServer, the following error occurs when running updatelayers.

(geonode)behaim:geonode ortelius$ python manage.py updatelayers
Stopping process because --ignore-errors was not set and an error was found.
Traceback (most recent call last):
File "manage.py", line 28, in
execute_from_command_line(sys.argv)
File "/Users/ortelius/.virtualenvs/geonode/lib/python2.7/site-packages/django/core/management/init.py", line 443, in execute_from_command_line
utility.execute()
File "/Users/ortelius/.virtualenvs/geonode/lib/python2.7/site-packages/django/core/management/init.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/ortelius/.virtualenvs/geonode/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(_args, *_options.dict)
File "/Users/ortelius/.virtualenvs/geonode/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(_args, *_options)
File "/Users/ortelius/projects/geonode-dev/geonode/geonode/layers/management/commands/updatelayers.py", line 57, in handle
owner=owner, console=console, workspace=workspace)
File "/Users/ortelius/projects/geonode-dev/geonode/geonode/geoserver/helpers.py", line 269, in gs_slurp
layer.save()
File "/Users/ortelius/.virtualenvs/geonode/lib/python2.7/site-packages/django/db/models/base.py", line 463, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/Users/ortelius/.virtualenvs/geonode/lib/python2.7/site-packages/django/db/models/base.py", line 565, in save_base
created=(not record_exists), raw=raw, using=using)
File "/Users/ortelius/.virtualenvs/geonode/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 172, in send
response = receiver(signal=self, sender=sender, **named)
File "/Users/ortelius/projects/geonode-dev/geonode/geonode/layers/models.py", line 550, in geoserver_post_save
set_styles(instance, gs_catalog)
File "/Users/ortelius/projects/geonode-dev/geonode/geonode/layers/models.py", line 557, in set_styles
layer.default_style = save_style(default_style)
File "/Users/ortelius/projects/geonode-dev/geonode/geonode/layers/models.py", line 568, in save_style
style, created = Style.objects.get_or_create(name = gs_style.sld_name)
Exception: ('Failed to process test', AttributeError("'NoneType' object has no attribute 'sld_name'",))

@matthewhanson
Copy link
Member

The same error occurs if the default style is in a namespace (although this is more of an issue with gsconfig.py I think which should needs to query all workspaces for styles I guess)

@capooti
Copy link
Member

capooti commented May 10, 2013

Hi, thanks for pointing this out, I have noticed this as well (I think there is already an issue mentioning this).
I cannot fix this right now, but I can take care of it in the next days.

@ghost ghost assigned capooti Jun 22, 2013
@simod
Copy link
Member

simod commented Jun 25, 2013

@capooti this should be closed by the work on styles you did some time ago right?

@capooti
Copy link
Member

capooti commented Jun 27, 2013

@simod no, I think this is a different problem. Cannot figure out, though, under which circumstances a layer in GeoServer does not have a default style.
Though right now if I run updatelayers on a fresh instance with an uploaded layer I get the same error message got by @jj0hns0n (Exception: ('Failed to process countries', AttributeError("'NoneType' object has no attribute 'sld_name'",)))
Working on this and labeling as bug.

@capooti
Copy link
Member

capooti commented Jun 27, 2013

As suggested by @matthewhanson the problem raises when a layer has a style that has been assigned to a workspace. Moving the style out of the workspace fix the problems.
Looking if there is an easy way I can fix the updatelayers command to search in all of the workspaces.

@jj0hns0n
Copy link
Member Author

There is some work in gsconfig that @volaya is workign on ... we should verify these fixes in a new gsconfig release.

@ingenieroariel
Copy link
Member

I made a new gsconfig release. This is ready to be tested again.

@cspanring
Copy link
Contributor

I just tested this with updatelayers against an OpenGeo Suite 3.1 GeoServer containing >100 layers and styles with and without workspaces. Not a single error during updatelayers so far.

@simod
Copy link
Member

simod commented Oct 7, 2013

this is related to #1212, we need to figure out why sometimes the default style is not assigned.

@ingenieroariel
Copy link
Member

Bumping this to critical as the default style ends up generating other kinds of errors and should be dealt with before releasing.

@simod
Copy link
Member

simod commented Nov 8, 2013

@ingenieroariel let's do some more tests but I think that this is solved by our work on local connections between geonode and geoserver.

@ingenieroariel
Copy link
Member

I tried deleting the style on a GeoServer layer and it automatically got a new default style based on the GeoServer built in ones instead of an empty value.

screen shot 2013-11-12 at 9 51 56 am
screen shot 2013-11-12 at 9 52 17 am

Since I am not sure how to replicate I will remove the 2.0 milestone, but @simod it would be great if you can verify we are not doing the wrong thing by punting this instead of letting it be a blocker.

@simod
Copy link
Member

simod commented Nov 12, 2013

@ingenieroariel I tried it after the geoserver connections rework and I was not able to reproduce it anymore.
I think it's safe to let this ticket live around without milestone for a while.

Thanks

@ingenieroariel
Copy link
Member

Closing as it has not been reproduced.

@gannebamm
Copy link
Contributor

Hi,
I have encountered the listed error with GeoNode Version 2.4b28. The layer is an image mosaic with geoservers raster style as default style. Here is the stacktrace:
https://gist.github.com/gannebamm/1e1cd8442f90769d4c31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants