[GeoNode-users] Failed to save to Geoserver catalog: 500, Store already exists in workspace 'geonode'.

Israel López asralf at gmail.com
Thu Aug 29 16:07:15 PDT 2019


Hi Alessio the output is this:

configparser==3.7.1
geoserver-restconfig==1.0.1
gsconfig==1.0.10

I don't how but after typing the mail I found a temporary solution, it's a
little bit rare
but it works, and let me upload shapes again, the fix was:

 geonode/geoserver/helpers.py
<https://github.com/CentroGeo/geonode/commit/132e526d65c2945a784449579751014fa6018068#diff-c0e1c8cea0b01d04a691f88381580c4f>

try:
if dsname:
ds = cat.get_store(dsname)
# Solucion temporal para que suba capas
ds = cat.get_store(dsname, 'geonode')
else:
return None

and take this commit as example Fixes #4639
<https://github.com/GeoNode/geonode/issues/4639>]...
geonode/geoserver/createlayer/utils.py
<https://github.com/GeoNode/geonode/commit/92ed66c7d6e20147414e9a28a3f63f43ba0b76fd#diff-0053b8cd8b27f4121d4ec869d9e69709>

try:
ds = cat.get_store(dsname, workspace)
ds = cat.get_store(dsname, workspace=workspace)
except FailedRequestError:


El jue., 29 de ago. de 2019 a la(s) 06:09, Alessio Fabiani (
alessio.fabiani at geo-solutions.it) escribió:

> Hi,
> uhm that's very strange. Could you please run the following command and
> tell me the output?
>
> pip freeze | grep -i config
>
> Il giorno mar 27 ago 2019 alle ore 01:39 Israel López <asralf at gmail.com>
> ha scritto:
>
>> Hi guys, I'm testing de 2.10.0-release branch on a Ubuntu installation
>> dev mode (no docker), when the local_settings.py.geoserver.sample is edited
>> and assign postgres databases, I got
>> this error when I'm trying to upload a second shape. The first time
>> everything is ok,
>> but in the second time I get this error always, I've tried to with clean
>> databases again
>> and always is the same.
>>
>> Does I'm doing something wrong??
>>
>> The error says:
>>
>> Traceback (most recent call last):
>>   File "/home/israel/Proyectos/geonode/geonode/upload/views.py", line
>> 650, in view
>>     resp = _steps[step](req, upload_session)
>>   File "/home/israel/Proyectos/geonode/geonode/upload/views.py", line
>> 425, in check_step_view
>>     return next_step_response(request, upload_session)
>>   File "/home/israel/Proyectos/geonode/geonode/upload/utils.py", line
>> 382, in next_step_response
>>     return run_response(req, upload_session)
>>   File "/home/israel/Proyectos/geonode/geonode/upload/utils.py", line
>> 618, in run_response
>>     run_import(upload_session)
>>   File "/home/israel/Proyectos/geonode/geonode/upload/utils.py", line
>> 584, in run_import
>>     store_name=ogc_server_settings.datastore_db['NAME']
>>   File "/home/israel/Proyectos/geonode/geonode/geoserver/helpers.py",
>> line 1293, in create_geoserver_db_featurestore
>>     cat.save(ds)
>>   File
>> "/home/israel/.virtualenvs/forkGeonode/local/lib/python2.7/site-packages/geoserver/catalog.py",
>> line 290, in save
>>     raise FailedRequestError('Failed to save to Geoserver catalog: {},
>> {}'.format(resp.status_code, resp.text))
>> FailedRequestError: Failed to save to Geoserver catalog: 500, Store
>> 'base1_data' already exists in workspace 'geonode'
>>
>> I've found that the next line can't get the datastore and tries to create
>> it again,
>> so then raises the error.
>>
>> helpers.py line 1248
>>
>> if dsname:
>>     ds = cat.get_store(dsname)
>>
>> My local_settings.py
>>
>> import ast
>> import os
>> from urlparse import urlparse, urlunparse
>> from geonode.settings import *
>>
>> PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
>>
>> MEDIA_ROOT = os.getenv('MEDIA_ROOT', os.path.join(PROJECT_ROOT, "uploaded"))
>>
>> STATIC_ROOT = os.getenv('STATIC_ROOT',
>>                         os.path.join(PROJECT_ROOT, "static_root")
>>                         )
>>
>> TIME_ZONE = 'UTC'
>>
>> # Backend
>> DATABASES = {
>>     'default': {
>>         'ENGINE': 'django.db.backends.postgresql_psycopg2',
>>         'NAME': 'base1',
>>         'USER': 'idegeo',
>>         'PASSWORD': 'idegeo',
>>         'HOST': 'localhost',
>>         'PORT': '5432',
>>         'CONN_TOUT': 900,
>>     },
>>     # vector datastore for uploads
>>     'datastore': {
>>         'ENGINE': 'django.contrib.gis.db.backends.postgis',
>>         # 'ENGINE': '', # Empty ENGINE name disables
>>         'NAME': 'base1_data',
>>         'USER': 'idegeo',
>>         'PASSWORD': 'idegeo',
>>         'HOST': 'localhost',
>>         'PORT': '5432',
>>         'CONN_TOUT': 900,
>>     }
>> }
>>
>> GEOSERVER_LOCATION = os.getenv(
>>     'GEOSERVER_LOCATION', 'http://localhost:8080/geoserver/'
>> )
>>
>> GEOSERVER_PUBLIC_HOST = os.getenv(
>>     'GEOSERVER_PUBLIC_HOST', SITE_HOST_NAME
>> )
>>
>> GEOSERVER_PUBLIC_PORT = os.getenv(
>>     'GEOSERVER_PUBLIC_PORT', 8080
>> )
>>
>> _default_public_location = 'http://{}:{}/geoserver/'.format(GEOSERVER_PUBLIC_HOST, GEOSERVER_PUBLIC_PORT) if GEOSERVER_PUBLIC_PORT else 'http://{}/geoserver/'.format(GEOSERVER_PUBLIC_HOST)
>>
>> GEOSERVER_WEB_UI_LOCATION = os.getenv(
>>     'GEOSERVER_WEB_UI_LOCATION', GEOSERVER_LOCATION
>> )
>>
>> GEOSERVER_PUBLIC_LOCATION = os.getenv(
>>     'GEOSERVER_PUBLIC_LOCATION', _default_public_location
>> )
>>
>> OGC_SERVER_DEFAULT_USER = os.getenv(
>>     'GEOSERVER_ADMIN_USER', 'admin'
>> )
>>
>> OGC_SERVER_DEFAULT_PASSWORD = os.getenv(
>>     'GEOSERVER_ADMIN_PASSWORD', 'geoserver'
>> )
>>
>> # OGC (WMS/WFS/WCS) Server Settings
>> OGC_SERVER = {
>>     'default': {
>>         'BACKEND': 'geonode.geoserver',
>>         'LOCATION': GEOSERVER_LOCATION,
>>         'WEB_UI_LOCATION': GEOSERVER_WEB_UI_LOCATION,
>>         'LOGIN_ENDPOINT': 'j_spring_oauth2_geonode_login',
>>         'LOGOUT_ENDPOINT': 'j_spring_oauth2_geonode_logout',
>>         # PUBLIC_LOCATION needs to be kept like this because in dev mode
>>         # the proxy won't work and the integration tests will fail
>>         # the entire block has to be overridden in the local_settings
>>         'PUBLIC_LOCATION': GEOSERVER_PUBLIC_LOCATION,
>>         'USER': OGC_SERVER_DEFAULT_USER,
>>         'PASSWORD': OGC_SERVER_DEFAULT_PASSWORD,
>>         'MAPFISH_PRINT_ENABLED': True,
>>         'PRINT_NG_ENABLED': True,
>>         'GEONODE_SECURITY_ENABLED': True,
>>         'GEOFENCE_SECURITY_ENABLED': True,
>>         'WMST_ENABLED': False,
>>         'BACKEND_WRITE_ENABLED': True,
>>         'WPS_ENABLED': False,
>>         'LOG_FILE': '%s/geoserver/data/logs/geoserver.log' % os.path.abspath(os.path.join(PROJECT_ROOT, os.pardir)),
>>         # Set to dictionary identifier of database containing spatial data in DATABASES dictionary to enable
>>         'DATASTORE': 'datastore',
>>         'TIMEOUT': int(os.getenv('OGC_REQUEST_TIMEOUT', '5')),
>>         'MAX_RETRIES': int(os.getenv('OGC_REQUEST_MAX_RETRIES', '5')),
>>         'BACKOFF_FACTOR': float(os.getenv('OGC_REQUEST_BACKOFF_FACTOR', '0.3')),
>>         'POOL_MAXSIZE': int(os.getenv('OGC_REQUEST_POOL_MAXSIZE', '10')),
>>         'POOL_CONNECTIONS': int(os.getenv('OGC_REQUEST_POOL_CONNECTIONS', '10')),
>>     }
>> }
>>
>> # WARNING: Map Editing is affected by this. GeoExt Configuration is cached for 5 minutes
>> # CACHES = {
>> #     'default': {
>> #         'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
>> #         'LOCATION': '/var/tmp/django_cache',
>> #     }
>> # }
>>
>> # If you want to enable Mosaics use the following configuration
>> UPLOADER = {
>>     # 'BACKEND': 'geonode.rest',
>>     'BACKEND': 'geonode.importer',
>>     'OPTIONS': {
>>         'TIME_ENABLED': True,
>>         'MOSAIC_ENABLED': False,
>>     },
>>     'SUPPORTED_CRS': [
>>         'EPSG:4326',
>>         'EPSG:3785',
>>         'EPSG:3857',
>>         'EPSG:32647',
>>         'EPSG:32736'
>>     ],
>>     'SUPPORTED_EXT': [
>>         '.shp',
>>         '.csv',
>>         '.kml',
>>         '.kmz',
>>         '.json',
>>         '.geojson',
>>         '.tif',
>>         '.tiff',
>>         '.geotiff',
>>         '.gml',
>>         '.xml'
>>     ]
>> }
>>
>> # CSW settings
>> CATALOGUE = {
>>     'default': {
>>         # The underlying CSW implementation
>>         # default is pycsw in local mode (tied directly to GeoNode Django DB)
>>         'ENGINE': 'geonode.catalogue.backends.pycsw_local',
>>         # pycsw in non-local mode
>>         # 'ENGINE': 'geonode.catalogue.backends.pycsw_http',
>>         # GeoNetwork opensource
>>         # 'ENGINE': 'geonode.catalogue.backends.geonetwork',
>>         # deegree and others
>>         # 'ENGINE': 'geonode.catalogue.backends.generic',
>>
>>         # The FULLY QUALIFIED base url to the CSW instance for this GeoNode
>>         'URL': urljoin(SITEURL, '/catalogue/csw'),
>>         # 'URL': 'http://localhost:8080/geonetwork/srv/en/csw',
>>         # 'URL': 'http://localhost:8080/deegree-csw-demo-3.0.4/services',
>>
>>         # login credentials (for GeoNetwork)
>>         # 'USER': 'admin',
>>         # 'PASSWORD': 'admin',
>>
>>         # 'ALTERNATES_ONLY': True,
>>     }
>> }
>>
>> # pycsw settings
>> PYCSW = {
>>     # pycsw configuration
>>     'CONFIGURATION': {
>>         # uncomment / adjust to override server config system defaults
>>         # 'server': {
>>         #    'maxrecords': '10',
>>         #    'pretty_print': 'true',
>>         #    'federatedcatalogues': 'http://catalog.data.gov/csw'
>>         # },
>>         'server': {
>>             'home': '.',
>>             'url': CATALOGUE['default']['URL'],
>>             'encoding': 'UTF-8',
>>             'language': LANGUAGE_CODE,
>>             'maxrecords': '20',
>>             'pretty_print': 'true',
>>             # 'domainquerytype': 'range',
>>             'domaincounts': 'true',
>>             'profiles': 'apiso,ebrim',
>>         },
>>         'manager': {
>>             # authentication/authorization is handled by Django
>>             'transactions': 'false',
>>             'allowed_ips': '*',
>>             # 'csw_harvest_pagesize': '10',
>>         },
>>         'metadata:main': {
>>             'identification_title': 'GeoNode Catalogue',
>>             'identification_abstract': 'GeoNode is an open source platform' \
>>             ' that facilitates the creation, sharing, and collaborative use' \
>>             ' of geospatial data',
>>             'identification_keywords': 'sdi, catalogue, discovery, metadata,' \
>>             ' GeoNode',
>>             'identification_keywords_type': 'theme',
>>             'identification_fees': 'None',
>>             'identification_accessconstraints': 'None',
>>             'provider_name': 'Organization Name',
>>             'provider_url': SITEURL,
>>             'contact_name': 'Lastname, Firstname',
>>             'contact_position': 'Position Title',
>>             'contact_address': 'Mailing Address',
>>             'contact_city': 'City',
>>             'contact_stateorprovince': 'Administrative Area',
>>             'contact_postalcode': 'Zip or Postal Code',
>>             'contact_country': 'Country',
>>             'contact_phone': '+xx-xxx-xxx-xxxx',
>>             'contact_fax': '+xx-xxx-xxx-xxxx',
>>             'contact_email': 'Email Address',
>>             'contact_url': 'Contact URL',
>>             'contact_hours': 'Hours of Service',
>>             'contact_instructions': 'During hours of service. Off on ' \
>>             'weekends.',
>>             'contact_role': 'pointOfContact',
>>         },
>>         'metadata:inspire': {
>>             'enabled': 'true',
>>             'languages_supported': 'eng,gre',
>>             'default_language': 'eng',
>>             'date': 'YYYY-MM-DD',
>>             'gemet_keywords': 'Utility and governmental services',
>>             'conformity_service': 'notEvaluated',
>>             'contact_name': 'Organization Name',
>>             'contact_email': 'Email Address',
>>             'temp_extent': 'YYYY-MM-DD/YYYY-MM-DD',
>>         }
>>     }
>> }
>>
>> LOGGING = {
>>     'version': 1,
>>     'disable_existing_loggers': True,
>>     'formatters': {
>>         'verbose': {
>>             'format': '%(levelname)s %(asctime)s %(module)s %(process)d '
>>                       '%(thread)d %(message)s'
>>         },
>>         'simple': {
>>             'format': '%(message)s',
>>         },
>>     },
>>     'filters': {
>>         'require_debug_false': {
>>             '()': 'django.utils.log.RequireDebugFalse'
>>         }
>>     },
>>     'handlers': {
>>         'console': {
>>             'level': 'DEBUG',
>>             'class': 'logging.StreamHandler',
>>             'formatter': 'simple'
>>         },
>>         'mail_admins': {
>>             'level': 'ERROR',
>>             'filters': ['require_debug_false'],
>>             'class': 'django.utils.log.AdminEmailHandler',
>>         }
>>     },
>>     "loggers": {
>>         "django": {
>>             "handlers": ["console"], "level": "ERROR", },
>>         "geonode": {
>>             "handlers": ["console"], "level": "INFO", },
>>         "geonode.qgis_server": {
>>             "handlers": ["console"], "level": "ERROR", },
>>         "gsconfig.catalog": {
>>             "handlers": ["console"], "level": "ERROR", },
>>         "owslib": {
>>             "handlers": ["console"], "level": "ERROR", },
>>         "pycsw": {
>>             "handlers": ["console"], "level": "INFO", },
>>         "celery": {
>>             'handlers': ["console"], 'level': 'ERROR', },
>>     },
>> }
>>
>> # Additional settings
>> X_FRAME_OPTIONS = 'ALLOW-FROM %s' % SITEURL
>> CORS_ORIGIN_ALLOW_ALL = True
>>
>> GEOIP_PATH = "/usr/local/share/GeoIP"
>>
>> ACCOUNT_OPEN_SIGNUP = True
>> ACCOUNT_APPROVAL_REQUIRED = True
>>
>> Could you help me, thanks in advance.
>>
>>
>> _______________________________________________
>> geonode-users mailing list
>> geonode-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/geonode-users
>>
>
>
> --
>
> ==
>
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/it488V for more information.
> ==
> Ing. Alessio Fabiani
>
> @alfa7691
> Founder/Technical Lead
>
>
> GeoSolutions S.A.S.
> Via di Montramito 3/A - 55054  Massarosa (LU) - Italy
> phone: +39 0584 962313
> fax:     +39 0584 1660272
> mob:   +39 331 6233686
>
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
> -------------------------------------------------------
>
> Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
> 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
> precisa che ogni circostanza inerente alla presente email (il suo
> contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
> riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
> messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
> operazione è illecita. Le sarei comunque grato se potesse darmene notizia.
>
>
> This email is intended only for the person or entity to which it is
> addressed and may contain information that is privileged, confidential or
> otherwise protected from disclosure. We remind that - as provided by
> European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
> e-mail or the information herein by anyone other than the intended
> recipient is prohibited. If you have received this email by mistake, please
> notify us immediately by telephone or e-mail.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20190829/ca5cbabd/attachment-0001.html>


More information about the geonode-users mailing list