[GeoNode-users] Problem with GeoFence permissions

Paolo Corti pcorti at gmail.com
Tue Mar 6 06:37:03 PST 2018


Daniel
remove the try block, and paste here the error trace stack
ps: to debug with the shell, you must use "django-admin shell" command
(which is "geonode shell" if you are using the Ubuntu package, I
believe)
thanks
Paolo

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



-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti


More information about the geonode-users mailing list