bbc / nmos-registration

AMWA NMOS IS-04 Registration API Service
Apache License 2.0
6 stars 2 forks source link

The nmos-registration didn't work on CentOS 7 #15

Open Genri1441 opened 5 years ago

Genri1441 commented 5 years ago

Hi everyone! I have installed this package on my CentOS 7, but can't launch. I installed as described in README.md fine. Also installed https://github.com/bbc/nmos-common I have this CentOS 7 Did someone test this app on CentOS 7? [root@localhost BBC]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.6.1810 (Core) Release: 7.6.1810 Codename: Core [root@localhost BBC]# I also have Python 2.7.5 and Python 3.7.1. I got this error then launched from python3 [root@localhost nmos-registration]# python3 start.py Traceback (most recent call last): File "start.py", line 1, in from nmosregistration.registryaggregatorservice import RegistryAggregatorService File "/opt/BBC/nmos-registration/nmosregistration/registryaggregatorservice.py", line 63 print "Exception loading config: {}".format(e) ^ SyntaxError: invalid syntax [root@localhost nmos-registration]#

And this error when i launched from python 2. [root@localhost nmos-registration]# python start.py Traceback (most recent call last): File "start.py", line 1, in from nmosregistration.registryaggregatorservice import RegistryAggregatorService File "/opt/BBC/nmos-registration/nmosregistration/registryaggregatorservice.py", line 15, in from nmoscommon.mdns import MDNSEngine File "/usr/lib/python2.7/site-packages/nmoscommon/mdns/init.py", line 3, in from .mdnsEngine import MDNSEngine # noqa: F401 File "/usr/lib/python2.7/site-packages/nmoscommon/mdns/mdnsEngine.py", line 17, in import zeroconf_monkey as zeroconf File "/usr/lib/python2.7/site-packages/zeroconf_monkey.py", line 26, in import zeroconf File "/usr/lib/python2.7/site-packages/zeroconf.py", line 175 def current_time_millis() -> float: ^ SyntaxError: invalid syntax [root@localhost nmos-registration]#

Also then launched bin folder got this error. [root@localhost nmos-registration]# cd bin [root@localhost bin]# ./nmosregistration Traceback (most recent call last): File "./nmosregistration", line 7, in from nmosregistration.registryaggregatorservice import RegistryAggregatorService File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(*args, kwargs) File "build/bdist.linux-x86_64/egg/nmosregistration/registryaggregatorservice.py", line 15, in File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(*args, *kwargs) File "/usr/lib/python2.7/site-packages/nmoscommon/mdns/init.py", line 3, in from .mdnsEngine import MDNSEngine # noqa: F401 File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(args, kwargs) File "/usr/lib/python2.7/site-packages/nmoscommon/mdns/mdnsEngine.py", line 17, in import zeroconf_monkey as zeroconf File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(*args, *kwargs) File "/usr/lib/python2.7/site-packages/zeroconf_monkey.py", line 26, in import zeroconf File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(args, **kwargs) File "/usr/lib/python2.7/site-packages/zeroconf.py", line 175 def current_time_millis() -> float: ^ SyntaxError: invalid syntax [root@localhost bin]#

andrewbonney commented 5 years ago

Hi. We don't regularly test the application with anything other than Ubuntu, but it ought to work on CentOS in theory, and has done in the past.

The application is currently Python 2 only, so Python 3 won't work.

I know that newer versions of the zeroconf dependency are Python 3 compatible only, so it looks like that might be what's tripping you up. We don't pin the version of zeroconf here, but the setup.py in nmos-common does have a line which is intended to avoid this problem, see https://github.com/bbc/nmos-common/blob/master/setup.py#L155. If you installed nmos-common via another mechanism I guess it's possible you may have ended up with the most recent version of zeroconf instead?

Genri1441 commented 5 years ago

Hi @andrewbonney ! I checked zeroconf and installed zeroconf (0.19.1) and now got this error. [root@localhost nmos-registration]# python start.py Traceback (most recent call last): File "start.py", line 1, in from nmosregistration.registryaggregatorservice import RegistryAggregatorService File "/opt/BBC/nmos-registration/nmosregistration/registryaggregatorservice.py", line 17, in from nmosregistration.aggregation import AggregatorAPI, AGGREGATOR_APIVERSIONS File "/opt/BBC/nmos-registration/nmosregistration/aggregation.py", line 16, in from nmoscommon.webapi import WebAPI, route File "/usr/lib/python2.7/site-packages/nmoscommon/webapi.py", line 46, in import flask_oauthlib.client File "/usr/lib64/python2.7/site-packages/flask_oauthlib/client.py", line 20, in from .utils import to_bytes File "/usr/lib64/python2.7/site-packages/flask_oauthlib/utils.py", line 5, in from oauthlib.common import to_unicode, bytes_type ImportError: cannot import name bytes_type [root@localhost nmos-registration]# cd bin [root@localhost bin]# ./nmosregistration Traceback (most recent call last): File "./nmosregistration", line 7, in from nmosregistration.registryaggregatorservice import RegistryAggregatorService File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(*args, kwargs) File "build/bdist.linux-x86_64/egg/nmosregistration/registryaggregatorservice.py", line 17, in File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(*args, *kwargs) File "build/bdist.linux-x86_64/egg/nmosregistration/aggregation.py", line 16, in File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(args, kwargs) File "/usr/lib/python2.7/site-packages/nmoscommon/webapi.py", line 46, in import flask_oauthlib.client File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(*args, *kwargs) File "/usr/lib64/python2.7/site-packages/flask_oauthlib/client.py", line 20, in from .utils import to_bytes File "/usr/lib64/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(args, **kwargs) File "/usr/lib64/python2.7/site-packages/flask_oauthlib/utils.py", line 5, in from oauthlib.common import to_unicode, bytes_type ImportError: cannot import name bytes_type [root@localhost bin]# Do you know what can be wrong?

andrewbonney commented 5 years ago

It may be something similar. nmos-common depends upon oauthlib < 3.0.0. Do you have the correct version?

Genri1441 commented 5 years ago

Hi @andrewbonney ! I installed oauthlib (2.1.0) and now app work on Centos 7!))) But showing some errors in the web interface. for example if i come here: http://192.168.59.29:8235/x-nmos/registration/v1.2/health/nodes/ [root@localhost bin]# ./nmosregistration Exception loading config: local variable 'f' referenced before assignment Could not open pid file, continuing DEBUG:mdns-engine:No interface config file - will try and use routing rules DEBUG:mdns-engine:Could not find ipp-utils, will try using default gateway interface DEBUG:mdns-engine:Choosing mDNS interface using the default gateway: 192.168.59.29 Waiting for httpserver to start... HttpServer running Running on port: 8235 ERROR:garbage_collect:Could not write garbage collect flag: ('Connection aborted.', error(111, 'Connection refused')) DEBUG:garbage_collect:scheduled... ERROR:garbage_collect:Could not write garbage collect flag: ('Connection aborted.', error(111, 'Connection refused')) DEBUG:garbage_collect:scheduled... ERROR:garbage_collect:Could not write garbage collect flag: ('Connection aborted.', error(111, 'Connection refused')) DEBUG:garbage_collect:scheduled... [2019-02-22 14:01:36,594] ERROR in app: Exception on /x-nmos/registration/v1.2/health/nodes/ [GET] Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python2.7/site-packages/flask/app.py", line 1544, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python2.7/site-packages/flask/app.py", line 1639, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python2.7/site-packages/flask/app.py", line 1625, in dispatch_request return self.view_functionsrule.endpoint File "/usr/lib/python2.7/site-packages/nmoscommon/flask_cors.py", line 46, in wrapped_function resp = make_response(f(*args, kwargs)) File "/usr/lib/python2.7/site-packages/nmoscommon/webapi.py", line 207, in decorated_function r = f(args, kwargs) File "build/bdist.linux-x86_64/egg/nmosregistration/common/routes.py", line 222, in __health_type return self.registry.getresources('nodes') File "build/bdist.linux-x86_64/egg/nmosregistration/etcd_backend.py", line 89, in getresources raise self.RegistryUnavailable RegistryUnavailable ERROR:nmoscommon.webapi:Exception on /x-nmos/registration/v1.2/health/nodes/ [GET] Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python2.7/site-packages/flask/app.py", line 1544, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python2.7/site-packages/flask/app.py", line 1639, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python2.7/site-packages/flask/app.py", line 1625, in dispatch_request return self.view_functions[rule.endpoint](req.view_args) File "/usr/lib/python2.7/site-packages/nmoscommon/flask_cors.py", line 46, in wrapped_function resp = make_response(f(args, kwargs)) File "/usr/lib/python2.7/site-packages/nmoscommon/webapi.py", line 207, in decorated_function r = f(*args, **kwargs) File "build/bdist.linux-x86_64/egg/nmosregistration/common/routes.py", line 222, in __health_type return self.registry.getresources('nodes') File "build/bdist.linux-x86_64/egg/nmosregistration/etcd_backend.py", line 89, in getresources raise self.RegistryUnavailable RegistryUnavailable ERROR:garbage_collect:Could not write garbage collect flag: ('Connection aborted.', error(111, 'Connection refused')) DEBUG:garbage_collect:scheduled... ERROR:garbage_collect:Could not write garbage collect flag: ('Connection aborted.', error(111, 'Connection refused')) DEBUG:garbage_collect:scheduled...

I installed by setup.py. I don't know why got these errors and not correct packages in the pip. My pip list here: [root@localhost bin]# pip list astroid (1.4.9) attrs (18.2.0) Authlib (0.10) backports-abc (0.5) backports.functools-lru-cache (1.2.1) backports.ssl-match-hostname (3.5.0.1) blivet (0.61.15.72) Brlapi (0.6.0) cffi (1.6.0) chardet (2.2.1) Click (7.0) configobj (4.7.2) configparser (3.5.0b2) configshell-fb (1.1.23) coverage (3.6b3) cryptography (1.7.2) cupshelpers (1.0) custodia (0.3.1) decorator (3.4.0) di (0.3) dnspython (1.12.0) enum-compat (0.0.2) enum34 (1.0.4) ethtool (0.8) firstboot (19.5) Flask (0.11.1) Flask-OAuthlib (0.9.5) Flask-Sockets (0.2.1) fros (1.0) functools32 (3.2.3-2) futures (3.1.1) gevent (1.4.0) gevent-websocket (0.9.3) gitdb2 (2.0.5) GitPython (2.1.11) greenlet (0.4.15) gssapi (1.2.0) idna (2.4) ifaddr (0.1.6) iniparse (0.4) initial-setup (0.3.9.43) ipaclient (4.6.4) ipaddress (1.0.16) ipalib (4.6.4) ipaplatform (4.6.4) ipapython (4.6.4) IPy (0.75) isort (4.2.5) itsdangerous (1.1.0) javapackages (1.0.0) Jinja2 (2.10) jsonref (0.2) jsonschema (2.6.0) jwcrypto (0.4.2) kitchen (1.1.1) kmod (0.1) langtable (0.0.31) lazy-object-proxy (1.2.2) lxml (3.2.1) markdown2 (2.3.7) MarkupSafe (1.1.0) mccabe (0.6.1) mediajson (1.0.1) mediatimestamp (1.0.1) mininet (2.3.0d4) netaddr (0.7.5) netifaces (0.10.4) nmoscommon (0.17.0) ntplib (0.3.2) oauthlib (2.1.0) perf (0.1) pip (8.1.2) ply (3.4) policycoreutils-default-encoding (0.1) pyasn1 (0.1.9) pyasn1-modules (0.0.8) pycparser (2.14) pycups (1.9.63) pycurl (7.19.0) pyflakes (1.3.0) Pygments (2.3.1) pygobject (3.22.0) pygpgme (0.3) pyinotify (0.9.4) pykickstart (1.99.66.19) pyliblzma (0.5.3) pylint (1.6.5) pyOpenSSL (0.13.1) pyparsing (1.5.6) pyparted (3.9) pysmbc (1.0.13) python-augeas (0.5.0) python-dateutil (2.8.0) python-dmidecode (3.10.13) python-ldap (2.4.15) python-linux-procfs (0.4.9) python-meh (0.25.2) python-nss (0.16.0) python-yubico (1.2.3) pytz (2016.10) pyudev (0.15) pyusb (1.0.0b1) pyxattr (0.5.1) PyYAML (3.13) qrcode (5.0.1) ramlfications (0.1.9) registryaggregator (0.6.2) requests (2.6.0) requests-oauthlib (1.1.0) rtslib-fb (2.1.63) schedutils (0.4) seobject (0.1) sepolicy (1.1) setroubleshoot (1.1) setuptools (0.9.8) singledispatch (3.4.0.2) six (1.10.0) slip (0.4.0) slip.dbus (0.4.0) smmap2 (2.0.5) SSSDConfig (1.16.2) subprocess32 (3.2.6) targetcli-fb (2.1.fb46) termcolor (1.1.0) typing (3.6.6) urlgrabber (3.10) urllib3 (1.10.2) urwid (1.1.1) websocket-client (0.54.0) Werkzeug (0.14.1) wheel (0.32.3) wrapt (1.10.4) ws4py (0.5.1) WTForms (2.2.1) xmltodict (0.12.0) yum-langpacks (0.4.2) yum-metadata-parser (1.1.4) zeroconf (0.19.1) zeroconf-monkey (0.1.0) You are using pip version 8.1.2, however version 19.0.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. [root@localhost bin]#

andrewbonney commented 5 years ago

Do you have 'etcd' installed? This is a binary package requirement which acts as the data store. It will need to be set up and configured to communicate with the API.

Genri1441 commented 5 years ago

Hi @andrewbonney ! I have this etcd. Is it correct version? [root@localhost BBC]# etcd -v 2019-02-25 14:23:42.274016 W | pkg/flags: flag "-v" is no longer supported - ignoring. 2019-02-25 14:23:42.274253 I | etcdmain: etcd Version: 3.3.11 2019-02-25 14:23:42.274260 I | etcdmain: Git SHA: 2cf9e51 2019-02-25 14:23:42.274265 I | etcdmain: Go Version: go1.10.3 2019-02-25 14:23:42.274270 I | etcdmain: Go OS/Arch: linux/amd64 2019-02-25 14:23:42.274275 I | etcdmain: setting maximum number of CPUs to 4, total number of available CPUs is 4 2019-02-25 14:23:42.274284 W | etcdmain: no data-dir provided, using default data-dir ./default.etcd 2019-02-25 14:23:42.276159 I | embed: listening for peers on http://localhost:2380 2019-02-25 14:23:42.276335 I | embed: listening for client requests on localhost:2379

andrewbonney commented 5 years ago

We're currently using 2.2.5 internally, but it may well work with that too assuming it hasn't changed too significantly.

Genri1441 commented 5 years ago

Hi @andrewbonney ! With etcd 2.2.5 I had the same errors. Any more ideas?

andrewbonney commented 5 years ago

I'd suggest checking the etcd configuration. The service expects to find it via localhost on port 4001. This is likely to be set via 'ETCD_LISTEN_CLIENT_URLS' and 'ETCD_ADVERTISE_CLIENT_URLS'.