From e97a5ce265f7e1d3380fab9c4132e2b002e8636c Mon Sep 17 00:00:00 2001 From: Michal Jagiello Date: Mon, 27 Jul 2020 10:02:19 +0000 Subject: Run in Python 3.8 Use image recommended by SECCOM Issue-ID: DCAEGEN2-2292 Signed-off-by: Michal Jagiello Change-Id: I8d77f150c9fe314bf26bac2c9fac7ebc9782c9d8 --- miss_htbt_service/cbs_polling.py | 7 ++++--- miss_htbt_service/config_notif.py | 7 ++++--- miss_htbt_service/db_monitoring.py | 7 ++++--- miss_htbt_service/htbtworker.py | 5 +++-- miss_htbt_service/misshtbt.sh | 8 ++++---- miss_htbt_service/misshtbtd.py | 29 ++++++++++++++------------- miss_htbt_service/mod/trapd_exit.py | 3 ++- miss_htbt_service/mod/trapd_get_cbs_config.py | 7 ++++--- miss_htbt_service/mod/trapd_io.py | 5 +++-- miss_htbt_service/mod/trapd_vnf_table.py | 13 ++++++------ 10 files changed, 50 insertions(+), 41 deletions(-) (limited to 'miss_htbt_service') diff --git a/miss_htbt_service/cbs_polling.py b/miss_htbt_service/cbs_polling.py index 7d19610..1b9d00c 100644 --- a/miss_htbt_service/cbs_polling.py +++ b/miss_htbt_service/cbs_polling.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # Copyright 2018-2020 AT&T Intellectual Property, Inc. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -26,9 +27,9 @@ import sys import os import socket import logging -from . import htbtworker as pm -from . import misshtbtd as db -from . import get_logger +import htbtworker as pm +import misshtbtd as db +import get_logger _logger = get_logger.get_logger(__name__) diff --git a/miss_htbt_service/config_notif.py b/miss_htbt_service/config_notif.py index 6b54bad..b420dc2 100644 --- a/miss_htbt_service/config_notif.py +++ b/miss_htbt_service/config_notif.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # Copyright 2018-2020 AT&T Intellectual Property, Inc. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,10 +29,10 @@ import json import psycopg2 from pathlib import Path import os.path as path -from .mod import trapd_settings as tds +import mod.trapd_settings as tds # use the fully qualified name here to let monkeypatching work # from .mod.trapd_get_cbs_config import get_cbs_config -import miss_htbt_service.mod.trapd_get_cbs_config +import mod.trapd_get_cbs_config hb_properties_file = path.abspath(path.join(__file__, "../config/hbproperties.yaml")) @@ -169,7 +170,7 @@ def update_hb_common(update_flg, process_id, state, user_name,password,ip_addres def fetch_json_file(download_json = "../etc/download1.json", config_json = "../etc/config.json"): # use the fully qualified name here to let monkeypatching work # if get_cbs_config(): - if miss_htbt_service.mod.trapd_get_cbs_config.get_cbs_config(): + if mod.trapd_get_cbs_config.get_cbs_config(): current_runtime_config_file_name = download_json envPytest = os.getenv('pytest', "") if (envPytest == 'test'): diff --git a/miss_htbt_service/db_monitoring.py b/miss_htbt_service/db_monitoring.py index 6ab7732..0c59772 100644 --- a/miss_htbt_service/db_monitoring.py +++ b/miss_htbt_service/db_monitoring.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # Copyright 2018-2020 AT&T Intellectual Property, Inc. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,9 +29,9 @@ import os import logging import socket import requests -from . import htbtworker as pm -from . import misshtbtd as db -from . import get_logger +import htbtworker as pm +import misshtbtd as db +import get_logger _logger = get_logger.get_logger(__name__) diff --git a/miss_htbt_service/htbtworker.py b/miss_htbt_service/htbtworker.py index db0561f..9472473 100644 --- a/miss_htbt_service/htbtworker.py +++ b/miss_htbt_service/htbtworker.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # Copyright 2018-2020 AT&T Intellectual Property, Inc. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,8 +26,8 @@ import os import os.path as path import json,sys,time import logging -from . import misshtbtd as db -from . import get_logger +import misshtbtd as db +import get_logger _logger = get_logger.get_logger(__name__) diff --git a/miss_htbt_service/misshtbt.sh b/miss_htbt_service/misshtbt.sh index df453b4..c93da98 100644 --- a/miss_htbt_service/misshtbt.sh +++ b/miss_htbt_service/misshtbt.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # # ============LICENSE_START======================================================= # org.onap.dcae @@ -19,13 +19,13 @@ # ============LICENSE_END========================================================= # get to where we are supposed to be for startup -cd /opt/app/misshtbt/bin +cd /app/bin # include path to 3.6+ version of python that has required dependencies included -export PATH=/usr/local/lib/python3.6/bin:$PATH:/opt/app/misshtbt/bin +export PATH=/usr/local/lib/python3.8/bin:$PATH:/app/bin # expand search for python modules to include ./mod in runtime dir -export PYTHONPATH=/usr/local/lib/python3.6/site-packages:./mod:./:$PYTHONPATH:/opt/app/misshtbt/bin +export PYTHONPATH=/usr/local/lib/python3.8/site-packages:./mod:./:$PYTHONPATH:/app/bin # set location of SSL certificates export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-bundle.crt diff --git a/miss_htbt_service/misshtbtd.py b/miss_htbt_service/misshtbtd.py index c56ad99..0edc76e 100644 --- a/miss_htbt_service/misshtbtd.py +++ b/miss_htbt_service/misshtbtd.py @@ -2,6 +2,7 @@ # ============LICENSE_START======================================================= # Copyright (c) 2017-2020 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -39,13 +40,13 @@ import socket import os.path as path from pathlib import Path -from . import htbtworker as heartbeat -from . import get_logger -from .mod import trapd_settings as tds -from .mod.trapd_runtime_pid import save_pid, rm_pid -from .mod.trapd_get_cbs_config import get_cbs_config -from .mod.trapd_exit import cleanup_and_exit -from .mod.trapd_http_session import init_session_obj +import htbtworker as heartbeat +import get_logger +from mod import trapd_settings as tds +from mod.trapd_runtime_pid import save_pid, rm_pid +from mod.trapd_get_cbs_config import get_cbs_config +from mod.trapd_exit import cleanup_and_exit +from mod.trapd_http_session import init_session_obj hb_properties_file = path.abspath(path.join(__file__, "../config/hbproperties.yaml")) ip_address = "localhost" @@ -196,18 +197,18 @@ def create_update_vnf_table_1(jsfile,update_db,connection_db): def hb_cbs_polling_process(pid_current): my_file = Path("./miss_htbt_service/cbs_polling.py") # if my_file.is_file(): - subprocess.call(["python3.6",ABSOLUTE_PATH4 , str(pid_current) ]) + subprocess.call(["python3.8",ABSOLUTE_PATH4 , str(pid_current) ]) # else: -# subprocess.call(["python3.6",ABSOLUTE_PATH4 , str(pid_current) ]) +# subprocess.call(["python3.8",ABSOLUTE_PATH4 , str(pid_current) ]) sys.stdout.flush() _logger.info("MSHBT:Creaated CBS polling process") return def hb_worker_process(config_file_path): my_file = Path("./miss_htbt_service/htbtworker.py") # if my_file.is_file(): - subprocess.call(["python3.6",ABSOLUTE_PATH1 , config_file_path ]) + subprocess.call(["python3.8",ABSOLUTE_PATH1 , config_file_path ]) # else: -# subprocess.call(["python3.6",ABSOLUTE_PATH1 , config_file_path ]) +# subprocess.call(["python3.8",ABSOLUTE_PATH1 , config_file_path ]) sys.stdout.flush() _logger.info("MSHBT:Creaated Heartbeat worker process") return @@ -215,9 +216,9 @@ def hb_worker_process(config_file_path): def db_monitoring_process(current_pid,jsfile): my_file = Path("./miss_htbt_service/db_monitoring.py") # if my_file.is_file(): - subprocess.call(["python3.6",ABSOLUTE_PATH2 , str(current_pid),jsfile]) + subprocess.call(["python3.8",ABSOLUTE_PATH2 , str(current_pid),jsfile]) # else: -# subprocess.call(["python3.6",ABSOLUTE_PATH2 , str(current_pid),jsfile]) +# subprocess.call(["python3.8",ABSOLUTE_PATH2 , str(current_pid),jsfile]) sys.stdout.flush() _logger.info("MSHBT:Creaated DB Monitoring process") return @@ -339,7 +340,7 @@ _logger = get_logger.get_logger(__name__) def main(): try: - p = subprocess.Popen(['python3.6',ABSOLUTE_PATH3],stdout=subprocess.PIPE,stderr=subprocess.STDOUT) + p = subprocess.Popen(['python3.8',ABSOLUTE_PATH3],stdout=subprocess.PIPE,stderr=subprocess.STDOUT) _logger.info("MSHBD:Execution Started") job_list = [] pid_current = os.getpid() diff --git a/miss_htbt_service/mod/trapd_exit.py b/miss_htbt_service/mod/trapd_exit.py index b1bd68f..c741fe5 100644 --- a/miss_htbt_service/mod/trapd_exit.py +++ b/miss_htbt_service/mod/trapd_exit.py @@ -3,6 +3,7 @@ # ================================================================================ # Copyright (c) 2017-2020 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,7 +28,7 @@ __docformat__ = 'restructuredtext' import sys import os import string -from .trapd_runtime_pid import save_pid, rm_pid +from mod.trapd_runtime_pid import save_pid, rm_pid prog_name = os.path.basename(__file__) diff --git a/miss_htbt_service/mod/trapd_get_cbs_config.py b/miss_htbt_service/mod/trapd_get_cbs_config.py index d0b8110..1fa3572 100644 --- a/miss_htbt_service/mod/trapd_get_cbs_config.py +++ b/miss_htbt_service/mod/trapd_get_cbs_config.py @@ -3,6 +3,7 @@ # ================================================================================ # Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,9 +34,9 @@ import time import traceback import collections from onap_dcae_cbs_docker_client.client import get_config -from . import trapd_settings as tds -from .trapd_exit import cleanup,cleanup_and_exit -from .trapd_io import stdout_logger +from mod import trapd_settings as tds +from mod.trapd_exit import cleanup,cleanup_and_exit +from mod.trapd_io import stdout_logger prog_name = os.path.basename(__file__) diff --git a/miss_htbt_service/mod/trapd_io.py b/miss_htbt_service/mod/trapd_io.py index 4f0904e..d60f060 100644 --- a/miss_htbt_service/mod/trapd_io.py +++ b/miss_htbt_service/mod/trapd_io.py @@ -3,6 +3,7 @@ # ================================================================================ # Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -36,8 +37,8 @@ import time import traceback import unicodedata # dcae_snmptrap -from . import trapd_settings as tds -from .trapd_exit import cleanup_and_exit +import mod.trapd_settings as tds +from mod.trapd_exit import cleanup_and_exit prog_name = os.path.basename(__file__) diff --git a/miss_htbt_service/mod/trapd_vnf_table.py b/miss_htbt_service/mod/trapd_vnf_table.py index eeb4dc6..6b883af 100644 --- a/miss_htbt_service/mod/trapd_vnf_table.py +++ b/miss_htbt_service/mod/trapd_vnf_table.py @@ -3,6 +3,7 @@ # ================================================================================ # Copyright (c) 2017-2020 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2019 Pantheon.tech. All rights reserved. +# Copyright 2020 Deutsche Telekom. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -35,12 +36,12 @@ import time import subprocess from onap_dcae_cbs_docker_client.client import get_config -from .. import get_logger -from .. import db_monitoring as dbmon -from .. import htbtworker as pm -from .. import misshtbtd as db -from .. import config_notif as cf -from .. import cbs_polling as cbs +import get_logger +import db_monitoring as dbmon +import htbtworker as pm +import misshtbtd as db +import config_notif as cf +import cbs_polling as cbs prog_name = os.path.basename(__file__) -- cgit 1.2.3-korg