API rest doesn't start

Hi, I’ve set directory/manager/rest/server/address with ip adress, no 127.0.0.1, but starting with systemctl start univention-directory-manager-rest.service this is univention/directory-manager-rest.log:

No handlers could be found for logger "tornado.general"
26.03.22 11:04:12        INFO      (    12608) : stopping children: []
26.03.22 11:04:12        INFO      (    12608) : stopping subprocesses: []
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/dist-packages/univention/admin/rest/server/__main__.py", line 42, in <module>
    Gateway.main()
  File "/usr/lib/python2.7/dist-packages/univention/admin/rest/server/__init__.py", line 220, in main
    cls.start_processes(args.processes, args.port)
  File "/usr/lib/python2.7/dist-packages/univention/admin/rest/server/__init__.py", line 287, in start_processes
    sock = cls.get_socket_for_locale(language)
  File "/usr/lib/python2.7/dist-packages/univention/admin/rest/server/__init__.py", line 275, in get_socket_for_locale
    return '/var/run/univention-directory-manager-rest-%s-%s.socket' % (language, territory.lower())
AttributeError: 'NoneType' object has no attribute 'lower'

Who can help me to fix it?

What UCS version are you using? → univention-app info

In UCS 5.0-1 errata262 this works without a problem:

# lsof -Pni | grep 9979
/usr/bin/ 2868       root    3u  IPv4  34861      0t0  TCP 127.0.0.1:9979 (LISTEN)
/usr/bin/ 2871       root    3u  IPv4  34861      0t0  TCP 127.0.0.1:9979 (LISTEN)

# ucr set directory/manager/rest/server/address=10.207.194.168
# systemctl restart univention-directory-manager-rest.service
# lsof -Pni | grep 9979
/usr/bin/ 2665       root    3u  IPv4  33854      0t0  TCP 10.207.194.168:9979 (LISTEN)
/usr/bin/ 2668       root    3u  IPv4  33854      0t0  TCP 10.207.194.168:9979 (LISTEN)

Hi
UCS: 4.4-8 errata1204

lsof -Pni | grep 9979 no output

Works for me.

# univention-app info
UCS: 4.4-8 errata1204
...
# lsof -Pni | grep 9979
/usr/bin/ 1070       root    3u  IPv4  18396      0t0  TCP 127.0.0.1:9979 (LISTEN)
/usr/bin/ 1651       root    3u  IPv4  18396      0t0  TCP 127.0.0.1:9979 (LISTEN)
# ucr set directory/manager/rest/server/address=10.207.194.172
Create directory/manager/rest/server/address
# systemctl restart univention-directory-manager-rest.service
# lsof -Pni | grep 9979
/usr/bin/ 3953       root    3u  IPv4  35767      0t0  TCP 10.207.194.172:9979 (LISTEN)
/usr/bin/ 3958       root    3u  IPv4  35767      0t0  TCP 10.207.194.172:9979 (LISTEN)
# ucr set directory/manager/rest/server/address=127.0.0.1
Setting directory/manager/rest/server/address
# systemctl restart univention-directory-manager-rest.service
# lsof -Pni | grep 9979
/usr/bin/ 4046       root    3u  IPv4  36454      0t0  TCP 127.0.0.1:9979 (LISTEN)
/usr/bin/ 4050       root    3u  IPv4  36454      0t0  TCP 127.0.0.1:9979 (LISTEN)

univention-app info
UCS: 4.4-9 errata1227
Installed: admindiary-backend=1.0 admindiary-frontend=1.0 cups=2.2.1 dhcp-server=12.0 pkgdb=11.0 printquota=10.0 prometheus-node-exporter=1.1 radius=5.0 samba4=4.10 self-service=4.0 self-service-backend=4.0 squid=3.5

lsof -Pni | grep 9979—>no output

I’ve fixed modify /usr/lib/python2.7/dist-packages/univention/admin/rest/server/init.py line 275:

#return ‘/var/run/univention-directory-manager-rest-%s-%s.socket’ % (language, territory.lower()) Fixed manually
return ‘/var/run/univention-directory-manager-rest-%s-%s.socket’ % (language, territory)

I think I fixed this in UCS 5.0-2.

Hi, I’m running 5.0-2 but I’ve same problem:

  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/univention/admin/rest/server/__main__.py", line 40, in <module>
    Gateway.main()
  File "/usr/lib/python3/dist-packages/univention/admin/rest/server/__init__.py", line 216, in main
    cls.start_processes(args.processes, args.port)
  File "/usr/lib/python3/dist-packages/univention/admin/rest/server/__init__.py", line 282, in start_processes
    sock = cls.get_socket_for_locale(language)
  File "/usr/lib/python3/dist-packages/univention/admin/rest/server/__init__.py", line 271, in get_socket_for_locale
    return f'/var/run/univention-directory-manager-rest-{language}-{territory.lower()}.socket'
AttributeError: 'NoneType' object has no attribute 'lower'

how can i fix it?
Thank you

What does ucr get locale say?

C:UTF-8 en_US.UTF-8:UTF-8 de_DE.UTF-8:UTF-8 it_IT.UTF-8:UTF-8

I think the C:UTF-8 is the cause. Can you test if it works when removing it?

nano /etc/locale.gen
#C UTF-8
locale-gen
Generating locales (this might take a while)...
  it_IT.UTF-8... done
  en_US.UTF-8... done
  de_DE.UTF-8... done

Then ucr get locale:
C:UTF-8 en_US.UTF-8:UTF-8 de_DE.UTF-8:UTF-8 it_IT.UTF-8:UTF-8

I’ve to reboot?

no, you have to set the UCR variable:
ucr set locale="en_US.UTF-8:UTF-8 de_DE.UTF-8:UTF-8 it_IT.UTF-8:UTF-8"

The local stuff is auto-generated from UCR variables.
Then systemctl restart univention-directory-manager-rest

Oooooooo thank you so much!
Now works fine!

Mastodon