Bug 49609 - join-script 40ucs-school-import-http-api will fail due to issue with 'import logging'
Summary: join-script 40ucs-school-import-http-api will fail due to issue with 'import ...
Status: CLOSED FIXED
Alias: None
Product: UCS@school
Classification: Unclassified
Component: HTTP-API (Kelvin)
Version: UCS@school 4.4
Hardware: Other Linux
: P5 normal
Target Milestone: UCS@school 4.4 v2-errata
Assignee: Jürn Brodersen
QA Contact: Sönke Schwardt-Krummrich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-07 11:17 CEST by Nico Stöckigt
Modified: 2019-06-07 16:39 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 4: A User would return the product
User Pain: 0.343
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2019053121000564
Bug group (optional):
Customer ID: 09753
Max CVSS v3 score:


Attachments
enclose import with try:except:pass (367 bytes, patch)
2019-06-07 11:17 CEST, Nico Stöckigt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nico Stöckigt univentionstaff 2019-06-07 11:17:03 CEST
Created attachment 10056 [details]
enclose import with try:except:pass

The following Traceback occurs:

============================================================
RUNNING 40ucs-school-import-http-api.inst
2019-05-31 15:18:15.677682812+02:00 (in joinscript_init)
Object exists: cn=ucsschoolImportGroup,cn=UCSschool,cn=custom attributes,cn=univention,dc=bbs14,dc=lan
Object exists: cn=ucsschoolSchool-ImportSchool,cn=UCSschool,cn=custom attributes,cn=univention,dc=bbs14,dc=lan
Object exists: cn=ucsschoolSchool-ImportRole,cn=UCSschool,cn=custom attributes,cn=univention,dc=bbs14,dc=lan
Using existing secret for Django service.
Using existing password for RabbitMQ.
Using existing RabbitMQ user and vhost.
Using existing password for PostgreSQL.
Setting password on existing PostgreSQL user.
ALTER ROLE
Using existing PostgreSQL database.
Traceback (most recent call last):
  File "/usr/share/pyshared/ucsschool/http_api/manage.py", line 23, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.7/dist-packages/django/core/management/commands/check.py", line 68, in handle
    fail_level=getattr(checks, options['fail_level']),
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 374, in check
    include_deployment_checks=include_deployment_checks,
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 361, in _run_checks
    return checks.run_checks(**kwargs)
  File "/usr/lib/python2.7/dist-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/usr/lib/python2.7/dist-packages/django/core/checks/urls.py", line 14, in check_url_config
    return check_resolver(resolver)
  File "/usr/lib/python2.7/dist-packages/django/core/checks/urls.py", line 24, in check_resolver
    for pattern in resolver.url_patterns:
  File "/usr/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/lib/python2.7/dist-packages/django/urls/resolvers.py", line 315, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/lib/python2.7/dist-packages/django/urls/resolvers.py", line 308, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/lib/pymodules/python2.7/ucsschool/http_api/app/urls.py", line 41, in <module>
    from ..import_api import views
  File "/usr/lib/pymodules/python2.7/ucsschool/http_api/import_api/views.py", line 58, in <module>
    from .serializers import (
  File "/usr/lib/pymodules/python2.7/ucsschool/http_api/import_api/serializers.py", line 52, in <module>
    from .tasks import dry_run, import_users
  File "/usr/lib/pymodules/python2.7/ucsschool/http_api/import_api/tasks.py", line 52, in <module>
    from .http_api_import_frontend import HttpApiImportFrontend
  File "/usr/lib/pymodules/python2.7/ucsschool/http_api/import_api/http_api_import_frontend.py", line 45, in <module>
    from ucsschool.importer.frontend.user_import_cmdline import UserImportCommandLine
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/frontend/user_import_cmdline.py", line 36, in <module>
    from .cmdline import CommandLine
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/frontend/cmdline.py", line 38, in <module>
    
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/utils/logging.py", line 34, in <module>
    from __future__ import absolute_import
ImportError: cannot import name logger

EXITCODE=1
============================================================

As far as I understand this, the module is already imported due to changes with logging in general. When enclosing the import in a 'try:except:pass' the script runs successfully. (see patch)
Comment 1 Jürn Brodersen univentionstaff 2019-06-07 14:48:47 CEST
commit 42a98f20a98cb18b3007d74136834f433a7ac502 (HEAD -> 4.4, origin/4.4)
Author: Jürn Brodersen <brodersen@univention.de>
Date:   Fri Jun 7 14:36:48 2019 +0200

    Bug #49609: yaml

commit 731d199061d2cffb969f9035fd1a0b3928cbc4a5
Author: Jürn Brodersen <brodersen@univention.de>
Date:   Fri Jun 7 13:58:16 2019 +0200

    Bug #49609: Update byte compiled python files after upgrade from 4.3
    
    Due to the same timestamp in 4.3 and 4.4 in the changelog for this
    package, the byte compiled python files (*.pyc) were not updated by
    pysupport. That resulted in multiple tracebacks due to python still
    using the old byte compiled files, because the timestamp was the same
    for python files from this package in 4.4 and 4.3.


Package: ucs-school-umc-import
Version: 2.0.0-2A~4.4.0.201906071429
Branch: ucs_4.4-0
Scope: ucs-school-4.4

Package: ucs-school-import
Version: 17.0.6-21A~4.4.0.201906071431
Branch: ucs_4.4-0
Scope: ucs-school-4.4
Comment 2 Sönke Schwardt-Krummrich univentionstaff 2019-06-07 16:26:51 CEST
OK: code change
OK: changelog entry
OK: advisory
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2019-06-07 16:39:13 CEST
If this error occurs again, please clone this bug.

UCS@school 4.4 v2 has been released.

https://docs.software-univention.de/changelog-ucsschool-4.4v2-de.html