<div dir="ltr"><div><div><div><div><div>Hi Paolo,<br><br></div>There are 2 print statements in the except block. The first prints the error and the second is the one that complains about the variable 'perm_spec' referenced before assignment.<br><br></div>If I comment out just the second print statement I the following message printed to the screen, one for each layer registered in GeoServer<br><br>('Unexpected error:', <type 'exceptions.AttributeError'>)<br><br></div>I tried to run the commands in a python interpreter to debug this. But I could not get the environment set. When I import the geonode.layers.models in the interpreter, it complains about django_settings_module. <br><br></div>Cheers<br></div>Daniel<br></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Mar 5, 2018 at 10:08 PM Paolo Corti <<a href="mailto:pcorti@gmail.com">pcorti@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Daniel<br>
can you try to remove the line with the print statement and see what<br>
kind of error is raising?<br>
<br>
Paolo<br>
<br>
On Mon, Mar 5, 2018 at 12:26 PM, Daniel Victoria<br>
<<a href="mailto:daniel.victoria@gmail.com" target="_blank">daniel.victoria@gmail.com</a>> wrote:<br>
> Hi Paolo,<br>
><br>
> Thanks for the tip. However, I installed GeoNode from the APT repository and<br>
> I have no idea how to upgrade GeoNode or change GeoFence store from H2 to<br>
> PostgreSQL.<br>
><br>
> I also added time.sleep(5) in sync_geofence.py, right before the try block<br>
> but I'm still getting an error: It fails with the message:<br>
><br>
> ('Unexpected error:', <type 'exceptions.AttributeError'>)<br>
> Traceback (most recent call last):<br>
> File "/usr/bin/django-admin", line 21, in <module><br>
> management.execute_from_command_line()<br>
> File<br>
> "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line<br>
> 354, in execute_from_command_line<br>
> utility.execute()<br>
> File<br>
> "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line<br>
> 346, in execute<br>
> self.fetch_command(subcommand).run_from_argv(self.argv)<br>
> File "/usr/lib/python2.7/dist-packages/django/core/management/base.py",<br>
> line 394, in run_from_argv<br>
> self.execute(*args, **cmd_options)<br>
> File "/usr/lib/python2.7/dist-packages/django/core/management/base.py",<br>
> line 445, in execute<br>
> output = self.handle(*args, **options)<br>
> File<br>
> "/usr/local/lib/python2.7/dist-packages/geonode/geoserver/management/commands/sync_geofence.py",<br>
> line 60, in handle<br>
> print 'perm_spec is %s' % perm_spec<br>
> UnboundLocalError: local variable 'perm_spec' referenced before assignment<br>
><br>
> Any other tips on how to fix this permission mess-up?<br>
><br>
> Thanks<br>
> Daniel<br>
><br>
> On Mon, Mar 5, 2018 at 12:13 PM Paolo Corti <<a href="mailto:pcorti@gmail.com" target="_blank">pcorti@gmail.com</a>> wrote:<br>
>><br>
>> Another option could be to run a time.sleep for some seconds after<br>
>> each layer iteration in sync_geofence command<br>
>> cheers<br>
>> Paolo<br>
>><br>
>> On Mon, Mar 5, 2018 at 10:04 AM, Paolo Corti <<a href="mailto:pcorti@gmail.com" target="_blank">pcorti@gmail.com</a>> wrote:<br>
>> > Hi Daniel<br>
>> ><br>
>> > You seem to have hit this bug which I reported to GeoFence team in the<br>
>> > past:<br>
>> > <a href="https://github.com/geoserver/geofence/issues/98" rel="noreferrer" target="_blank">https://github.com/geoserver/geofence/issues/98</a><br>
>> ><br>
>> > I didn't notice this happening in latest GeoFence version, so<br>
>> > upgrading to latest GeoNode could be an option.<br>
>> > Or you could try to use PostgreSQL instead than H2 as a GeoFence store<br>
>> ><br>
>> > hope this helps<br>
>> ><br>
>> > cheers<br>
>> > Paolo<br>
>> ><br>
>> > On Mon, Mar 5, 2018 at 9:19 AM, Daniel Victoria<br>
>> > <<a href="mailto:daniel.victoria@gmail.com" target="_blank">daniel.victoria@gmail.com</a>> wrote:<br>
>> >> Update: Apparently, if I update the layer permissions in the web<br>
>> >> interface<br>
>> >> or if i run `geonode updatelayers -f <layer_name>`, the correct<br>
>> >> GeoFence<br>
>> >> permissions are created. Thus, doing so a layer at a time works. But<br>
>> >> several<br>
>> >> layers at once, no.<br>
>> >><br>
>> >> What should I look for in the GeoServer log to try to figure out where<br>
>> >> the<br>
>> >> problem is occurring? I can attach the GeoServer log if that helps.<br>
>> >><br>
>> >> Cheers<br>
>> >> Daniel<br>
>> >><br>
>> >> On Mon, Mar 5, 2018 at 9:52 AM Daniel Victoria<br>
>> >> <<a href="mailto:daniel.victoria@gmail.com" target="_blank">daniel.victoria@gmail.com</a>><br>
>> >> wrote:<br>
>> >>><br>
>> >>> Hi list,<br>
>> >>><br>
>> >>> I have GeoNode 2.6.3, installed from apt, in a Ubuntu machine. Right<br>
>> >>> now i<br>
>> >>> have 108 registered layers, some imported using the web interface,<br>
>> >>> some<br>
>> >>> using the `geonode importlayers` command.<br>
>> >>><br>
>> >>> Last week I noticed that some of the layers I was importing using the<br>
>> >>> management command had view permission problems. I realized that the<br>
>> >>> cause<br>
>> >>> was that the GeoFence rules were not being created correctly.<br>
>> >>><br>
>> >>> Looking at the messages on the list, I saw that there were some<br>
>> >>> discussions about this issue and that 1) there was a patch for<br>
>> >>> geoserver/helper.py [1] and 2) a new `sync_geofence` management<br>
>> >>> command.<br>
>> >>><br>
>> >>> I applied the patch and downloaded the `sync_geofence` command.<br>
>> >>><br>
>> >>> Now, every time I run `geonode updatelayers` I end up with a different<br>
>> >>> set<br>
>> >>> of rules in GeoFence. Some times with 106 rules, some times with 209<br>
>> >>> rules<br>
>> >>> etc. And I can't run `geonode sync_geofence` since I'm getting an<br>
>> >>> error:<br>
>> >>><br>
>> >>> UnboundLocalError: local variable 'perm_spec' referenced before<br>
>> >>> assignment<br>
>> >>><br>
>> >>> Any idea how to fix this issue so I don't have to manually create the<br>
>> >>> GeoFence rules? And also, not have `geonode updatelayers` mess up the<br>
>> >>> rules<br>
>> >>> already created?<br>
>> >>><br>
>> >>> Cheers<br>
>> >>> Daniel<br>
>> >>><br>
>> >>> [1] -<br>
>> >>><br>
>> >>> <a href="https://github.com/GeoNode/geonode/commit/94b3b6abfd1bc856be94eb58f5bf13" rel="noreferrer" target="_blank">https://github.com/GeoNode/geonode/commit/94b3b6abfd1bc856be94eb58f5bf13</a><br>
>> >><br>
>> >><br>
>> >> _______________________________________________<br>
>> >> geonode-users mailing list<br>
>> >> <a href="mailto:geonode-users@lists.osgeo.org" target="_blank">geonode-users@lists.osgeo.org</a><br>
>> >> <a href="https://lists.osgeo.org/mailman/listinfo/geonode-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/geonode-users</a><br>
>> >><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Paolo Corti<br>
>> > Geospatial software developer<br>
>> > web: <a href="http://www.paolocorti.net" rel="noreferrer" target="_blank">http://www.paolocorti.net</a><br>
>> > twitter: @capooti<br>
>> > skype: capooti<br>
>><br>
>><br>
>><br>
>> --<br>
>> Paolo Corti<br>
>> Geospatial software developer<br>
>> web: <a href="http://www.paolocorti.net" rel="noreferrer" target="_blank">http://www.paolocorti.net</a><br>
>> twitter: @capooti<br>
>> skype: capooti<br>
<br>
<br>
<br>
--<br>
Paolo Corti<br>
Geospatial software developer<br>
web: <a href="http://www.paolocorti.net" rel="noreferrer" target="_blank">http://www.paolocorti.net</a><br>
twitter: @capooti<br>
skype: capooti<br>
</blockquote></div>