From 85977502e307884423b4b248694cf74b9b66b96a Mon Sep 17 00:00:00 2001 From: Mustafa Baser Date: Thu, 12 May 2022 17:13:28 +0300 Subject: [PATCH] feat: Jans linux setup ubuntu22 Installation (#1325) * feat: ubuntu22 install * fix: ubuntu22 dependencies * fix: jans-linux-setup update package dependency --- jans-cli/cli/pylib/tabulate/tabulate.py | 4 +++- .../jans_setup/setup_app/data/package_list.json | 16 ++++++++-------- .../jans_setup/setup_app/downloads.py | 6 ++---- .../setup_app/installers/config_api.py | 2 +- .../jans_setup/setup_app/pylib/jproperties.py | 7 +++++-- .../jans_setup/setup_app/utils/base.py | 2 +- .../jans_setup/setup_app/utils/crypto64.py | 2 +- 7 files changed, 21 insertions(+), 18 deletions(-) diff --git a/jans-cli/cli/pylib/tabulate/tabulate.py b/jans-cli/cli/pylib/tabulate/tabulate.py index 5d5716705e8..2bbb913c62d 100644 --- a/jans-cli/cli/pylib/tabulate/tabulate.py +++ b/jans-cli/cli/pylib/tabulate/tabulate.py @@ -8,13 +8,15 @@ from platform import python_version_tuple import re import math +import sys -if python_version_tuple() >= ("3", "3", "0"): +if sys.version_info.major >= 3 and sys.version_info.minor >= 3: from collections.abc import Iterable else: from collections import Iterable + if python_version_tuple()[0] < "3": from itertools import izip_longest from functools import partial diff --git a/jans-linux-setup/jans_setup/setup_app/data/package_list.json b/jans-linux-setup/jans_setup/setup_app/data/package_list.json index c330ef550dc..4ee90876c52 100644 --- a/jans-linux-setup/jans_setup/setup_app/data/package_list.json +++ b/jans-linux-setup/jans_setup/setup_app/data/package_list.json @@ -11,8 +11,8 @@ }, "centos 7": { "optional": "", - "mondatory": "httpd mod_ssl curl mod_auth_openidc wget tar xz unzip bzip2 rsyslog ", - "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel-yaml", "certifi":"python3-certifi", "pymysql":"python3-PyMySQL", "Crypto": "python3-cryptography", "prompt_toolkit": "python3-prompt-toolkit"} + "mondatory": "httpd mod_ssl curl mod_auth_openidc wget tar xz unzip bzip2 rsyslog python3-certifi", + "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel-yaml", "pymysql":"python3-PyMySQL", "Crypto": "python3-cryptography", "prompt_toolkit": "python3-prompt-toolkit"} }, "centos 8": { "optional": "", @@ -34,14 +34,14 @@ "mondatory": "apache2 curl wget tar xz-utils unzip rsyslog bzip2", "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "certifi":"python3-certifi", "pymysql":"python3-pymysql", "Crypto": "python3-crypto", "distutils.util": "python3-distutils", "prompt_toolkit": "python3-prompt-toolkit"} }, - "ubuntu 18": { + "ubuntu 20": { "optional": "", - "mondatory": "apache2 curl wget xz-utils unzip rsyslog net-tools bzip2", - "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "certifi":"python3-certifi", "pymysql":"python3-pymysql", "Crypto": "python3-crypto", "distutils.util": "python3-distutils", "prompt_toolkit": "python3-prompt-toolkit"} + "mondatory": "apache2 curl wget xz-utils unzip rsyslog bzip2 python3-urllib3 python3-certifi", + "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "pymysql":"python3-pymysql", "Crypto": "python3-crypto", "distutils.util": "python3-distutils", "prompt_toolkit": "python3-prompt-toolkit"} }, - "ubuntu 20": { + "ubuntu 22": { "optional": "", - "mondatory": "apache2 curl wget xz-utils unzip rsyslog bzip2", - "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "certifi":"python3-certifi", "pymysql":"python3-pymysql", "Crypto": "python3-crypto", "distutils.util": "python3-distutils", "prompt_toolkit": "python3-prompt-toolkit"} + "mondatory": "apache2 curl wget xz-utils unzip rsyslog bzip2 python3-urllib3 python3-certifi", + "python": {"ldap3":"python3-ldap3", "requests":"python3-requests", "ruamel.yaml":"python3-ruamel.yaml", "pymysql":"python3-pymysql", "distutils.util": "python3-distutils", "prompt_toolkit": "python3-prompt-toolkit", "certifi":"python3-certifi"} } } diff --git a/jans-linux-setup/jans_setup/setup_app/downloads.py b/jans-linux-setup/jans_setup/setup_app/downloads.py index a6d6a6bccf0..9dc571d3368 100644 --- a/jans-linux-setup/jans_setup/setup_app/downloads.py +++ b/jans-linux-setup/jans_setup/setup_app/downloads.py @@ -50,7 +50,7 @@ def download_gcs(): shutil.unpack_archive(target_fn, base.pylib_dir) grpcio_fn = os.path.join(tmp_dir, 'grpcio_fn.json') - base.download('https://pypi.org/pypi/grpcio/1.37.0/json', grpcio_fn, verbose=True) + base.download('https://pypi.org/pypi/grpcio/1.46.0/json', grpcio_fn, verbose=True) data = base.readJsonFile(grpcio_fn) package = get_grpcio_package(data) @@ -61,9 +61,7 @@ def download_gcs(): whl_zip = zipfile.ZipFile(target_whl_fn) for member in whl_zip.filelist: - fn = os.path.basename(member.filename) - if fn.startswith('cygrpc.cpython') and fn.endswith('x86_64-linux-gnu.so'): - whl_zip.extract(member, gcs_dir) + whl_zip.extract(member, gcs_dir) whl_zip.close() diff --git a/jans-linux-setup/jans_setup/setup_app/installers/config_api.py b/jans-linux-setup/jans_setup/setup_app/installers/config_api.py index eea440abd17..779fca3b522 100644 --- a/jans-linux-setup/jans_setup/setup_app/installers/config_api.py +++ b/jans-linux-setup/jans_setup/setup_app/installers/config_api.py @@ -192,7 +192,7 @@ def render_import_templates(self): Config.templateRenderingDict['configOauthEnabled'] = 'false' if base.argsp.disable_config_api_security else 'true' Config.templateRenderingDict['apiApprovedIssuer'] = base.argsp.approved_issuer or 'https://{}'.format(Config.hostname) - oxauth_config_str = base64.decodestring(Config.templateRenderingDict['oxauth_config_base64'].encode()) + oxauth_config_str = base64.decodebytes(Config.templateRenderingDict['oxauth_config_base64'].encode()) oxauth_config = json.loads(oxauth_config_str.decode()) for param in ('issuer', 'openIdConfigurationEndpoint', 'introspectionEndpoint', 'tokenEndpoint', 'tokenRevocationEndpoint'): Config.templateRenderingDict[param] = oxauth_config[param] diff --git a/jans-linux-setup/jans_setup/setup_app/pylib/jproperties.py b/jans-linux-setup/jans_setup/setup_app/pylib/jproperties.py index 8d98e5eb54f..01d25fb408d 100644 --- a/jans-linux-setup/jans_setup/setup_app/pylib/jproperties.py +++ b/jans-linux-setup/jans_setup/setup_app/pylib/jproperties.py @@ -37,10 +37,13 @@ import re import sys import time -from collections import MutableMapping, namedtuple - import six +from collections import namedtuple +try: + from collections import MutableMapping +except Exception: + from collections.abc import MutableMapping # This represents a combination of a value and metadata for a property key. PropertyTuple = namedtuple("PropertyTuple", ["data", "meta"]) diff --git a/jans-linux-setup/jans_setup/setup_app/utils/base.py b/jans-linux-setup/jans_setup/setup_app/utils/base.py index cbb3385ad29..8f91fdd020e 100644 --- a/jans-linux-setup/jans_setup/setup_app/utils/base.py +++ b/jans-linux-setup/jans_setup/setup_app/utils/base.py @@ -72,7 +72,7 @@ sys.exit() os_name = os_type + os_version -deb_sysd_clone = os_name in ('ubuntu18', 'ubuntu20', 'debian9', 'debian10') +deb_sysd_clone = os_name in ('ubuntu18', 'ubuntu20', 'ubuntu22', 'debian9', 'debian10') # Determine service path if (os_type in ('centos', 'red', 'fedora', 'suse') and os_initdaemon == 'systemd') or deb_sysd_clone: diff --git a/jans-linux-setup/jans_setup/setup_app/utils/crypto64.py b/jans-linux-setup/jans_setup/setup_app/utils/crypto64.py index 0c56df30544..05f1d8b8f4a 100644 --- a/jans-linux-setup/jans_setup/setup_app/utils/crypto64.py +++ b/jans-linux-setup/jans_setup/setup_app/utils/crypto64.py @@ -293,7 +293,7 @@ def generate_base64_string(self, lines, num_spaces): return None plain_text = ''.join(lines) - plain_b64encoded_text = base64.encodestring(plain_text.encode('utf-8')).decode('utf-8').strip() + plain_b64encoded_text = base64.encodebytes(plain_text.encode('utf-8')).decode('utf-8').strip() if num_spaces > 0: plain_b64encoded_text = self.reindent(plain_b64encoded_text, num_spaces)