From 27ec0d2af688ee88bb372eb612c749176729bd25 Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Mon, 30 Sep 2024 03:58:02 +0300 Subject: [PATCH 01/36] chore: Update dependencies to latest versions compatible with python 3.8 Refs: OPMONDEV-187 --- analysis_module/setup.py | 9 ++++++--- analysis_ui_module/setup.py | 9 ++++++--- anonymizer_module/setup.py | 6 +++--- collector_module/setup.py | 10 +++++----- corrector_module/setup.py | 6 +++--- opendata_collector_module/setup.py | 10 +++++----- opendata_module/setup.py | 8 ++++---- reports_module/setup.py | 14 +++++++++----- 8 files changed, 41 insertions(+), 31 deletions(-) diff --git a/analysis_module/setup.py b/analysis_module/setup.py index 065508d..5bff16a 100644 --- a/analysis_module/setup.py +++ b/analysis_module/setup.py @@ -24,10 +24,13 @@ from setuptools import setup, find_packages +# The following dependencies has newer versions, but require Python 3.9 or higher +# pandas, numpy, scipy + requirements = [ - 'dill==0.3.8', - 'pymongo==4.6.3', - 'pyyaml==6.0.1', + 'dill==0.3.9', + 'pymongo==4.9.1', + 'pyyaml==6.0.2', 'numpy==1.24.4', 'pandas==2.0.3', 'scipy==1.10.1', diff --git a/analysis_ui_module/setup.py b/analysis_ui_module/setup.py index 90b6951..01eca75 100644 --- a/analysis_ui_module/setup.py +++ b/analysis_ui_module/setup.py @@ -24,11 +24,14 @@ from setuptools import setup, find_packages +# The following dependencies has newer versions, but require Python 3.9 or higher +# numpy + requirements = [ - 'dill==0.3.8', + 'dill==0.3.9', 'django==2.2.28', - 'pymongo==4.6.3', - 'pyyaml==6.0.1', + 'pymongo==4.9.1', + 'pyyaml==6.0.2', 'numpy==1.24.4' ] diff --git a/anonymizer_module/setup.py b/anonymizer_module/setup.py index ccb649a..37c94e9 100644 --- a/anonymizer_module/setup.py +++ b/anonymizer_module/setup.py @@ -25,9 +25,9 @@ from setuptools import setup, find_packages requirements = [ - 'setuptools==67.4.0', - 'pymongo==4.6.3', - 'pyyaml==6.0.1', + 'setuptools==75.1.0', + 'pymongo==4.9.1', + 'pyyaml==6.0.2', 'psycopg2==2.9.9', 'python-dateutil==2.9.0.post0', ] diff --git a/collector_module/setup.py b/collector_module/setup.py index a11b512..b0e5829 100644 --- a/collector_module/setup.py +++ b/collector_module/setup.py @@ -25,12 +25,12 @@ from setuptools import setup requirements = [ - 'setuptools==67.4.0', - 'pymongo==4.6.3', + 'setuptools==75.1.0', + 'pymongo==4.9.1', 'requests==2.32.3', - 'tqdm==4.66.4', - 'pyyaml==6.0.1', - 'urllib3==1.26.18', + 'tqdm==4.66.5', + 'pyyaml==6.0.2', + 'urllib3==2.2.3', ] classifiers = [ diff --git a/corrector_module/setup.py b/corrector_module/setup.py index 74a08f1..e0c1e9f 100644 --- a/corrector_module/setup.py +++ b/corrector_module/setup.py @@ -25,9 +25,9 @@ from setuptools import setup requirements = [ - 'setuptools==67.4.0', - 'pymongo==4.6.3', - 'pyyaml==6.0.1', + 'setuptools==75.1.0', + 'pymongo==4.9.1', + 'pyyaml==6.0.2', ] classifiers = [ diff --git a/opendata_collector_module/setup.py b/opendata_collector_module/setup.py index 40ef5d2..90922c8 100644 --- a/opendata_collector_module/setup.py +++ b/opendata_collector_module/setup.py @@ -25,12 +25,12 @@ from setuptools import setup requirements = [ - 'setuptools==67.4.0', - 'pymongo==4.6.3', + 'setuptools==75.1.0', + 'pymongo==4.9.1', 'requests==2.32.3', - 'tqdm==4.66.4', - 'pyyaml==6.0.1', - 'urllib3==1.26.18', + 'tqdm==4.66.5', + 'pyyaml==6.0.2', + 'urllib3==2.2.3', ] classifiers = [ diff --git a/opendata_module/setup.py b/opendata_module/setup.py index b028a45..f28ef63 100644 --- a/opendata_module/setup.py +++ b/opendata_module/setup.py @@ -25,11 +25,11 @@ from setuptools import setup, find_packages requirements = [ - 'setuptools==67.4.0', - 'dill==0.3.8', + 'setuptools==75.1.0', + 'dill==0.3.9', 'django==3.2.20', - 'pymongo==4.6.3', - 'pyyaml==6.0.1', + 'pymongo==4.9.1', + 'pyyaml==6.0.2', 'psycopg2==2.9.9', 'python-dateutil==2.9.0.post0', ] diff --git a/reports_module/setup.py b/reports_module/setup.py index 5240e4f..3379485 100644 --- a/reports_module/setup.py +++ b/reports_module/setup.py @@ -24,19 +24,23 @@ from setuptools import setup, find_packages +# The following dependencies has newer versions, but require Python 3.9 or higher +# matplotlib, pandas, weasyprint, numpy, contourpy + requirements = [ 'markupsafe==2.1.5', 'Jinja2==3.1.4', - 'matplotlib==3.5.3', + 'matplotlib==3.7.5', 'pandas==2.0.3', 'weasyprint==61.2', - 'Pillow==10.3.0', - 'pymongo==4.6.3', - 'pyyaml==6.0.1', + 'Pillow==10.4.0', + 'pymongo==4.9.1', + 'pyyaml==6.0.2', 'requests==2.32.3', 'tinycss==0.4', - 'jsonschema==4.22.0', + 'jsonschema==4.23.0', 'numpy==1.24.4', + 'contourpy==1.1.1', ] classifiers = [ From b32df4742f34f790483054dcc1e184d9e2e7f07d Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Mon, 30 Sep 2024 04:02:59 +0300 Subject: [PATCH 02/36] fix: Fix import in database_manager Refs: OPMONDEV-187 --- corrector_module/opmon_corrector/database_manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/corrector_module/opmon_corrector/database_manager.py b/corrector_module/opmon_corrector/database_manager.py index 88cdb55..7057fbe 100644 --- a/corrector_module/opmon_corrector/database_manager.py +++ b/corrector_module/opmon_corrector/database_manager.py @@ -29,6 +29,8 @@ import pymongo from typing import List, Optional +from pymongo.database import Database + from .logger_manager import LoggerManager from . import __version__ @@ -80,7 +82,7 @@ def get_mongo_uri(settings: dict) -> str: host = settings['mongodb']['host'] return f'mongodb://{user}:{password}@{host}/auth_db' - def get_query_db(self) -> pymongo.database.Database: + def get_query_db(self) -> Database: """ Gets the specific (XRoadInstance) query database . :return: Returns the specific query database. From 9e6bcefe5917e3095983a377e5aa32e4522498c0 Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Mon, 30 Sep 2024 04:03:20 +0300 Subject: [PATCH 03/36] chore: enable running tests manually from github actions page Refs: OPMONDEV-187 --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 2a44510..547edbb 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,5 +1,5 @@ name: X-Road Metrics Tests -on: [pull_request] +on: [workflow_dispatch, pull_request] jobs: Test-Anonymizer: name: Anonymizer Tests From 8bd6ff3bd4f2dac10ad42da7cad7bcf839cc6cdc Mon Sep 17 00:00:00 2001 From: Vitali Stupin Date: Thu, 17 Oct 2024 16:04:13 +0300 Subject: [PATCH 04/36] Fix corrector inserting duplicate documents when metrics arrive after timeout Corrector marks documents as orphans if either the client or producer part is missing after the configured amount of time. But sometimes the second part of the metrics arrives after the document was marked as "done". In that case, the corrector incorrectly adds a second document for the same "xRequestId" value into clean data. This commit addresses this issue by updating the existing document instead of adding a duplicate. The value of "correctorTime" however is not updated to avoid the anonymizer from processing the updated document again and inserting a duplicate into opendata. --- .../opmon_corrector/corrector_worker.py | 8 +- .../opmon_corrector/database_manager.py | 7 +- .../clean_data_after_batch_2_timeout.json | 101 ++++++++++++++++++ .../raw_messages_batch_1_timeout.json | 28 +++++ .../raw_messages_batch_2_timeout.json | 31 ++++++ .../tests/test_corrector_batch.py | 33 ++++++ 6 files changed, 202 insertions(+), 6 deletions(-) create mode 100644 corrector_module/opmon_corrector/tests/fixtures/clean_data_after_batch_2_timeout.json create mode 100644 corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_1_timeout.json create mode 100644 corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_2_timeout.json diff --git a/corrector_module/opmon_corrector/corrector_worker.py b/corrector_module/opmon_corrector/corrector_worker.py index dd6bca2..e47757a 100644 --- a/corrector_module/opmon_corrector/corrector_worker.py +++ b/corrector_module/opmon_corrector/corrector_worker.py @@ -121,7 +121,7 @@ def consume_data(self, data): # Let's find processing party in processing clean_data if len(matched_pair) == 1: doc = matched_pair.get('client') or matched_pair.get('producer') - clean_document = self.db_m.get_processing_document(doc) + clean_document = self.db_m.get_clean_document(doc) if clean_document: if doc['securityServerType'].lower() == SECURITY_SERVER_TYPE_CLIENT: @@ -131,7 +131,11 @@ def consume_data(self, data): clean_document['producer'] = doc clean_document = doc_m.apply_calculations(clean_document) - clean_document['correctorTime'] = database_manager.get_timestamp() + if clean_document['correctorStatus'] == 'processing': + # Updating correctorTime value only when document is in 'processing' status + # Updating correctorTime value when document is in 'done' status + # may trigger anonymizer to insert duplicate value to opendata + clean_document['correctorTime'] = database_manager.get_timestamp() clean_document['correctorStatus'] = 'done' clean_document['matchingType'] = 'regular_pair' clean_document['xRequestId'] = x_request_id diff --git a/corrector_module/opmon_corrector/database_manager.py b/corrector_module/opmon_corrector/database_manager.py index 7057fbe..e0ec856 100644 --- a/corrector_module/opmon_corrector/database_manager.py +++ b/corrector_module/opmon_corrector/database_manager.py @@ -140,14 +140,13 @@ def get_raw_documents(self, limit: int = 1000) -> List[dict]: self.logger_m.log_exception('DatabaseManager.get_raw_documents', repr(e)) raise e - def get_processing_document(self, current_doc: dict) -> Optional[dict]: + def get_clean_document(self, current_doc: dict) -> Optional[dict]: """ - Gets single processing document. + Gets single clean document. :param current_doc: The input document. :return: Returns document". """ q = { - 'correctorStatus': 'processing', 'xRequestId': current_doc['xRequestId'], } try: @@ -156,7 +155,7 @@ def get_processing_document(self, current_doc: dict) -> Optional[dict]: document = clean_data.find_one(q) return document except Exception as e: - self.logger_m.log_exception('DatabaseManager.get_processing_documents', repr(e)) + self.logger_m.log_exception('DatabaseManager.get_clean_document', repr(e)) raise e def get_timeout_document_ids_client(self, timeout_days: int, limit: int = 1000) -> List[dict]: diff --git a/corrector_module/opmon_corrector/tests/fixtures/clean_data_after_batch_2_timeout.json b/corrector_module/opmon_corrector/tests/fixtures/clean_data_after_batch_2_timeout.json new file mode 100644 index 0000000..55d39b5 --- /dev/null +++ b/corrector_module/opmon_corrector/tests/fixtures/clean_data_after_batch_2_timeout.json @@ -0,0 +1,101 @@ +[ + { + "client" : { + "monitoringDataTs" : 1671017183, + "securityServerType" : "Client", + "requestInTs" : 1671017180701, + "requestOutTs" : 1671017180702, + "responseOutTs" : 1671017183763, + "clientXRoadInstance" : "LTT", + "clientMemberClass" : "CS", + "clientMemberCode" : "CS1", + "clientSubsystemCode" : "MANAGEMENT", + "serviceXRoadInstance" : "LTT", + "serviceMemberClass" : "TEST", + "serviceMemberCode" : "TEST3", + "serviceCode" : "getSecurityServerOperationalData", + "messageId" : "2b16933c-c473-4a82-8265-7c11518e7f3b", + "messageProtocolVersion" : "4.0", + "clientSecurityServerAddress" : "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress" : "xroad-long-term-testing-sidecar.i.x-road.rocks", + "requestSize" : 1989, + "succeeded" : false, + "faultCode" : "Server.ClientProxy.NetworkError", + "faultString" : "Could not connect to any target host ([https://xroad-long-term-testing-sidecar.i.x-road.rocks:5500/])", + "xRequestId" : "3d3969aa-e7a0-4c91-bcb5-bb86a3000a98", + "serviceType" : "WSDL", + "insertTime" : 1671023580.82181, + "responseSize" : null, + "securityServerInternalIp" : null, + "responseInTs" : null, + "serviceSubsystemCode" : null, + "serviceVersion" : null, + "representedPartyClass" : null, + "representedPartyCode" : null, + "messageUserId" : null, + "messageIssue" : null, + "requestMimeSize" : null, + "requestAttachmentCount" : null, + "responseMimeSize" : null, + "responseAttachmentCount" : null + }, + "producer" : { + "monitoringDataTs" : 1671025862, + "securityServerInternalIp" : "172.31.60.226", + "securityServerType" : "Producer", + "requestInTs" : 1671025861996, + "responseOutTs" : 1671025861999, + "clientXRoadInstance" : "LTT", + "clientMemberClass" : "TEST", + "clientMemberCode" : "TEST1", + "clientSubsystemCode" : "SUB1", + "serviceXRoadInstance" : "LTT", + "serviceMemberClass" : "TEST", + "serviceMemberCode" : "TEST2", + "serviceSubsystemCode" : "SUB2", + "serviceCode" : "doesnotexist", + "messageId" : "test", + "messageUserId" : "test", + "messageProtocolVersion" : "4.0", + "clientSecurityServerAddress" : "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress" : "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize" : 917, + "requestAttachmentCount" : 0, + "succeeded" : false, + "faultCode" : "Server.ServerProxy.UnknownService", + "faultString" : "Unknown service: SERVICE:LTT/TEST/TEST2/SUB2/doesnotexist", + "xRequestId" : "3d3969aa-e7a0-4c91-bcb5-bb86a3000a98", + "serviceType" : "WSDL", + "insertTime" : 1671090094.87872, + "responseSize" : null, + "requestOutTs" : null, + "responseInTs" : null, + "serviceVersion" : null, + "representedPartyClass" : null, + "representedPartyCode" : null, + "messageIssue" : null, + "requestMimeSize" : null, + "responseMimeSize" : null, + "responseAttachmentCount" : null + }, + "xRequestId" : "3d3969aa-e7a0-4c91-bcb5-bb86a3000a98", + "messageId" : "2b16933c-c473-4a82-8265-7c11518e7f3b", + "totalDuration" : 3062, + "clientSsRequestDuration" : 1, + "clientSsResponseDuration" : null, + "producerDurationClientView" : null, + "producerDurationProducerView" : 3, + "producerSsRequestDuration" : null, + "producerSsResponseDuration" : null, + "producerIsDuration" : null, + "requestNwDuration" : 8681294, + "responseNwDuration" : null, + "clientRequestSize" : 1989, + "producerRequestSize" : 917, + "clientResponseSize" : null, + "producerResponseSize" : null, + "correctorTime" : 1671451218.56188, + "correctorStatus" : "done", + "matchingType" : "regular_pair" + } +] diff --git a/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_1_timeout.json b/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_1_timeout.json new file mode 100644 index 0000000..ba6c84e --- /dev/null +++ b/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_1_timeout.json @@ -0,0 +1,28 @@ +[ + { + "monitoringDataTs" : 1671017183, + "securityServerType" : "Client", + "requestInTs" : 1671017180701, + "requestOutTs" : 1671017180702, + "responseOutTs" : 1671017183763, + "clientXRoadInstance" : "LTT", + "clientMemberClass" : "CS", + "clientMemberCode" : "CS1", + "clientSubsystemCode" : "MANAGEMENT", + "serviceXRoadInstance" : "LTT", + "serviceMemberClass" : "TEST", + "serviceMemberCode" : "TEST3", + "serviceCode" : "getSecurityServerOperationalData", + "messageId" : "2b16933c-c473-4a82-8265-7c11518e7f3b", + "messageProtocolVersion" : "4.0", + "clientSecurityServerAddress" : "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress" : "xroad-long-term-testing-sidecar.i.x-road.rocks", + "requestSize" : 1989, + "succeeded" : false, + "faultCode" : "Server.ClientProxy.NetworkError", + "faultString" : "Could not connect to any target host ([https://xroad-long-term-testing-sidecar.i.x-road.rocks:5500/])", + "xRequestId" : "3d3969aa-e7a0-4c91-bcb5-bb86a3000a98", + "serviceType" : "WSDL", + "insertTime" : 1671023580.82181 + } +] diff --git a/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_2_timeout.json b/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_2_timeout.json new file mode 100644 index 0000000..55674c1 --- /dev/null +++ b/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_2_timeout.json @@ -0,0 +1,31 @@ +[ + { + "monitoringDataTs" : 1671025862, + "securityServerInternalIp" : "172.31.60.226", + "securityServerType" : "Producer", + "requestInTs" : 1671025861996, + "responseOutTs" : 1671025861999, + "clientXRoadInstance" : "LTT", + "clientMemberClass" : "TEST", + "clientMemberCode" : "TEST1", + "clientSubsystemCode" : "SUB1", + "serviceXRoadInstance" : "LTT", + "serviceMemberClass" : "TEST", + "serviceMemberCode" : "TEST2", + "serviceSubsystemCode" : "SUB2", + "serviceCode" : "doesnotexist", + "messageId" : "test", + "messageUserId" : "test", + "messageProtocolVersion" : "4.0", + "clientSecurityServerAddress" : "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress" : "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize" : 917, + "requestAttachmentCount" : 0, + "succeeded" : false, + "faultCode" : "Server.ServerProxy.UnknownService", + "faultString" : "Unknown service: SERVICE:LTT/TEST/TEST2/SUB2/doesnotexist", + "xRequestId" : "3d3969aa-e7a0-4c91-bcb5-bb86a3000a98", + "serviceType" : "WSDL", + "insertTime" : 1671090094.87872 + } +] diff --git a/corrector_module/opmon_corrector/tests/test_corrector_batch.py b/corrector_module/opmon_corrector/tests/test_corrector_batch.py index 4a4e036..f3eac62 100644 --- a/corrector_module/opmon_corrector/tests/test_corrector_batch.py +++ b/corrector_module/opmon_corrector/tests/test_corrector_batch.py @@ -202,3 +202,36 @@ def test_corrector_batch_timeout_documents(mongo, batch, caplog): assert f"Total of {len(timeouted_client_documents)} orphans from Client updated to status \'done\'." in caplog.text assert f"Total of {len(timeouted_producer_documents)} orphans from Producer updated to status \'done\'." in caplog.text + + +@freeze_time("2022-12-24") +def test_corrector_batch_update_after_timeout(mongo, batch): + insert_fixture(mongo, 'raw_messages', read_fixture('raw_messages_batch_1_timeout')) + + settings = OpmonSettingsManager('UNITTEST').settings + settings['corrector']['timeout-days'] = 1 + logger_m = LoggerManager( + settings['logger'], settings['xroad']['instance'], '' + ) + batch = SingleProcessedCorrectorBatch(settings, logger_m) + # will mark timeouted document as done + batch.run({}) + + sample_document = get_documents(mongo, 'clean_data', {"correctorStatus": "done", "matchingType": "orphan"}) + # checking that sample document exists in fixture + assert len(sample_document) == 1 + + insert_fixture(mongo, 'raw_messages', read_fixture('raw_messages_batch_2_timeout')) + # running second batch at a later time + with freeze_time("2022-12-26"): + batch.run({}) + + updated_sample_document = get_documents(mongo, 'clean_data', {"correctorStatus": "done", "matchingType": "regular_pair"}) + # checking that sample timeouted document was updated to "regular_pair" + assert len(updated_sample_document) == 1 + # checking that 'correctorTime' did not change in sample document + assert sample_document[0]['correctorTime'] == updated_sample_document[0]['correctorTime'] + + # comparing updated document with expected clean_data + expected_clean_data = read_fixture('clean_data_after_batch_2_timeout') + compare_documents(updated_sample_document, expected_clean_data) From 9de21a58a3824dbd07b58efcf4a7b9b0e075ee19 Mon Sep 17 00:00:00 2001 From: Vitali Stupin Date: Thu, 17 Oct 2024 16:29:12 +0300 Subject: [PATCH 05/36] Fix sonarcloud issue --- corrector_module/opmon_corrector/tests/test_corrector_batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corrector_module/opmon_corrector/tests/test_corrector_batch.py b/corrector_module/opmon_corrector/tests/test_corrector_batch.py index f3eac62..663f5cd 100644 --- a/corrector_module/opmon_corrector/tests/test_corrector_batch.py +++ b/corrector_module/opmon_corrector/tests/test_corrector_batch.py @@ -205,7 +205,7 @@ def test_corrector_batch_timeout_documents(mongo, batch, caplog): @freeze_time("2022-12-24") -def test_corrector_batch_update_after_timeout(mongo, batch): +def test_corrector_batch_update_after_timeout(mongo): insert_fixture(mongo, 'raw_messages', read_fixture('raw_messages_batch_1_timeout')) settings = OpmonSettingsManager('UNITTEST').settings From aadd1b44de04eebc84d2020a76f2a3ccf3dc454f Mon Sep 17 00:00:00 2001 From: VitaliStupin Date: Fri, 18 Oct 2024 16:34:59 +0300 Subject: [PATCH 06/36] Fix top 5 charts values in reports by calculating the correct average query duration --- .../opmon_reports/report_manager.py | 24 +++++++++++++++---- .../tests/test_report_manager.py | 12 +++++----- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/reports_module/opmon_reports/report_manager.py b/reports_module/opmon_reports/report_manager.py index 11efb12..eccff11 100644 --- a/reports_module/opmon_reports/report_manager.py +++ b/reports_module/opmon_reports/report_manager.py @@ -399,8 +399,10 @@ def get_succeeded_top(self, data, produced_service): if count <= 0: continue - if name not in result_dict or result_dict[name] < count: + if name not in result_dict: result_dict[name] = count + else: + result_dict[name] += count sorted_pairs = sorted(result_dict.items(), key=operator.itemgetter(1)) return sorted_pairs if len(sorted_pairs) < 6 else sorted_pairs[-5:] @@ -421,16 +423,28 @@ def create_duration_plot(self, data, produced_service, file_name): return self.create_plot(names, durations, translated_title, file_name) def get_duration_top(self, data, produced_service): + sum_dict = dict() + count_dict = dict() result_dict = dict() for key1 in data: for key2 in data[key1]: - duration = data[key1][key2].duration_avg.rounded_average + duration_sum = data[key1][key2].duration_avg.sum + query_count = data[key1][key2].duration_avg.count + duration_mean = data[key1][key2].duration_avg.rounded_average name = f"{self.target.subsystem_code}: {key1}" if produced_service else f"{key1}: {key2}" - if duration is None: + if duration_mean is None: continue - if name not in result_dict or result_dict[name] < duration: - result_dict[name] = duration + if name not in result_dict: + sum_dict[name] = duration_sum + count_dict[name] = query_count + result_dict[name] = duration_mean + else: + # Calculating the average duration of a produced service by summing + # the client report rows + sum_dict[name] += duration_sum + count_dict[name] += query_count + result_dict[name] = round(sum_dict[name] / count_dict[name]) sorted_pairs = sorted(result_dict.items(), key=operator.itemgetter(1)) return sorted_pairs if len(sorted_pairs) < 6 else sorted_pairs[-5:] diff --git a/reports_module/opmon_reports/tests/test_report_manager.py b/reports_module/opmon_reports/tests/test_report_manager.py index 5c14b9d..f638329 100644 --- a/reports_module/opmon_reports/tests/test_report_manager.py +++ b/reports_module/opmon_reports/tests/test_report_manager.py @@ -226,9 +226,9 @@ def test_get_succeeded_top(mocker, basic_args, target_subsystem): test_data = map_rows_to_producer_services(rows) succeeded_top = report_manager.get_succeeded_top(test_data, produced_service=True) assert succeeded_top == [ - ('TEST_SUB: service_2', 12), - ('TEST_SUB: service_3', 14), - ('TEST_SUB: service_1', 15) + ('TEST_SUB: service_1', 32), + ('TEST_SUB: service_2', 32), + ('TEST_SUB: service_3', 35) ] test_data = map_rows_to_consumer_services(rows) @@ -264,9 +264,9 @@ def test_get_duration(mocker, basic_args, target_subsystem): test_data = map_rows_to_producer_services(rows) duration_top = report_manager.get_duration_top(test_data, produced_service=True) assert duration_top == [ - ('TEST_SUB: service_2', 90), - ('TEST_SUB: service_1', 100), - ('TEST_SUB: service_3', 110) + ('TEST_SUB: service_2', 39), + ('TEST_SUB: service_1', 43), + ('TEST_SUB: service_3', 47) ] test_data = map_rows_to_consumer_services(rows) From 10eb6292ef2b54186c1e34de80f39c753b87de80 Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Fri, 18 Oct 2024 19:44:24 +0300 Subject: [PATCH 07/36] chore: Ignore dependencies that require python >= 3.9 from dependabot --- .github/dependabot.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3ba3927..1ee97bf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -24,6 +24,22 @@ updates: applies-to: version-updates update-types: - "major" + ignore: # ignoring the following packages as they require python >= 3.9 + - dependency-name: "matplotlib" + versions: + - ">= 3.8.0" + - dependency-name: "pandas" + versions: + - ">= 2.1.0" + - dependency-name: "weasyprint" + versions: + - ">= 62.0" + - dependency-name: "numpy" + versions: + - ">= 1.25.0" + - dependency-name: "contourpy" + versions: + - ">= 1.2.0" - package-ecosystem: "github-actions" directory: "/.github/workflows" From d31bcc280de5bc9cbe9b790e3c1d706e04393fc8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 17:13:22 +0000 Subject: [PATCH 08/36] chore(deps): bump the python-minor-patch group across 5 directories with 3 updates Bumps the python-minor-patch group with 3 updates in the /anonymizer_module directory: [setuptools](https://github.com/pypa/setuptools), [pymongo](https://github.com/mongodb/mongo-python-driver) and [psycopg2](https://github.com/psycopg/psycopg2). Bumps the python-minor-patch group with 2 updates in the /collector_module directory: [setuptools](https://github.com/pypa/setuptools) and [pymongo](https://github.com/mongodb/mongo-python-driver). Bumps the python-minor-patch group with 2 updates in the /corrector_module directory: [setuptools](https://github.com/pypa/setuptools) and [pymongo](https://github.com/mongodb/mongo-python-driver). Bumps the python-minor-patch group with 3 updates in the /opendata_module directory: [setuptools](https://github.com/pypa/setuptools), [pymongo](https://github.com/mongodb/mongo-python-driver) and [psycopg2](https://github.com/psycopg/psycopg2). Bumps the python-minor-patch group with 1 update in the /reports_module directory: [pymongo](https://github.com/mongodb/mongo-python-driver). Updates `setuptools` from 75.1.0 to 75.2.0 - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v75.1.0...v75.2.0) Updates `pymongo` from 4.9.1 to 4.10.1 - [Release notes](https://github.com/mongodb/mongo-python-driver/releases) - [Changelog](https://github.com/mongodb/mongo-python-driver/blob/master/doc/changelog.rst) - [Commits](https://github.com/mongodb/mongo-python-driver/compare/4.9.1...4.10.1) Updates `psycopg2` from 2.9.9 to 2.9.10 - [Changelog](https://github.com/psycopg/psycopg2/blob/master/NEWS) - [Commits](https://github.com/psycopg/psycopg2/commits) Updates `setuptools` from 75.1.0 to 75.2.0 - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v75.1.0...v75.2.0) Updates `pymongo` from 4.9.1 to 4.10.1 - [Release notes](https://github.com/mongodb/mongo-python-driver/releases) - [Changelog](https://github.com/mongodb/mongo-python-driver/blob/master/doc/changelog.rst) - [Commits](https://github.com/mongodb/mongo-python-driver/compare/4.9.1...4.10.1) Updates `setuptools` from 75.1.0 to 75.2.0 - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v75.1.0...v75.2.0) Updates `pymongo` from 4.9.1 to 4.10.1 - [Release notes](https://github.com/mongodb/mongo-python-driver/releases) - [Changelog](https://github.com/mongodb/mongo-python-driver/blob/master/doc/changelog.rst) - [Commits](https://github.com/mongodb/mongo-python-driver/compare/4.9.1...4.10.1) Updates `setuptools` from 75.1.0 to 75.2.0 - [Release notes](https://github.com/pypa/setuptools/releases) - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst) - [Commits](https://github.com/pypa/setuptools/compare/v75.1.0...v75.2.0) Updates `pymongo` from 4.9.1 to 4.10.1 - [Release notes](https://github.com/mongodb/mongo-python-driver/releases) - [Changelog](https://github.com/mongodb/mongo-python-driver/blob/master/doc/changelog.rst) - [Commits](https://github.com/mongodb/mongo-python-driver/compare/4.9.1...4.10.1) Updates `psycopg2` from 2.9.9 to 2.9.10 - [Changelog](https://github.com/psycopg/psycopg2/blob/master/NEWS) - [Commits](https://github.com/psycopg/psycopg2/commits) Updates `pymongo` from 4.9.1 to 4.10.1 - [Release notes](https://github.com/mongodb/mongo-python-driver/releases) - [Changelog](https://github.com/mongodb/mongo-python-driver/blob/master/doc/changelog.rst) - [Commits](https://github.com/mongodb/mongo-python-driver/compare/4.9.1...4.10.1) --- updated-dependencies: - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-minor dependency-group: python-minor-patch - dependency-name: pymongo dependency-type: direct:production update-type: version-update:semver-minor dependency-group: python-minor-patch - dependency-name: psycopg2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: python-minor-patch - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-minor dependency-group: python-minor-patch - dependency-name: pymongo dependency-type: direct:production update-type: version-update:semver-minor dependency-group: python-minor-patch - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-minor dependency-group: python-minor-patch - dependency-name: pymongo dependency-type: direct:production update-type: version-update:semver-minor dependency-group: python-minor-patch - dependency-name: setuptools dependency-type: direct:production update-type: version-update:semver-minor dependency-group: python-minor-patch - dependency-name: pymongo dependency-type: direct:production update-type: version-update:semver-minor dependency-group: python-minor-patch - dependency-name: psycopg2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: python-minor-patch - dependency-name: pymongo dependency-type: direct:production update-type: version-update:semver-minor dependency-group: python-minor-patch ... Signed-off-by: dependabot[bot] --- anonymizer_module/setup.py | 6 +++--- collector_module/setup.py | 4 ++-- corrector_module/setup.py | 4 ++-- opendata_module/setup.py | 6 +++--- reports_module/setup.py | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/anonymizer_module/setup.py b/anonymizer_module/setup.py index 37c94e9..63afecd 100644 --- a/anonymizer_module/setup.py +++ b/anonymizer_module/setup.py @@ -25,10 +25,10 @@ from setuptools import setup, find_packages requirements = [ - 'setuptools==75.1.0', - 'pymongo==4.9.1', + 'setuptools==75.2.0', + 'pymongo==4.10.1', 'pyyaml==6.0.2', - 'psycopg2==2.9.9', + 'psycopg2==2.9.10', 'python-dateutil==2.9.0.post0', ] diff --git a/collector_module/setup.py b/collector_module/setup.py index b0e5829..10a1efe 100644 --- a/collector_module/setup.py +++ b/collector_module/setup.py @@ -25,8 +25,8 @@ from setuptools import setup requirements = [ - 'setuptools==75.1.0', - 'pymongo==4.9.1', + 'setuptools==75.2.0', + 'pymongo==4.10.1', 'requests==2.32.3', 'tqdm==4.66.5', 'pyyaml==6.0.2', diff --git a/corrector_module/setup.py b/corrector_module/setup.py index e0c1e9f..96214f5 100644 --- a/corrector_module/setup.py +++ b/corrector_module/setup.py @@ -25,8 +25,8 @@ from setuptools import setup requirements = [ - 'setuptools==75.1.0', - 'pymongo==4.9.1', + 'setuptools==75.2.0', + 'pymongo==4.10.1', 'pyyaml==6.0.2', ] diff --git a/opendata_module/setup.py b/opendata_module/setup.py index f28ef63..d6d8014 100644 --- a/opendata_module/setup.py +++ b/opendata_module/setup.py @@ -25,12 +25,12 @@ from setuptools import setup, find_packages requirements = [ - 'setuptools==75.1.0', + 'setuptools==75.2.0', 'dill==0.3.9', 'django==3.2.20', - 'pymongo==4.9.1', + 'pymongo==4.10.1', 'pyyaml==6.0.2', - 'psycopg2==2.9.9', + 'psycopg2==2.9.10', 'python-dateutil==2.9.0.post0', ] diff --git a/reports_module/setup.py b/reports_module/setup.py index 3379485..e6fcb86 100644 --- a/reports_module/setup.py +++ b/reports_module/setup.py @@ -34,7 +34,7 @@ 'pandas==2.0.3', 'weasyprint==61.2', 'Pillow==10.4.0', - 'pymongo==4.9.1', + 'pymongo==4.10.1', 'pyyaml==6.0.2', 'requests==2.32.3', 'tinycss==0.4', From d7cedc6d55cfb9c24060b3838121e4a6ca768fcf Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Fri, 18 Oct 2024 20:56:22 +0300 Subject: [PATCH 09/36] chore: Ignore dependencies that require python >= 3.9 from dependabot --- .github/dependabot.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1ee97bf..7b2997c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -40,6 +40,15 @@ updates: - dependency-name: "contourpy" versions: - ">= 1.2.0" + - dependency-name: "markupsafe" + versions: + - ">= 3.0.0" + - dependency-name: "Pillow" + versions: + - ">= 11.0" + - dependency-name: "django" + versions: + - ">= 5.0" - package-ecosystem: "github-actions" directory: "/.github/workflows" From 3a14dad3872f651d7530c3db04c4023048dded98 Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Thu, 24 Oct 2024 07:17:13 +0300 Subject: [PATCH 10/36] chore: Ignore dependencies that require python >= 3.9 from dependabot --- .github/dependabot.yml | 3 +++ reports_module/setup.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7b2997c..a55caac 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -49,6 +49,9 @@ updates: - dependency-name: "django" versions: - ">= 5.0" + - dependency-name: "pyparsing" + versions: + - ">= 3.2.0" - package-ecosystem: "github-actions" directory: "/.github/workflows" diff --git a/reports_module/setup.py b/reports_module/setup.py index e6fcb86..446a28a 100644 --- a/reports_module/setup.py +++ b/reports_module/setup.py @@ -25,12 +25,12 @@ from setuptools import setup, find_packages # The following dependencies has newer versions, but require Python 3.9 or higher -# matplotlib, pandas, weasyprint, numpy, contourpy +# matplotlib, pandas, weasyprint, numpy, contourpy, pyparsing requirements = [ 'markupsafe==2.1.5', 'Jinja2==3.1.4', - 'matplotlib==3.7.5', + 'matplotlib==3.1.2', 'pandas==2.0.3', 'weasyprint==61.2', 'Pillow==10.4.0', @@ -41,6 +41,7 @@ 'jsonschema==4.23.0', 'numpy==1.24.4', 'contourpy==1.1.1', + 'pyparsing==3.1.4', ] classifiers = [ From e3414a685583987b750e13bf8cca36796afb1bec Mon Sep 17 00:00:00 2001 From: Mohamed ElBeltagy <60988715+melbeltagy@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:10:14 +0200 Subject: [PATCH 11/36] Fix OpenData create_users tests and run them in tox (test coverage) (#143) * fix: Fix opendata module's create_users tests * fix: Fix opendata module's create_users pycodestyle --- .../opmon_postgresql_maintenance/__init__.py | 1 - .../tests/test_create_users.py | 35 ++++++++++++------- opendata_module/tox.ini | 6 ++-- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/opendata_module/opmon_postgresql_maintenance/__init__.py b/opendata_module/opmon_postgresql_maintenance/__init__.py index 0fd6f47..5933e5a 100644 --- a/opendata_module/opmon_postgresql_maintenance/__init__.py +++ b/opendata_module/opmon_postgresql_maintenance/__init__.py @@ -19,4 +19,3 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. - diff --git a/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py b/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py index 5ef0d61..0e6093f 100644 --- a/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py +++ b/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py @@ -92,61 +92,70 @@ def test_connect_postgres_with_password_prompt(mocker): def test_create_users(mocker): + cursor = mocker.Mock() + cursor.execute = mocker.Mock() postgres = mocker.Mock() - postgres.execute = mocker.Mock(return_value='passwords') + postgres.cursor.return_value = cursor + mocker.patch('opmon_postgresql_maintenance.create_users._generate_password', return_value='passwords') args = Namespace(xroad="foo", dummy_passwords=False) passwords = create_users._create_users(args, postgres) - assert postgres.execute.call_count == len(create_users.full_users) + len(create_users.read_only_users) + assert cursor.execute.call_count == len(create_users.full_users) + len(create_users.read_only_users) for user, pwd in passwords.items(): assert user.endswith('_foo') - assert len(pwd) == 12 + assert len(pwd) == 9 quoted_password = QuotedString(pwd).getquoted().decode('utf-8') expected_call = call(f"CREATE USER {user} WITH PASSWORD {quoted_password};") - assert expected_call in postgres.execute.call_args_list + assert expected_call in cursor.execute.call_args_list def test_create_users_with_dummy_passwords(mocker): + cursor = mocker.Mock() + cursor.execute = mocker.Mock() postgres = mocker.Mock() - postgres.execute = mocker.Mock(return_value='passwords') + postgres.cursor.return_value = cursor args = Namespace(xroad="foo", dummy_passwords=True) passwords = create_users._create_users(args, postgres) - assert postgres.execute.call_count == len(create_users.full_users) + len(create_users.read_only_users) + assert cursor.execute.call_count == len(create_users.full_users) + len(create_users.read_only_users) for user, pwd in passwords.items(): assert user.endswith('_foo') assert pwd == user quoted_password = QuotedString(pwd).getquoted().decode('utf-8') expected_call = call(f"CREATE USER {user} WITH PASSWORD {quoted_password};") - assert expected_call in postgres.execute.call_args_list + assert expected_call in cursor.execute.call_args_list def test_create_database(mocker): + cursor = mocker.Mock() + cursor.execute = mocker.Mock() postgres = mocker.Mock() - postgres.execute = mocker.Mock(return_value='passwords') + postgres.cursor.return_value = cursor args = Namespace(xroad="foo") create_users._create_database(args, postgres) - postgres.execute.assert_called_once() - pretty_args = ' '.join(postgres.execute.call_args[0][0].replace('\n', ' ').split()) + cursor.execute.assert_called_once() + pretty_args = ' '.join(cursor.execute.call_args[0][0].replace('\n', ' ').split()) assert pretty_args == "CREATE DATABASE opendata_foo WITH TEMPLATE template0 ENCODING 'utf8' " \ + "LC_COLLATE 'en_US.utf8' LC_CTYPE 'en_US.utf8';" def test_grant_priviledges(mocker): + cursor = mocker.Mock() + cursor.execute = mocker.Mock() postgres = mocker.Mock() - postgres.execute = mocker.Mock(return_value='passwords') + postgres.cursor.return_value = cursor args = Namespace(xroad="foo", dummy_passwords=True) create_users._grant_privileges(args, postgres) - assert postgres.execute.call_count == len(create_users.full_users) + len(create_users.read_only_users) - for call in postgres.execute.call_args_list: + assert cursor.execute.call_count == len(create_users.full_users) + len(create_users.read_only_users) + for call in cursor.execute.call_args_list: assert call.args[0].startswith('GRANT') diff --git a/opendata_module/tox.ini b/opendata_module/tox.ini index 2ff1ca8..eec419b 100644 --- a/opendata_module/tox.ini +++ b/opendata_module/tox.ini @@ -8,9 +8,9 @@ deps = [testenv:py38-pytest] install_command=pip install --only-binary=numpy {opts} numpy {packages} commands = - coverage run --source opmon_opendata -m pytest opmon_opendata/ - coverage report --include=opmon_opendata/* - coverage html -d ../htmlcov/opendata_module --include=opmon_opendata/* + coverage run --source opmon_opendata,opmon_postgresql_maintenance -m pytest opmon_opendata/ opmon_postgresql_maintenance/ + coverage report --include=opmon_opendata/*,opmon_postgresql_maintenance/* --fail-under=60 + coverage html -d ../htmlcov/opendata_module --include=opmon_opendata/*,opmon_postgresql_maintenance/* [testenv:py38-legacy_django] deps = django==2.2.28 From 2608d5f97f4c74cd30f41d77fc64bf445a114753 Mon Sep 17 00:00:00 2001 From: Mohamed ElBeltagy <60988715+melbeltagy@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:08:58 +0200 Subject: [PATCH 12/36] chore: remove unnecessary test-dependency (pymongo-stubs) (#144) * chore: remove unnecessary test-dependency (pymongo-stubs) * chore: add typehint to fix mypy errors in anonymizer module Refs: OPMONDEV-187 --- anonymizer_module/metrics_statistics/mongodb_manager.py | 4 ++-- anonymizer_module/test_requirements.txt | 2 -- opendata_collector_module/test_requirements.txt | 1 - opendata_module/test_requirements.txt | 3 +-- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/anonymizer_module/metrics_statistics/mongodb_manager.py b/anonymizer_module/metrics_statistics/mongodb_manager.py index 155af4f..eec64a9 100644 --- a/anonymizer_module/metrics_statistics/mongodb_manager.py +++ b/anonymizer_module/metrics_statistics/mongodb_manager.py @@ -209,7 +209,7 @@ def get_requests_counts(self) -> RequestsCountData: A dictionary containing the counts of requests for different time ranges. The keys in the dictionary represent the time ranges, and the values represent the corresponding request counts. """ - client = MongoClient(self.mongo_uri, **dict(self.connect_args)) + client: MongoClient = MongoClient(self.mongo_uri, **dict(self.connect_args)) db = client[self.db_name] collection = db['clean_data'] @@ -273,7 +273,7 @@ def _get_service_key_map(services: List[str]) -> Dict[str, str]: } def _get_db_service_request_counts(self, services: List[str]) -> CommandCursor: - client = MongoClient(self.mongo_uri, **dict(self.connect_args)) + client: MongoClient = MongoClient(self.mongo_uri, **dict(self.connect_args)) db = client[self.db_name] collection = db['clean_data'] pipeline = self.generate_services_count_pipeline(services) diff --git a/anonymizer_module/test_requirements.txt b/anonymizer_module/test_requirements.txt index 827115d..eea63fa 100644 --- a/anonymizer_module/test_requirements.txt +++ b/anonymizer_module/test_requirements.txt @@ -6,8 +6,6 @@ pytest-html mongomock psycopg2-binary mypy -pymongo-stubs freezegun pyyaml requests - diff --git a/opendata_collector_module/test_requirements.txt b/opendata_collector_module/test_requirements.txt index 0117287..d074ba8 100644 --- a/opendata_collector_module/test_requirements.txt +++ b/opendata_collector_module/test_requirements.txt @@ -4,4 +4,3 @@ pytest-mock pytest-pycodestyle pytest-html vcrpy==1.5.2 -pymongo-stubs diff --git a/opendata_module/test_requirements.txt b/opendata_module/test_requirements.txt index 42951eb..b633b5e 100644 --- a/opendata_module/test_requirements.txt +++ b/opendata_module/test_requirements.txt @@ -11,5 +11,4 @@ freezegun django-stubs pytz pyyaml -pymongo-stubs -freezegun \ No newline at end of file +freezegun From 24adeeb1a35a0bf713418c76f83410bef9172f82 Mon Sep 17 00:00:00 2001 From: Mohamed ElBeltagy <60988715+melbeltagy@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:15:26 +0200 Subject: [PATCH 13/36] chore: OpenData Module - Drop legacy support for Django 2.x in tests, and use the same version of Django declared as dependency in tests (#142) * chore: Drop legacy support for Django 2.x in tests * chore: Use Django version declared in requirements in tests too Refs: OPMONDEV-187 --- opendata_module/tox.ini | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/opendata_module/tox.ini b/opendata_module/tox.ini index eec419b..1bd6377 100644 --- a/opendata_module/tox.ini +++ b/opendata_module/tox.ini @@ -2,22 +2,13 @@ envlist = py38-{pytest,mypy,legacy_django} [testenv] -deps = - django==3.2.20 - -r test_requirements.txt +deps = -r test_requirements.txt [testenv:py38-pytest] install_command=pip install --only-binary=numpy {opts} numpy {packages} commands = coverage run --source opmon_opendata,opmon_postgresql_maintenance -m pytest opmon_opendata/ opmon_postgresql_maintenance/ coverage report --include=opmon_opendata/*,opmon_postgresql_maintenance/* --fail-under=60 coverage html -d ../htmlcov/opendata_module --include=opmon_opendata/*,opmon_postgresql_maintenance/* -[testenv:py38-legacy_django] -deps = - django==2.2.28 - -r test_requirements.txt -install_command=pip install --only-binary=numpy {opts} numpy {packages} -commands = - - coverage run --source opmon_opendata -m pytest opmon_opendata/ [testenv:py38-mypy] description = Run mypy deps = From b80e2cd33eab323178e2fe29cfa29419bd8ad963 Mon Sep 17 00:00:00 2001 From: Mohamed ElBeltagy <60988715+melbeltagy@users.noreply.github.com> Date: Fri, 1 Nov 2024 15:19:39 +0200 Subject: [PATCH 14/36] Switch from pycodestyle to ruff as a linter (#111) * style: Use ruff for code linter and generate html reports for test results * chore: Exclude F401 checks from Django related files * chore: Remove unused imports * chore: Remove unnecessary string formatting * fix: Fix PR's review comments * feat: Switch from pycodestyle to ruff as a linter * fix: Fix errors after switching to ruff * feat: Update run_tests.sh command to use ruff and run tests * fix: Fix collector module failed type checks * fix: Fix opendata module --- analysis_module/ruff.toml | 76 +++++++++++ analysis_module/test_requirements.txt | 3 +- analysis_module/tox.ini | 25 +++- analysis_ui_module/opmon_analyzer_ui/admin.py | 2 +- .../opmon_analyzer_ui/models.py | 2 +- analysis_ui_module/opmon_analyzer_ui/views.py | 2 +- analysis_ui_module/requirements.txt | 1 + analysis_ui_module/ruff.toml | 76 +++++++++++ analysis_ui_module/test_requirements.txt | 2 + analysis_ui_module/tox.ini | 27 ++-- analysis_ui_module/usr/manage.py | 2 +- .../opmon_anonymizer/opendata_anonymizer.py | 1 - .../tests/test_anonymization_job.py | 2 +- .../opmon_anonymizer/tests/test_anonymizer.py | 2 +- .../tests/test_settings_parser.py | 4 +- anonymizer_module/ruff.toml | 76 +++++++++++ anonymizer_module/test_requirements.txt | 3 +- anonymizer_module/tox.ini | 25 ++-- archive_module/clean_data_archive.py | 1 - .../opmon_collector/collector_worker.py | 12 +- .../opmon_collector/tests/test_settings.py | 6 +- .../create_indexes.py | 128 ++++++++++-------- collector_module/ruff.toml | 76 +++++++++++ collector_module/test_requirements.txt | 4 +- collector_module/tox.ini | 26 +++- .../opmon_corrector/corrector_batch.py | 4 +- .../opmon_corrector/document_manager.py | 4 +- .../tests/test_settings_parser.py | 4 +- corrector_module/ruff.toml | 76 +++++++++++ corrector_module/test_requirements.txt | 2 + corrector_module/tox.ini | 25 +++- .../test_analyzer_aggregation_queries.py | 1 - .../ci_analyzer/test_analyzer_timeperiods.py | 1 - .../ci_anonymizer/ci_anonymizer_settings.py | 4 +- .../ci_collector/test_collector.py | 12 +- .../helpers/ci_analyzer_db_handler.py | 1 - .../tests/test_main.py | 1 - opendata_collector_module/requirements.txt | 1 + opendata_collector_module/ruff.toml | 76 +++++++++++ .../test_requirements.txt | 3 +- opendata_collector_module/tox.ini | 24 ++-- opendata_module/opmon_opendata/api/admin.py | 2 +- opendata_module/opmon_opendata/api/models.py | 2 +- opendata_module/opmon_opendata/api/urls.py | 2 +- opendata_module/opmon_opendata/gui/admin.py | 2 +- opendata_module/opmon_opendata/gui/models.py | 2 +- opendata_module/opmon_opendata/gui/urls.py | 2 +- .../tests/manual/create_example_table.py | 2 +- .../opmon_opendata/tests/test_api.py | 58 ++++---- .../tests/test_create_users.py | 4 +- opendata_module/ruff.toml | 76 +++++++++++ opendata_module/test_requirements.txt | 6 +- opendata_module/tox.ini | 23 ++-- opendata_module/usr/manage.py | 2 +- .../opmon_reports/report_manager.py | 4 +- .../opmon_reports/reports_arguments.py | 2 +- .../opmon_reports/time_date_tools.py | 2 +- .../opmon_reports/xroad_descriptor.py | 3 +- reports_module/ruff.toml | 76 +++++++++++ reports_module/test_requirements.txt | 6 +- reports_module/tox.ini | 26 +++- ruff.toml | 76 +++++++++++ run_tests.sh | 35 +++-- 63 files changed, 1017 insertions(+), 219 deletions(-) create mode 100644 analysis_module/ruff.toml create mode 100644 analysis_ui_module/requirements.txt create mode 100644 analysis_ui_module/ruff.toml create mode 100644 anonymizer_module/ruff.toml create mode 100644 collector_module/ruff.toml create mode 100644 corrector_module/ruff.toml create mode 100644 opendata_collector_module/requirements.txt create mode 100644 opendata_collector_module/ruff.toml create mode 100644 opendata_module/ruff.toml create mode 100644 reports_module/ruff.toml create mode 100644 ruff.toml diff --git a/analysis_module/ruff.toml b/analysis_module/ruff.toml new file mode 100644 index 0000000..5ae4773 --- /dev/null +++ b/analysis_module/ruff.toml @@ -0,0 +1,76 @@ +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +line-length = 160 +indent-width = 4 + +# Assume Python 3.8 +target-version = "py38" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = false + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" diff --git a/analysis_module/test_requirements.txt b/analysis_module/test_requirements.txt index f0f8e96..e4d0b8b 100644 --- a/analysis_module/test_requirements.txt +++ b/analysis_module/test_requirements.txt @@ -1,6 +1,7 @@ coverage pytest pytest-mock -pytest-pycodestyle +pytest-ruff pytest-html +ruff mongomock diff --git a/analysis_module/tox.ini b/analysis_module/tox.ini index 410f0fa..a3d538b 100644 --- a/analysis_module/tox.ini +++ b/analysis_module/tox.ini @@ -1,17 +1,28 @@ [tox] -envlist = py38 +env_list = lint, type, py38 [testenv] -deps = -rtest_requirements.txt +description = Run the tests with pytest and coverage +deps = -r test_requirements.txt install_command=pip install --only-binary=numpy {opts} numpy {packages} commands = coverage run --source opmon_analyzer -m pytest opmon_analyzer/ - coverage report --include=opmon_analyzer/* + coverage report --include=opmon_analyzer/* --fail-under=60 coverage html -d ../htmlcov/analysis_module --include=opmon_analyzer/* -[pycodestyle] -max-line-length = 160 -ignore = W293,W503,E402 +[testenv:lint] +description = Run linter +skip_install = true +deps = {[testenv]deps} +commands = ruff check + +[testenv:type] +description = Run mypy for type checks +deps = + mypy + {[testenv]deps} +commands = + mypy --install-types --non-interactive {toxinidir}/opmon_analyzer/ [pytest] -addopts = --pycodestyle -v --junitxml test_results.xml \ No newline at end of file +addopts = --ruff -v --junitxml test_results.xml \ No newline at end of file diff --git a/analysis_ui_module/opmon_analyzer_ui/admin.py b/analysis_ui_module/opmon_analyzer_ui/admin.py index 09bb6ab..f3e2086 100644 --- a/analysis_ui_module/opmon_analyzer_ui/admin.py +++ b/analysis_ui_module/opmon_analyzer_ui/admin.py @@ -20,6 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from django.contrib import admin +from django.contrib import admin # noqa: F401 # Register your models here. diff --git a/analysis_ui_module/opmon_analyzer_ui/models.py b/analysis_ui_module/opmon_analyzer_ui/models.py index 86e0d5f..939c813 100644 --- a/analysis_ui_module/opmon_analyzer_ui/models.py +++ b/analysis_ui_module/opmon_analyzer_ui/models.py @@ -20,6 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from django.db import models +from django.db import models # noqa: F401 # Create your models here. diff --git a/analysis_ui_module/opmon_analyzer_ui/views.py b/analysis_ui_module/opmon_analyzer_ui/views.py index 561acd6..2ff40a0 100644 --- a/analysis_ui_module/opmon_analyzer_ui/views.py +++ b/analysis_ui_module/opmon_analyzer_ui/views.py @@ -25,7 +25,7 @@ from bson import ObjectId from django.shortcuts import render -from django.http import HttpResponse, HttpResponseNotFound, HttpResponseServerError +from django.http import HttpResponse, HttpResponseNotFound from django.template.defaulttags import register from django.views.decorators.csrf import ensure_csrf_cookie import numpy as np diff --git a/analysis_ui_module/requirements.txt b/analysis_ui_module/requirements.txt new file mode 100644 index 0000000..945c9b4 --- /dev/null +++ b/analysis_ui_module/requirements.txt @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/analysis_ui_module/ruff.toml b/analysis_ui_module/ruff.toml new file mode 100644 index 0000000..5ae4773 --- /dev/null +++ b/analysis_ui_module/ruff.toml @@ -0,0 +1,76 @@ +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +line-length = 160 +indent-width = 4 + +# Assume Python 3.8 +target-version = "py38" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = false + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" diff --git a/analysis_ui_module/test_requirements.txt b/analysis_ui_module/test_requirements.txt index f0f8e96..d180be9 100644 --- a/analysis_ui_module/test_requirements.txt +++ b/analysis_ui_module/test_requirements.txt @@ -3,4 +3,6 @@ pytest pytest-mock pytest-pycodestyle pytest-html +pytest-ruff +ruff mongomock diff --git a/analysis_ui_module/tox.ini b/analysis_ui_module/tox.ini index a520daf..887f620 100644 --- a/analysis_ui_module/tox.ini +++ b/analysis_ui_module/tox.ini @@ -1,17 +1,28 @@ [tox] -envlist = py38 +env_list = lint, type, py38 [testenv] -deps = -rtest_requirements.txt +description = Run the tests with pytest and coverage +deps = -r test_requirements.txt install_command=pip install --only-binary=numpy {opts} numpy {packages} commands = coverage run --source opmon_analyzer_ui -m pytest opmon_analyzer_ui/ - coverage report --include=opmon_analyzer_ui/* - coverage html -d ../htmlcov/analysis_ui_module --include=opmon_analyzer_ui/* + coverage report --include=opmon_analyzer_ui/* --fail-under=60 + coverage html -d ../htmlcov/opmon_analyzer_ui --include=opmon_analyzer_ui/* -[pycodestyle] -max-line-length = 160 -ignore = W293,W503,E402 +[testenv:lint] +description = Run linter +skip_install = true +deps = {[testenv]deps} +commands = ruff check + +[testenv:type] +description = Run mypy for type checks +deps = + mypy + {[testenv]deps} +commands = + mypy --install-types --non-interactive {toxinidir}/opmon_analyzer_ui/ [pytest] -addopts = --pycodestyle -v --junitxml test_results.xml \ No newline at end of file +addopts = --ruff -v --junitxml test_results.xml \ No newline at end of file diff --git a/analysis_ui_module/usr/manage.py b/analysis_ui_module/usr/manage.py index 337f528..7372049 100644 --- a/analysis_ui_module/usr/manage.py +++ b/analysis_ui_module/usr/manage.py @@ -34,7 +34,7 @@ # issue is really that Django is missing to avoid masking other # exceptions on Python 2. try: - import django + import django # noqa F401 except ImportError: raise ImportError( "Couldn't import Django. Are you sure it's installed and " diff --git a/anonymizer_module/opmon_anonymizer/opendata_anonymizer.py b/anonymizer_module/opmon_anonymizer/opendata_anonymizer.py index 747a133..11cdf66 100644 --- a/anonymizer_module/opmon_anonymizer/opendata_anonymizer.py +++ b/anonymizer_module/opmon_anonymizer/opendata_anonymizer.py @@ -21,7 +21,6 @@ # THE SOFTWARE. import os -import traceback from typing import List, Optional from opmon_anonymizer.anonymizer import AnonymizationJob, Anonymizer diff --git a/anonymizer_module/opmon_anonymizer/tests/test_anonymization_job.py b/anonymizer_module/opmon_anonymizer/tests/test_anonymization_job.py index 830d4b9..e2909f5 100644 --- a/anonymizer_module/opmon_anonymizer/tests/test_anonymization_job.py +++ b/anonymizer_module/opmon_anonymizer/tests/test_anonymization_job.py @@ -24,7 +24,7 @@ import re import unittest -from unittest.mock import Mock, MagicMock +from unittest.mock import MagicMock from opmon_anonymizer.anonymizer import AnonymizationJob diff --git a/anonymizer_module/opmon_anonymizer/tests/test_anonymizer.py b/anonymizer_module/opmon_anonymizer/tests/test_anonymizer.py index 1db454a..de7429f 100644 --- a/anonymizer_module/opmon_anonymizer/tests/test_anonymizer.py +++ b/anonymizer_module/opmon_anonymizer/tests/test_anonymizer.py @@ -23,7 +23,7 @@ import os import unittest -from unittest.mock import MagicMock, Mock +from unittest.mock import Mock from opmon_anonymizer.anonymizer import Anonymizer diff --git a/anonymizer_module/opmon_anonymizer/tests/test_settings_parser.py b/anonymizer_module/opmon_anonymizer/tests/test_settings_parser.py index 432a0f2..1ac0390 100644 --- a/anonymizer_module/opmon_anonymizer/tests/test_settings_parser.py +++ b/anonymizer_module/opmon_anonymizer/tests/test_settings_parser.py @@ -72,12 +72,12 @@ def test_loading_settings_file_with_profile(set_dir): def test_loading_non_existing_settings_file(set_dir): with pytest.raises(FileNotFoundError): - settings = OpmonSettingsManager('NOTFOUND').settings + settings = OpmonSettingsManager('NOTFOUND').settings #noqa F841 def test_loading_invalid_settings_file(set_dir): with pytest.raises(YAMLError): - settings = OpmonSettingsManager('INVALID').settings + settings = OpmonSettingsManager('INVALID').settings #noqa F841 def test_get_setting(set_dir): diff --git a/anonymizer_module/ruff.toml b/anonymizer_module/ruff.toml new file mode 100644 index 0000000..5ae4773 --- /dev/null +++ b/anonymizer_module/ruff.toml @@ -0,0 +1,76 @@ +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +line-length = 160 +indent-width = 4 + +# Assume Python 3.8 +target-version = "py38" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = false + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" diff --git a/anonymizer_module/test_requirements.txt b/anonymizer_module/test_requirements.txt index eea63fa..bc28c17 100644 --- a/anonymizer_module/test_requirements.txt +++ b/anonymizer_module/test_requirements.txt @@ -1,8 +1,9 @@ coverage pytest pytest-mock -pytest-pycodestyle +pytest-ruff pytest-html +ruff mongomock psycopg2-binary mypy diff --git a/anonymizer_module/tox.ini b/anonymizer_module/tox.ini index 6b39fcd..935890d 100644 --- a/anonymizer_module/tox.ini +++ b/anonymizer_module/tox.ini @@ -1,24 +1,29 @@ [tox] -envlist = py38-{pytest,mypy} +env_list = lint, type, py38 [testenv] -deps = -rtest_requirements.txt +description = Run the tests with pytest and coverage +deps = -r test_requirements.txt install_command=pip install --only-binary=numpy {opts} numpy {packages} commands = coverage run --source opmon_anonymizer,metrics_statistics -m pytest opmon_anonymizer/ metrics_statistics/ - coverage report --include=opmon_anonymizer/* - coverage html -d ../htmlcov/anonymizer_module --include=opmon_anonymizer/* -[testenv:py38-mypy] -description = Run mypy + coverage report --include=opmon_anonymizer/*,metrics_statistics/* --fail-under=60 + coverage html -d ../htmlcov/anonymizer_module --include=opmon_anonymizer/*,metrics_statistics/* + +[testenv:lint] +description = Run linter +skip_install = true +deps = {[testenv]deps} +commands = ruff check + +[testenv:type] +description = Run mypy for type checks deps = mypy {[testenv]deps} commands = mypy --install-types --non-interactive {toxinidir}/opmon_anonymizer/ mypy --install-types --non-interactive {toxinidir}/metrics_statistics/ -[pycodestyle] -max-line-length = 160 -ignore = W293,W503,E402 [pytest] -addopts = --pycodestyle -v --junitxml test_results.xml +addopts = --ruff -v --junitxml test_results.xml \ No newline at end of file diff --git a/archive_module/clean_data_archive.py b/archive_module/clean_data_archive.py index 7ba2a26..a58d8a6 100644 --- a/archive_module/clean_data_archive.py +++ b/archive_module/clean_data_archive.py @@ -7,7 +7,6 @@ """ -import os import locale import time from datetime import datetime diff --git a/collector_module/opmon_collector/collector_worker.py b/collector_module/opmon_collector/collector_worker.py index 9698a96..14a5d91 100644 --- a/collector_module/opmon_collector/collector_worker.py +++ b/collector_module/opmon_collector/collector_worker.py @@ -31,6 +31,7 @@ import zlib from enum import Enum from logging.handlers import RotatingFileHandler +from xml.etree.ElementTree import Element # noqa: F401 from xml.etree.ElementTree import ParseError import requests @@ -164,10 +165,13 @@ def _request_opmon_data(self): def _process_soap_errors(self, metrics_response: str) -> None: try: - root = ET.fromstring(metrics_response) - fault_code = root.find('.//{http://schemas.xmlsoap.org/soap/envelope/}Fault/faultcode').text - fault_string = root.find('.//{http://schemas.xmlsoap.org/soap/envelope/}Fault/faultstring').text - fault_detail = root.find('.//{http://schemas.xmlsoap.org/soap/envelope/}Fault/detail/faultDetail').text + root = ET.fromstring(metrics_response) # type: Element + fault_code_element = root.find('.//{http://schemas.xmlsoap.org/soap/envelope/}Fault/faultcode') + fault_string_element = root.find('.//{http://schemas.xmlsoap.org/soap/envelope/}Fault/faultstring') + fault_detail_element = root.find('.//{http://schemas.xmlsoap.org/soap/envelope/}Fault/detail/faultDetail') + fault_code = fault_code_element.text if fault_code_element is not None else None + fault_string = fault_string_element.text if fault_string_element is not None else None + fault_detail = fault_detail_element.text if fault_detail_element is not None else None if fault_code: error_message = f'Message: {fault_string}. Code: {fault_code}. Detail: {fault_detail}' if fault_code.startswith('Server.ClientProxy'): diff --git a/collector_module/opmon_collector/tests/test_settings.py b/collector_module/opmon_collector/tests/test_settings.py index cb07ab0..5993762 100644 --- a/collector_module/opmon_collector/tests/test_settings.py +++ b/collector_module/opmon_collector/tests/test_settings.py @@ -75,19 +75,19 @@ def test_loading_settings_file_with_invalid_extension(set_dir): open(filename, 'a').close() with pytest.raises(FileNotFoundError): - settings = OpmonSettingsManager('EXTENSIONTEST').settings + settings = OpmonSettingsManager('EXTENSIONTEST').settings # noqa F841 os.remove(filename) def test_loading_non_existing_settings_file(set_dir): with pytest.raises(FileNotFoundError): - settings = OpmonSettingsManager('NOTFOUND').settings + settings = OpmonSettingsManager('NOTFOUND').settings # noqa F841 def test_loading_invalid_settings_file(set_dir): with pytest.raises(YAMLError): - settings = OpmonSettingsManager('INVALID').settings + settings = OpmonSettingsManager('INVALID').settings # noqa F841 def test_get_setting(set_dir): diff --git a/collector_module/opmon_mongodb_maintenance/create_indexes.py b/collector_module/opmon_mongodb_maintenance/create_indexes.py index cd393b9..3450927 100644 --- a/collector_module/opmon_mongodb_maintenance/create_indexes.py +++ b/collector_module/opmon_mongodb_maintenance/create_indexes.py @@ -22,77 +22,91 @@ import logging -from pymongo import ASCENDING as ASC +from pymongo import IndexModel, ASCENDING as ASC from pymongo import MongoClient +from typing import List logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') logger = logging.getLogger(__file__) +class IndexRequest: + def __init__(self, db: str, collection: str, indexes: List[IndexModel]): + self.db = db + self.collection = collection + self.indexes = indexes + + def get_db(self) -> str: + return self.db + + def get_collection(self) -> str: + return self.collection + + def get_indexes(self) -> List[IndexModel]: + return self.indexes + indexRequests = [ - { - 'db': 'query_db', - 'collection': 'raw_messages', - 'indexes': [ - [('requestInTs', ASC)], - [('corrected', ASC), ('requestInTs', ASC)] - ] - }, - - { - 'db': 'query_db', - 'collection': 'clean_data', - 'indexes': [ - [('xRequestId', ASC)], - [('correctorTime', ASC)], - [('correctorStatus', ASC), ('client.requestInTs', ASC)], - [('correctorStatus', ASC), ('producer.requestInTs', ASC)], - [('correctorStatus', ASC), ('xRequestId', ASC)], - [('client.xRequestId', ASC)], - [('client.requestInTs', ASC)], - [('client.serviceCode', ASC)], - [('producer.requestInTs', ASC)], - [('producer.serviceCode', ASC)], - [('producer.xRequestId', ASC)], - [('client.clientMemberCode', ASC), ('client.clientSubsystemCode', ASC), ('client.requestInTs', ASC)], - [('client.serviceMemberCode', ASC), ('client.serviceSubsystemCode', ASC), ('client.requestInTs', ASC)], - [('producer.clientMemberCode', ASC), ('producer.clientSubsystemCode', ASC), ('producer.requestInTs', ASC)], - [('producer.serviceMemberCode', ASC), ('producer.serviceSubsystemCode', ASC), ('producer.requestInTs', ASC)] - ] - }, - - { - 'db': 'collector_state', - 'collection': 'server_list', - 'indexes': [[('timestamp', ASC)]] - }, - - { - 'db': 'reports_state', - 'collection': 'notification_queue', - 'indexes': [ - [('status', ASC), ('user_id', ASC)] - ] - }, - - { - 'db': 'analyzer_database', - 'collection': 'incident', - 'indexes': [ - [('incident_status', ASC), ('incident_creation_timestamp', ASC)] - ] - }, + IndexRequest('query_db', + 'raw_messages', + [ + IndexModel([('requestInTs', ASC)]), + IndexModel([('corrected', ASC), ('requestInTs', ASC)]) + ]), + + IndexRequest('query_db', + 'clean_data', + [ + IndexModel([('xRequestId', ASC)]), + IndexModel([('correctorTime', ASC)]), + IndexModel([('correctorStatus', ASC), ('client.requestInTs', ASC)]), + IndexModel([('correctorStatus', ASC), ('producer.requestInTs', ASC)]), + IndexModel([('correctorStatus', ASC), ('xRequestId', ASC)]), + IndexModel([('client.xRequestId', ASC)]), + IndexModel([('client.requestInTs', ASC)]), + IndexModel([('client.serviceCode', ASC)]), + IndexModel([('producer.requestInTs', ASC)]), + IndexModel([('producer.serviceCode', ASC)]), + IndexModel([('producer.xRequestId', ASC)]), + IndexModel([('client.clientMemberCode', ASC), ('client.clientSubsystemCode', ASC), + ('client.requestInTs', ASC)]), + IndexModel([('client.serviceMemberCode', ASC), ('client.serviceSubsystemCode', ASC), + ('client.requestInTs', ASC)]), + IndexModel([('producer.clientMemberCode', ASC), ('producer.clientSubsystemCode', ASC), + ('producer.requestInTs', ASC)]), + IndexModel([('producer.serviceMemberCode', ASC), ('producer.serviceSubsystemCode', ASC), + ('producer.requestInTs', ASC)]) + ]), + + IndexRequest('collector_state', + 'server_list', + [ + IndexModel([('timestamp', ASC)]) + ]), + + IndexRequest('reports_state', + 'notification_queue', + [ + IndexModel([('status', ASC), ('user_id', ASC)]) + ]), + + IndexRequest('analyzer_database', + 'incident', + [ + IndexModel([('incident_status', ASC), ('incident_creation_timestamp', ASC)]) + ]), ] def create_indexes(xroad_instance: str, client: MongoClient): count = 0 for request in indexRequests: - db = f"{request['db']}_{xroad_instance}" - collection = request['collection'] + db = f"{request.get_db()}_{xroad_instance}" + collection = request.get_collection() - for index in request['indexes']: + for index in request.get_indexes(): try: - client[db][collection].create_index(index) + indexes = [index] + cdb = client[db] + cdb[collection].create_indexes(indexes) count += 1 except Exception as e: logger.exception('Failed to create index', str(e)) diff --git a/collector_module/ruff.toml b/collector_module/ruff.toml new file mode 100644 index 0000000..5ae4773 --- /dev/null +++ b/collector_module/ruff.toml @@ -0,0 +1,76 @@ +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +line-length = 160 +indent-width = 4 + +# Assume Python 3.8 +target-version = "py38" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = false + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" diff --git a/collector_module/test_requirements.txt b/collector_module/test_requirements.txt index 1c59893..2a80c91 100644 --- a/collector_module/test_requirements.txt +++ b/collector_module/test_requirements.txt @@ -1,7 +1,9 @@ coverage pytest pytest-mock -pytest-pycodestyle +pytest-ruff pytest-html +ruff responses mongomock +pymongo-stubs \ No newline at end of file diff --git a/collector_module/tox.ini b/collector_module/tox.ini index 617b002..c6c7c95 100644 --- a/collector_module/tox.ini +++ b/collector_module/tox.ini @@ -1,17 +1,29 @@ [tox] -envlist = py38 +env_list = lint, type, py38 [testenv] -deps = -rtest_requirements.txt +description = Run the tests with pytest and coverage +deps = -r test_requirements.txt install_command=pip install --only-binary=numpy {opts} numpy {packages} commands = coverage run --source opmon_collector,opmon_mongodb_maintenance -m pytest opmon_collector/ opmon_mongodb_maintenance/ - coverage report --include=opmon_collector/*,opmon_mongodb_maintenance/* + coverage report --include=opmon_collector/*,opmon_mongodb_maintenance/* --fail-under=60 coverage html -d ../htmlcov/collector_module --include=opmon_collector/*,opmon_mongodb_maintenance/* -[pycodestyle] -max-line-length = 160 -ignore = W293,W503,E402 +[testenv:lint] +description = Run linter +skip_install = true +deps = {[testenv]deps} +commands = ruff check + +[testenv:type] +description = Run mypy for type checks +deps = + mypy + {[testenv]deps} +commands = + mypy --install-types --non-interactive {toxinidir}/opmon_collector/ + mypy --install-types --non-interactive {toxinidir}/opmon_mongodb_maintenance/ [pytest] -addopts = --pycodestyle -v --junitxml test_results.xml \ No newline at end of file +addopts = --ruff -v --junitxml test_results.xml \ No newline at end of file diff --git a/corrector_module/opmon_corrector/corrector_batch.py b/corrector_module/opmon_corrector/corrector_batch.py index ad46d23..4e21c7b 100644 --- a/corrector_module/opmon_corrector/corrector_batch.py +++ b/corrector_module/opmon_corrector/corrector_batch.py @@ -24,9 +24,7 @@ import time from collections import defaultdict -from opmon_corrector import (SECURITY_SERVER_TYPE_CLIENT, - SECURITY_SERVER_TYPE_PRODUCER, database_manager, - document_manager) +from opmon_corrector import database_manager, document_manager from opmon_corrector.corrector_worker import CorrectorWorker from opmon_corrector.logger_manager import LoggerManager diff --git a/corrector_module/opmon_corrector/document_manager.py b/corrector_module/opmon_corrector/document_manager.py index 0e61ed2..16f242b 100644 --- a/corrector_module/opmon_corrector/document_manager.py +++ b/corrector_module/opmon_corrector/document_manager.py @@ -26,6 +26,7 @@ from opmon_corrector import (SECURITY_SERVER_TYPE_CLIENT, SECURITY_SERVER_TYPE_PRODUCER, __version__) from opmon_corrector.logger_manager import LoggerManager +from typing import Dict, Union class DocumentManager: @@ -313,7 +314,8 @@ def escape_html(value: str) -> str: :param value: The string to be escaped. :return: Returns escaped string. """ - return value.translate(str.maketrans({'<': '<', '>': '>', '&': '&'})) + translation_table: Dict[str, Union[str, int, None]] = {'<': '<', '>': '>', '&': '&'} + return value.translate(str.maketrans(translation_table)) @staticmethod def sanitize_document(document: dict) -> dict: diff --git a/corrector_module/opmon_corrector/tests/test_settings_parser.py b/corrector_module/opmon_corrector/tests/test_settings_parser.py index 620d69e..f289fb2 100644 --- a/corrector_module/opmon_corrector/tests/test_settings_parser.py +++ b/corrector_module/opmon_corrector/tests/test_settings_parser.py @@ -72,12 +72,12 @@ def test_loading_settings_file_with_profile(set_dir): def test_loading_non_existing_settings_file(set_dir): with pytest.raises(FileNotFoundError): - settings = OpmonSettingsManager('NOTFOUND').settings + settings = OpmonSettingsManager('NOTFOUND').settings # noqa F841 def test_loading_invalid_settings_file(set_dir): with pytest.raises(YAMLError): - settings = OpmonSettingsManager('INVALID').settings + settings = OpmonSettingsManager('INVALID').settings # noqa F841 def test_get_setting(set_dir): diff --git a/corrector_module/ruff.toml b/corrector_module/ruff.toml new file mode 100644 index 0000000..5ae4773 --- /dev/null +++ b/corrector_module/ruff.toml @@ -0,0 +1,76 @@ +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +line-length = 160 +indent-width = 4 + +# Assume Python 3.8 +target-version = "py38" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = false + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" diff --git a/corrector_module/test_requirements.txt b/corrector_module/test_requirements.txt index 7602d65..d4a7edd 100644 --- a/corrector_module/test_requirements.txt +++ b/corrector_module/test_requirements.txt @@ -2,6 +2,8 @@ coverage pytest pytest-mock pytest-pycodestyle +pytest-ruff pytest-html +ruff mongomock freezegun==1.5.1 diff --git a/corrector_module/tox.ini b/corrector_module/tox.ini index aa4c29b..2cbb5bf 100644 --- a/corrector_module/tox.ini +++ b/corrector_module/tox.ini @@ -1,17 +1,28 @@ [tox] -envlist = py38 +env_list = lint, type, py38 [testenv] -deps = -rtest_requirements.txt +description = Run the tests with pytest and coverage +deps = -r test_requirements.txt install_command=pip install {opts} {packages} commands = coverage run --source opmon_corrector/ -m pytest opmon_corrector/ - coverage report --include=opmon_corrector/* + coverage report --include=opmon_corrector/* --fail-under=60 coverage html -d ../htmlcov/corrector_module --include=opmon_corrector/* -[pycodestyle] -max-line-length = 160 -ignore = W293,W503,E402 +[testenv:lint] +description = Run linter +skip_install = true +deps = {[testenv]deps} +commands = ruff check + +[testenv:type] +description = Run mypy for type checks +deps = + mypy + {[testenv]deps} +commands = + mypy --install-types --non-interactive {toxinidir}/opmon_corrector/ [pytest] -addopts = --pycodestyle -v --junitxml test_results.xml \ No newline at end of file +addopts = --ruff -v --junitxml test_results.xml \ No newline at end of file diff --git a/integration_tests/ci_analyzer/test_analyzer_aggregation_queries.py b/integration_tests/ci_analyzer/test_analyzer_aggregation_queries.py index 08ec6d6..5b4fff8 100644 --- a/integration_tests/ci_analyzer/test_analyzer_aggregation_queries.py +++ b/integration_tests/ci_analyzer/test_analyzer_aggregation_queries.py @@ -7,7 +7,6 @@ from analysis_module.opmon_analyzer.AnalyzerDatabaseManager import AnalyzerDatabaseManager from datetime import datetime -import time class TestAnalyzerAggregationQueriesCI(unittest.TestCase): diff --git a/integration_tests/ci_analyzer/test_analyzer_timeperiods.py b/integration_tests/ci_analyzer/test_analyzer_timeperiods.py index 9775293..6b1f996 100644 --- a/integration_tests/ci_analyzer/test_analyzer_timeperiods.py +++ b/integration_tests/ci_analyzer/test_analyzer_timeperiods.py @@ -8,7 +8,6 @@ import datetime from dateutil.relativedelta import relativedelta -import time import pandas as pd diff --git a/integration_tests/ci_anonymizer/ci_anonymizer_settings.py b/integration_tests/ci_anonymizer/ci_anonymizer_settings.py index 45de495..c55e8bc 100644 --- a/integration_tests/ci_anonymizer/ci_anonymizer_settings.py +++ b/integration_tests/ci_anonymizer/ci_anonymizer_settings.py @@ -58,6 +58,6 @@ field_data_file = 'field_data.yaml' heartbeat_path = os.path.join('/srv/app/{0}/heartbeat'.format(x_road_instance), - 'opendata-anonymizer.json'.format(x_road_instance)) + 'opendata-anonymizer.json') log_path = os.path.join('/srv/app/{0}/logs/'.format(x_road_instance), - 'opendata-anonymizer.log'.format(x_road_instance)) + 'opendata-anonymizer.log') diff --git a/integration_tests/ci_collector/test_collector.py b/integration_tests/ci_collector/test_collector.py index 13b0f9c..f4ccbdf 100644 --- a/integration_tests/ci_collector/test_collector.py +++ b/integration_tests/ci_collector/test_collector.py @@ -16,7 +16,7 @@ def test_update_server_list(): _, timestamp_0 = data['server_list'], data['timestamp'] assert timestamp_0 < time.time() - command = f"xroad-metrics-collector update".split(' ') + command = "xroad-metrics-collector update".split(' ') proc = subprocess.run(command, capture_output=True) assert proc.stderr == b'' assert proc.returncode == 0 @@ -39,7 +39,7 @@ def test_collect(): start_time = time.time() - command = f"xroad-metrics-collector collect".split(' ') + command = "xroad-metrics-collector collect".split(' ') proc = subprocess.run(command, capture_output=True) assert proc.stderr == b'' assert proc.returncode == 0 @@ -74,7 +74,7 @@ def test_execution_is_blocked_by_pid_file(): with open(pid_file, 'w') as f: f.write(str(os.getpid())) # write test-executor's pid to collector pidfile - command = f"xroad-metrics-collector update".split(' ') + command = "xroad-metrics-collector update".split(' ') proc = subprocess.run(command, capture_output=True) message_to_find = "Another xroad-metrics-collector instance is already running." @@ -82,7 +82,7 @@ def test_execution_is_blocked_by_pid_file(): assert proc.stderr.decode('utf-8').find(message_to_find) > 0 assert proc.returncode == 1 - command = f"xroad-metrics-collector collect".split(' ') + command = "xroad-metrics-collector collect".split(' ') proc = subprocess.run(command, capture_output=True) assert proc.stderr.decode('utf-8').find(message_to_find) > 0 @@ -92,8 +92,8 @@ def test_execution_is_blocked_by_pid_file(): def test_pid_file_creation_and_deletion(): - assert_action_creates_and_deletes_pid_file(f"xroad-metrics-collector collect".split(' ')) - assert_action_creates_and_deletes_pid_file(f"xroad-metrics-collector update".split(' ')) + assert_action_creates_and_deletes_pid_file("xroad-metrics-collector collect".split(' ')) + assert_action_creates_and_deletes_pid_file("xroad-metrics-collector update".split(' ')) def assert_action_creates_and_deletes_pid_file(command): diff --git a/integration_tests/helpers/ci_analyzer_db_handler.py b/integration_tests/helpers/ci_analyzer_db_handler.py index 8e2ae29..eb499db 100644 --- a/integration_tests/helpers/ci_analyzer_db_handler.py +++ b/integration_tests/helpers/ci_analyzer_db_handler.py @@ -1,5 +1,4 @@ -import time import pymongo diff --git a/opendata_collector_module/metrics_opendata_collector/tests/test_main.py b/opendata_collector_module/metrics_opendata_collector/tests/test_main.py index 52895af..f4d5805 100644 --- a/opendata_collector_module/metrics_opendata_collector/tests/test_main.py +++ b/opendata_collector_module/metrics_opendata_collector/tests/test_main.py @@ -30,7 +30,6 @@ import pytest import metrics_opendata_collector.main as main -from metrics_opendata_collector.settings import MetricsSettingsManager SOURCES_SETTINGS = { 'TEST-SOURCE1': { diff --git a/opendata_collector_module/requirements.txt b/opendata_collector_module/requirements.txt new file mode 100644 index 0000000..945c9b4 --- /dev/null +++ b/opendata_collector_module/requirements.txt @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/opendata_collector_module/ruff.toml b/opendata_collector_module/ruff.toml new file mode 100644 index 0000000..5ae4773 --- /dev/null +++ b/opendata_collector_module/ruff.toml @@ -0,0 +1,76 @@ +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +line-length = 160 +indent-width = 4 + +# Assume Python 3.8 +target-version = "py38" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = false + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" diff --git a/opendata_collector_module/test_requirements.txt b/opendata_collector_module/test_requirements.txt index d074ba8..cb70b1c 100644 --- a/opendata_collector_module/test_requirements.txt +++ b/opendata_collector_module/test_requirements.txt @@ -1,6 +1,7 @@ coverage pytest pytest-mock -pytest-pycodestyle +pytest-ruff pytest-html +ruff vcrpy==1.5.2 diff --git a/opendata_collector_module/tox.ini b/opendata_collector_module/tox.ini index 7159c14..7831221 100644 --- a/opendata_collector_module/tox.ini +++ b/opendata_collector_module/tox.ini @@ -1,25 +1,29 @@ [tox] -envlist = py38-{pytest,mypy} +env_list = lint, type, py38 [testenv] -deps = -rtest_requirements.txt -[testenv:py38-pytest] +description = Run the tests with pytest and coverage +deps = -r test_requirements.txt install_command=pip install --only-binary=numpy {opts} numpy {packages} commands = coverage run --source metrics_opendata_collector -m pytest metrics_opendata_collector/ coverage report --include=metrics_opendata_collector/* coverage html -d ../htmlcov/opendata_collector_module --include=metrics_opendata_collector/* -[testenv:py38-mypy] -description = Run mypy + +[testenv:lint] +description = Run linter +skip_install = true +deps = + {[testenv]deps} +commands = ruff check + +[testenv:type] +description = Run mypy for type checks deps = mypy {[testenv]deps} commands = mypy --install-types --non-interactive {toxinidir}/metrics_opendata_collector/ -[pycodestyle] -max-line-length = 120 -ignore = W293,W503,E402 - [pytest] -addopts = --pycodestyle -v --junitxml test_results.xml +addopts = --ruff -v --junitxml test_results.xml \ No newline at end of file diff --git a/opendata_module/opmon_opendata/api/admin.py b/opendata_module/opmon_opendata/api/admin.py index 09bb6ab..f3e2086 100644 --- a/opendata_module/opmon_opendata/api/admin.py +++ b/opendata_module/opmon_opendata/api/admin.py @@ -20,6 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from django.contrib import admin +from django.contrib import admin # noqa: F401 # Register your models here. diff --git a/opendata_module/opmon_opendata/api/models.py b/opendata_module/opmon_opendata/api/models.py index 86e0d5f..939c813 100644 --- a/opendata_module/opmon_opendata/api/models.py +++ b/opendata_module/opmon_opendata/api/models.py @@ -20,6 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from django.db import models +from django.db import models # noqa: F401 # Create your models here. diff --git a/opendata_module/opmon_opendata/api/urls.py b/opendata_module/opmon_opendata/api/urls.py index 938e380..78c70d4 100644 --- a/opendata_module/opmon_opendata/api/urls.py +++ b/opendata_module/opmon_opendata/api/urls.py @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from django.urls import include, path +from django.urls import include, path # noqa: F401 from opmon_opendata import django_settings as settings from opmon_opendata.api import views diff --git a/opendata_module/opmon_opendata/gui/admin.py b/opendata_module/opmon_opendata/gui/admin.py index 09bb6ab..f3e2086 100644 --- a/opendata_module/opmon_opendata/gui/admin.py +++ b/opendata_module/opmon_opendata/gui/admin.py @@ -20,6 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from django.contrib import admin +from django.contrib import admin # noqa: F401 # Register your models here. diff --git a/opendata_module/opmon_opendata/gui/models.py b/opendata_module/opmon_opendata/gui/models.py index 86e0d5f..939c813 100644 --- a/opendata_module/opmon_opendata/gui/models.py +++ b/opendata_module/opmon_opendata/gui/models.py @@ -20,6 +20,6 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from django.db import models +from django.db import models # noqa: F401 # Create your models here. diff --git a/opendata_module/opmon_opendata/gui/urls.py b/opendata_module/opmon_opendata/gui/urls.py index 6a5fbc7..907b7f7 100644 --- a/opendata_module/opmon_opendata/gui/urls.py +++ b/opendata_module/opmon_opendata/gui/urls.py @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from django.urls import include, path +from django.urls import include, path # noqa: F401 from . import views urlpatterns = [ diff --git a/opendata_module/opmon_opendata/tests/manual/create_example_table.py b/opendata_module/opmon_opendata/tests/manual/create_example_table.py index cdac4a0..a15cf04 100644 --- a/opendata_module/opmon_opendata/tests/manual/create_example_table.py +++ b/opendata_module/opmon_opendata/tests/manual/create_example_table.py @@ -7,7 +7,7 @@ sys.path.append(os.path.join(ROOT_DIR, '../../interface/')) -from settings import POSTGRES_CONFIG +from settings import POSTGRES_CONFIG # noqa E402 def get_connection_string( diff --git a/opendata_module/opmon_opendata/tests/test_api.py b/opendata_module/opmon_opendata/tests/test_api.py index 120783f..2f67459 100644 --- a/opendata_module/opmon_opendata/tests/test_api.py +++ b/opendata_module/opmon_opendata/tests/test_api.py @@ -5,11 +5,11 @@ import pytz from freezegun import freeze_time -from .test_utils import (COLUMNS, TEST_SETTINGS, db, http_client, log_factory, - make_m_statistics, mock_logger_manager, mock_settings) +from .test_utils import (COLUMNS, TEST_SETTINGS, log_factory, make_m_statistics, + db, http_client, mock_settings, mock_logger_manager) # noqa F401 -def test_get_harvest_empty_response(db, http_client): +def test_get_harvest_empty_response(db, http_client): # noqa F811 data = { 'from_dt': '2022-11-07T08:00:00+0000', } @@ -25,7 +25,7 @@ def test_get_harvest_empty_response(db, http_client): } -def test_get_harvest_from_tz_negative_offset(db, http_client): +def test_get_harvest_from_tz_negative_offset(db, http_client): # noqa F811 data = { 'from_dt': '2022-11-07T08:00:00-0500', } @@ -33,7 +33,7 @@ def test_get_harvest_from_tz_negative_offset(db, http_client): assert response.status_code == 200 -def test_get_harvest_from(db, http_client, caplog): +def test_get_harvest_from(db, http_client, caplog): # noqa F811 now = datetime.datetime.now() log_factory(db, request_in_dt='2022-11-07T07:50:00') @@ -56,7 +56,7 @@ def test_get_harvest_from(db, http_client, caplog): assert response_data['row_range'] == '1-2' -def test_get_harvest_from_row_id(db, http_client): +def test_get_harvest_from_row_id(db, http_client): # noqa F811 log_factory(db, request_in_dt='2022-11-07T07:50:00', id=1) log_factory(db, request_in_dt='2022-11-07T08:00:00', id=2) @@ -81,7 +81,7 @@ def test_get_harvest_from_row_id(db, http_client): ('2022-11-07T09:00:00+0200'), ('2022-11-07T09:00:00 0200') ]) -def test_get_harvest_timestamp_tz(db, http_client, from_dt): +def test_get_harvest_timestamp_tz(db, http_client, from_dt): # noqa F811 tzinfo = pytz.timezone('Europe/Helsinki') log_factory(db, request_in_dt=datetime.datetime(2022, 11, 7, 7, tzinfo=tzinfo)) log_factory(db, request_in_dt=datetime.datetime(2022, 11, 7, 8, tzinfo=tzinfo)) @@ -107,7 +107,7 @@ def test_get_harvest_timestamp_tz(db, http_client, from_dt): ('2011-11-07T08:00:00+0000', COLUMNS, True), ('2023-01-07T08:00:00+0000', [], False) ]) -def test_get_harvest_columns(db, http_client, from_dt, expected_columns, has_data): +def test_get_harvest_columns(db, http_client, from_dt, expected_columns, has_data): # noqa F811 # Do not return columns for empty data log_factory(db, request_in_dt='2022-11-07T08:00:00') data = { @@ -120,7 +120,7 @@ def test_get_harvest_columns(db, http_client, from_dt, expected_columns, has_dat assert response_data['columns'] == expected_columns -def test_get_harvest_from_until(db, http_client): +def test_get_harvest_from_until(db, http_client): # noqa F811 log_factory(db, request_in_dt='2022-11-07T07:50:00') # happy logs @@ -143,7 +143,7 @@ def test_get_harvest_from_until(db, http_client): assert len(data) == 3 -def test_get_harvest_from_with_limit(db, http_client): +def test_get_harvest_from_with_limit(db, http_client): # noqa F811 log_factory(db, request_in_dt='2022-11-10T08:00:00') log_factory(db, request_in_dt='2022-11-08T08:20:00') log_factory(db, request_in_dt='2022-11-05T08:47:00') @@ -170,7 +170,7 @@ def test_get_harvest_from_with_limit(db, http_client): assert response_data['row_range'] == '1-4' -def test_get_harvest_rows_less_than_limit(db, http_client): +def test_get_harvest_rows_less_than_limit(db, http_client): # noqa F811 log_factory(db, request_in_dt='2022-11-07T10:34:00') log_factory(db, request_in_dt='2022-11-08T08:00:00') @@ -192,7 +192,7 @@ def test_get_harvest_rows_less_than_limit(db, http_client): assert response_data['row_range'] == '1-2' -def test_get_harvest_total_query_count(db, http_client): +def test_get_harvest_total_query_count(db, http_client): # noqa F811 log_factory(db, request_in_dt='2022-11-10T08:00:00') log_factory(db, request_in_dt='2022-11-08T08:20:00') log_factory(db, request_in_dt='2022-11-05T08:47:00') @@ -210,7 +210,7 @@ def test_get_harvest_total_query_count(db, http_client): assert response_data['row_range'] == '1-1' -def test_get_harvest_from_with_limit_offset(db, http_client): +def test_get_harvest_from_with_limit_offset(db, http_client): # noqa F811 log_factory(db, request_in_dt='2022-11-10T08:00:00') log_factory(db, request_in_dt='2022-11-08T08:20:00') log_factory(db, request_in_dt='2022-11-05T08:47:00') @@ -236,7 +236,7 @@ def test_get_harvest_from_with_limit_offset(db, http_client): assert response_data['row_range'] == '3-6' -def test_get_harvest_default_ordering(db, http_client): +def test_get_harvest_default_ordering(db, http_client): # noqa F811 log_factory(db, request_in_dt='2022-11-15T10:34:00') log_factory(db, request_in_dt='2022-11-12T08:00:00') log_factory(db, request_in_dt='2022-11-07T09:30:00') @@ -278,7 +278,7 @@ def test_get_harvest_default_ordering(db, http_client): ('2022-11-15', '5'), ]) ]) -def test_get_harvest_ordering_requestinsize(db, http_client, ordering, expected_rows): +def test_get_harvest_ordering_requestinsize(db, http_client, ordering, expected_rows): # noqa F811 log_factory(db, request_in_dt='2022-11-14T08:47:00', requestsize=100) log_factory(db, request_in_dt='2022-11-15T10:34:00', requestsize=5) log_factory(db, request_in_dt='2022-11-07T09:30:00', requestsize=60) @@ -302,7 +302,7 @@ def test_get_harvest_ordering_requestinsize(db, http_client, ordering, expected_ assert response_data['row_range'] == '1-5' -def test_get_harvest_error_missing_from_dt(http_client, caplog): +def test_get_harvest_error_missing_from_dt(http_client, caplog): # noqa F811 query = {} response = http_client.get('/api/harvest', query) assert response.status_code == 400 @@ -315,7 +315,7 @@ def test_get_harvest_error_missing_from_dt(http_client, caplog): @freeze_time('2022-12-10') -def test_get_harvest_error_from_dt_later_now(http_client): +def test_get_harvest_error_from_dt_later_now(http_client): # noqa F811 query = { 'from_dt': '2022-12-11T07:00:00+0000', } @@ -327,7 +327,7 @@ def test_get_harvest_error_from_dt_later_now(http_client): } -def test_get_harvest_error_from_dt_format(http_client): +def test_get_harvest_error_from_dt_format(http_client): # noqa F811 query = { 'from_dt': '2022-12-11T07:00:00' } @@ -339,7 +339,7 @@ def test_get_harvest_error_from_dt_format(http_client): } -def test_get_harvest_error_from_dt_later_until_dt(http_client): +def test_get_harvest_error_from_dt_later_until_dt(http_client): # noqa F811 query = { 'from_dt': '2022-12-13T07:00:00+0000', 'until_dt': '2022-12-11T07:00:00+0000', @@ -353,7 +353,7 @@ def test_get_harvest_error_from_dt_later_until_dt(http_client): } -def test_get_harvest_error_invalid_json(http_client): +def test_get_harvest_error_invalid_json(http_client): # noqa F811 query = { 'from_dt': '2022-12-13T07:00:00+0000', 'order': 'not valid' @@ -366,7 +366,7 @@ def test_get_harvest_error_invalid_json(http_client): } -def test_get_harvest_error_order_keys(http_client): +def test_get_harvest_error_order_keys(http_client): # noqa F811 query = { 'from_dt': '2022-12-13T07:00:00+0000', 'order': json.dumps({ @@ -382,7 +382,7 @@ def test_get_harvest_error_order_keys(http_client): } -def test_get_harvest_error_order_order_values(http_client): +def test_get_harvest_error_order_order_values(http_client): # noqa F811 query = { 'from_dt': '2022-12-13T07:00:00+0000', 'order': json.dumps({ @@ -398,7 +398,7 @@ def test_get_harvest_error_order_order_values(http_client): } -def test_get_harvest_db_connection_error(http_client, caplog): +def test_get_harvest_db_connection_error(http_client, caplog): # noqa F811 # test failed connection to db handled successfully query = { 'from_dt': '2022-12-13T07:00:00+0000', @@ -410,7 +410,7 @@ def test_get_harvest_db_connection_error(http_client, caplog): assert 'api_get_harvest_query_failed' in caplog.text -def test_get_harvest_error_unsupported_method(http_client): +def test_get_harvest_error_unsupported_method(http_client): # noqa F811 query = { 'from_dt': '2022-12-13T07:00:00+0000', } @@ -421,7 +421,7 @@ def test_get_harvest_error_unsupported_method(http_client): @freeze_time('2022-12-10') -def test_get_statistics_data_success(db, http_client, caplog): +def test_get_statistics_data_success(db, http_client, caplog): # noqa F811 test_member_count = [ {'class_name': 'COM', 'description': 'Test companies', 'count': 2}, {'class_name': 'GOV', 'description': 'Test govermental entities', 'count': 1}, @@ -455,14 +455,14 @@ def test_get_statistics_data_success(db, http_client, caplog): assert 'Statistics data fetched successfully' in caplog.text -def test_get_statistics_data_error_not_found(db, http_client, caplog): +def test_get_statistics_data_error_not_found(db, http_client, caplog): # noqa F811 response = http_client.get('/api/statistics') assert response.status_code == 404 assert response.json() == {'error': 'Statistics data was not found!'} assert 'Metrics statistics data was not found in database' in caplog.text -def test_get_statistics_data_error_server_failed(http_client, mocker, caplog): +def test_get_statistics_data_error_server_failed(http_client, mocker, caplog): # noqa F811 mocker.patch( 'opmon_opendata.api.postgresql_manager.PostgreSQL_StatisticsManager.get_latest_metrics_statistics', side_effect=KeyError('test') @@ -473,7 +473,7 @@ def test_get_statistics_data_error_server_failed(http_client, mocker, caplog): assert 'KeyError' in caplog.text -def test_get_settings(http_client, caplog): +def test_get_settings(http_client, caplog): # noqa F811 response = http_client.get('/api/settings') assert response.status_code == 200 assert response.json() == { @@ -486,7 +486,7 @@ def test_get_settings(http_client, caplog): assert 'returning 5 settings' in caplog.text -def test_get_constraints(db, http_client, caplog): +def test_get_constraints(db, http_client, caplog): # noqa F811 log_factory(db, request_in_dt='2021-11-07T07:50:00') log_factory(db, request_in_dt='2021-11-08T07:50:00') log_factory(db, request_in_dt='2021-11-10T07:50:00') diff --git a/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py b/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py index 0e6093f..485acec 100644 --- a/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py +++ b/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py @@ -155,8 +155,8 @@ def test_grant_priviledges(mocker): create_users._grant_privileges(args, postgres) assert cursor.execute.call_count == len(create_users.full_users) + len(create_users.read_only_users) - for call in cursor.execute.call_args_list: - assert call.args[0].startswith('GRANT') + for call_args_list in cursor.execute.call_args_list: + assert call_args_list.args[0].startswith('GRANT') def test_password_escaping(): diff --git a/opendata_module/ruff.toml b/opendata_module/ruff.toml new file mode 100644 index 0000000..5ae4773 --- /dev/null +++ b/opendata_module/ruff.toml @@ -0,0 +1,76 @@ +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +line-length = 160 +indent-width = 4 + +# Assume Python 3.8 +target-version = "py38" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = false + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" diff --git a/opendata_module/test_requirements.txt b/opendata_module/test_requirements.txt index b633b5e..658a19e 100644 --- a/opendata_module/test_requirements.txt +++ b/opendata_module/test_requirements.txt @@ -1,8 +1,9 @@ coverage pytest pytest-mock -pytest-pycodestyle +pytest-ruff pytest-html +ruff mongomock psycopg2-binary pytest-django @@ -10,5 +11,4 @@ python-dateutil freezegun django-stubs pytz -pyyaml -freezegun +pyyaml \ No newline at end of file diff --git a/opendata_module/tox.ini b/opendata_module/tox.ini index 1bd6377..25590cb 100644 --- a/opendata_module/tox.ini +++ b/opendata_module/tox.ini @@ -1,26 +1,33 @@ [tox] -envlist = py38-{pytest,mypy,legacy_django} +env_list = lint, type, py38 [testenv] deps = -r test_requirements.txt -[testenv:py38-pytest] + +[testenv:py38] +description = Run the tests with pytest and coverage install_command=pip install --only-binary=numpy {opts} numpy {packages} commands = coverage run --source opmon_opendata,opmon_postgresql_maintenance -m pytest opmon_opendata/ opmon_postgresql_maintenance/ coverage report --include=opmon_opendata/*,opmon_postgresql_maintenance/* --fail-under=60 coverage html -d ../htmlcov/opendata_module --include=opmon_opendata/*,opmon_postgresql_maintenance/* -[testenv:py38-mypy] -description = Run mypy + +[testenv:lint] +description = Run linter +skip_install = true +deps = + {[testenv]deps} +commands = ruff check + +[testenv:type] +description = Run mypy for type checks deps = mypy {[testenv]deps} commands = mypy --install-types --non-interactive {toxinidir}/opmon_opendata/api mypy --install-types --non-interactive {toxinidir}/opmon_postgresql_maintenance -[pycodestyle] -max-line-length = 160 -ignore = W293,W503,E402 [pytest] -addopts = --pycodestyle -v --junitxml test_results.xml +addopts = --ruff -v --junitxml test_results.xml DJANGO_SETTINGS_MODULE=opmon_opendata.tests.test_settings diff --git a/opendata_module/usr/manage.py b/opendata_module/usr/manage.py index ab48d5d..d117318 100644 --- a/opendata_module/usr/manage.py +++ b/opendata_module/usr/manage.py @@ -34,7 +34,7 @@ # issue is really that Django is missing to avoid masking other # exceptions on Python 2. try: - import django + import django # noqa F401 except ImportError: raise ImportError( "Couldn't import Django. Are you sure it's installed and " diff --git a/reports_module/opmon_reports/report_manager.py b/reports_module/opmon_reports/report_manager.py index eccff11..0bf2752 100644 --- a/reports_module/opmon_reports/report_manager.py +++ b/reports_module/opmon_reports/report_manager.py @@ -30,7 +30,7 @@ import numpy as np import pandas as pd from jinja2 import Environment, FileSystemLoader -import weasyprint +import weasyprint # type: ignore from . import time_date_tools from . import tools @@ -40,7 +40,7 @@ from . import constants from .reports_arguments import OpmonReportsArguments from .translator import Translator -from .xroad_descriptor import OpmonXroadDescriptor, OpmonXroadSubsystemDescriptor +from .xroad_descriptor import OpmonXroadSubsystemDescriptor matplotlib.use('Agg') import matplotlib.pyplot as plt diff --git a/reports_module/opmon_reports/reports_arguments.py b/reports_module/opmon_reports/reports_arguments.py index f5af621..a5de647 100644 --- a/reports_module/opmon_reports/reports_arguments.py +++ b/reports_module/opmon_reports/reports_arguments.py @@ -42,7 +42,7 @@ def __init__(self): self.language = args.language if self.start_date > self.end_date: - raise ValueError(f"Start date cannot be after end date.") + raise ValueError("Start date cannot be after end date.") @property def start_time_milliseconds(self): diff --git a/reports_module/opmon_reports/time_date_tools.py b/reports_module/opmon_reports/time_date_tools.py index d4c5f7c..1b3dfd8 100644 --- a/reports_module/opmon_reports/time_date_tools.py +++ b/reports_module/opmon_reports/time_date_tools.py @@ -84,7 +84,7 @@ def calculate_closing_date(date, buffer_time): :param buffer_time: The buffer time in days (integer). :return: Returns a date object (datetime.date). """ - if type(buffer_time) is not int: + if not isinstance(buffer_time, int): raise ValueError("The input must be of type int, not {0}".format(type(buffer_time))) if type(date) is not datetime.date: diff --git a/reports_module/opmon_reports/xroad_descriptor.py b/reports_module/opmon_reports/xroad_descriptor.py index 5ea4c6d..b173105 100644 --- a/reports_module/opmon_reports/xroad_descriptor.py +++ b/reports_module/opmon_reports/xroad_descriptor.py @@ -22,6 +22,7 @@ import json from json import JSONDecodeError +from typing import List import jsonschema from jsonschema import ValidationError @@ -44,7 +45,7 @@ def __init__(self, reports_arguments: OpmonReportsArguments, database: DatabaseM self.subsystem_from_arguments = reports_arguments.subsystem self.database = database self.logger = logger - self._data = [] + self._data: List[dict] = [] self._parse_descriptor_file() self._process_subsystem_from_arguments() diff --git a/reports_module/ruff.toml b/reports_module/ruff.toml new file mode 100644 index 0000000..5ae4773 --- /dev/null +++ b/reports_module/ruff.toml @@ -0,0 +1,76 @@ +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +line-length = 160 +indent-width = 4 + +# Assume Python 3.8 +target-version = "py38" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = false + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" diff --git a/reports_module/test_requirements.txt b/reports_module/test_requirements.txt index aecfcdf..2ae199a 100644 --- a/reports_module/test_requirements.txt +++ b/reports_module/test_requirements.txt @@ -2,5 +2,9 @@ coverage mongomock pytest pytest-mock -pytest-pycodestyle +pytest-ruff pytest-html +ruff +pymongo-stubs +matplotlib-stubs +types-Jinja2 diff --git a/reports_module/tox.ini b/reports_module/tox.ini index 8bcf4ff..3c647d2 100644 --- a/reports_module/tox.ini +++ b/reports_module/tox.ini @@ -1,17 +1,29 @@ [tox] -envlist = py38 +env_list = lint, type, py38 [testenv] -deps = -rtest_requirements.txt +description = Run the tests with pytest and coverage +deps = -r test_requirements.txt install_command=pip install --only-binary=numpy {opts} numpy {packages} commands = coverage run --source opmon_reports -m pytest opmon_reports/ - coverage report --include=opmon_reports/* + coverage report --include=opmon_reports/* --fail-under=60 coverage html -d ../htmlcov/reports_module --include=opmon_reports/* -[pycodestyle] -max-line-length = 160 -ignore = W293,W503,E402 +[testenv:lint] +description = Run linter +skip_install = true +deps = + {[testenv]deps} +commands = ruff check + +[testenv:type] +description = Run mypy for type checks +deps = + mypy + {[testenv]deps} +commands = + mypy --install-types --non-interactive {toxinidir}/opmon_reports/ [pytest] -addopts = --pycodestyle -v --junitxml test_results.xml \ No newline at end of file +addopts = --ruff -v --junitxml test_results.xml \ No newline at end of file diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..5ae4773 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,76 @@ +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".ipynb_checkpoints", + ".mypy_cache", + ".nox", + ".pants.d", + ".pyenv", + ".pytest_cache", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + ".vscode", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "site-packages", + "venv", +] + +line-length = 160 +indent-width = 4 + +# Assume Python 3.8 +target-version = "py38" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +# Enable auto-formatting of code examples in docstrings. Markdown, +# reStructuredText code/literal blocks and doctests are all supported. +# +# This is currently disabled by default, but it is planned for this +# to be opt-out in the future. +docstring-code-format = false + +# Set the line length limit used when formatting code snippets in +# docstrings. +# +# This only has an effect when the `docstring-code-format` setting is +# enabled. +docstring-code-line-length = "dynamic" diff --git a/run_tests.sh b/run_tests.sh index 2a0baa3..a17f455 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,18 +1,31 @@ #!/bin/bash -# sudo python3 -m pip install pytest -# pip install pytest-pep8 +# pip install pytest +# pip install ruff + +export REPORTS_RUN_ENV="REPORTS_TEST" + +#set -e + +# Run Pep8 Tests +#ruff check analysis_module +#ruff check analysis_ui_module +ruff check anonymizer_module +ruff check collector_module +ruff check corrector_module +ruff check opendata_collector_module +ruff check opendata_module +ruff check reports_module ## Run Tests -echo "Run tests" -#pytest --cache-clear analysis_module --html=analysis_module/test_results.html --self-contained-html -#pytest --cache-clear analysis_ui_module --html=analysis_ui_module/test_results.html --self-contained-html -pytest --cache-clear anonymizer_module --html=anonymizer_module/test_results.html --self-contained-html -pytest --cache-clear collector_module --html=collector_module/test_results.html --self-contained-html -pytest --cache-clear corrector_module --html=corrector_module/test_results.html --self-contained-html -#pytest --cache-clear opendata_collector_module --html=opendata_collector_module/test_results.html --self-contained-html -pytest --cache-clear opendata_module --html=opendata_module/test_results.html --self-contained-html -pytest --cache-clear reports_module --html=reports_module/test_results.html --self-contained-html +#pytest --cache-clear --ruff analysis_module --html=analysis_module/test_results.html --self-contained-html +#pytest --cache-clear --ruff analysis_ui_module --html=analysis_ui_module/test_results.html --self-contained-html +pytest --cache-clear --ruff anonymizer_module --html=anonymizer_module/test_results.html --self-contained-html +pytest --cache-clear --ruff collector_module --html=collector_module/test_results.html --self-contained-html +pytest --cache-clear --ruff corrector_module --html=corrector_module/test_results.html --self-contained-html +#pytest --cache-clear --ruff opendata_collector_module --html=opendata_collector_module/test_results.html --self-contained-html +pytest --cache-clear --ruff opendata_module --html=opendata_module/test_results.html --self-contained-html +pytest --cache-clear --ruff reports_module --html=reports_module/test_results.html --self-contained-html # Run CI Tests if [[ $1 == 'CI' ]] ; then From 25deb27c8cfe0655476b936f92bb67cafb9f1654 Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Mon, 4 Nov 2024 04:06:20 +0200 Subject: [PATCH 15/36] chore: Update "make clean" command to clean test_results.xml and related htmlcov folder Refs: OPMONDEV-187 --- analysis_module/Makefile | 3 ++- analysis_ui_module/Makefile | 3 ++- anonymizer_module/Makefile | 3 ++- collector_module/Makefile | 2 ++ corrector_module/Makefile | 3 ++- opendata_collector_module/Makefile | 3 ++- opendata_module/Makefile | 3 ++- reports_module/Makefile | 3 ++- 8 files changed, 16 insertions(+), 7 deletions(-) diff --git a/analysis_module/Makefile b/analysis_module/Makefile index 6be15f5..a8b296f 100644 --- a/analysis_module/Makefile +++ b/analysis_module/Makefile @@ -1,10 +1,11 @@ clean: @echo "Cleaning project..." @find . -type d -name "__pycache__" -exec rm -rf {} + + @rm -f ./test_results.xml @rm -rf .coverage @rm -rf .tox/ @rm -rf build/ @rm -rf dist/ @rm -rf *.egg-info/ - @rm -rf opmon_collector/tests/responses/Test/ + @rm -rf ../htmlcov/analysis_module/ @echo "Project cleaned." \ No newline at end of file diff --git a/analysis_ui_module/Makefile b/analysis_ui_module/Makefile index 6be15f5..aeb4e6c 100644 --- a/analysis_ui_module/Makefile +++ b/analysis_ui_module/Makefile @@ -1,10 +1,11 @@ clean: @echo "Cleaning project..." @find . -type d -name "__pycache__" -exec rm -rf {} + + @rm -f ./test_results.xml @rm -rf .coverage @rm -rf .tox/ @rm -rf build/ @rm -rf dist/ @rm -rf *.egg-info/ - @rm -rf opmon_collector/tests/responses/Test/ + @rm -rf ../htmlcov/analysis_ui_module/ @echo "Project cleaned." \ No newline at end of file diff --git a/anonymizer_module/Makefile b/anonymizer_module/Makefile index 6be15f5..c76bf3b 100644 --- a/anonymizer_module/Makefile +++ b/anonymizer_module/Makefile @@ -1,10 +1,11 @@ clean: @echo "Cleaning project..." @find . -type d -name "__pycache__" -exec rm -rf {} + + @rm -f ./test_results.xml @rm -rf .coverage @rm -rf .tox/ @rm -rf build/ @rm -rf dist/ @rm -rf *.egg-info/ - @rm -rf opmon_collector/tests/responses/Test/ + @rm -rf ../htmlcov/anonymizer_module/ @echo "Project cleaned." \ No newline at end of file diff --git a/collector_module/Makefile b/collector_module/Makefile index 6be15f5..1261331 100644 --- a/collector_module/Makefile +++ b/collector_module/Makefile @@ -1,10 +1,12 @@ clean: @echo "Cleaning project..." @find . -type d -name "__pycache__" -exec rm -rf {} + + @rm -f ./test_results.xml @rm -rf .coverage @rm -rf .tox/ @rm -rf build/ @rm -rf dist/ @rm -rf *.egg-info/ @rm -rf opmon_collector/tests/responses/Test/ + @rm -rf ../htmlcov/collector_module/ @echo "Project cleaned." \ No newline at end of file diff --git a/corrector_module/Makefile b/corrector_module/Makefile index 6be15f5..91d0f03 100644 --- a/corrector_module/Makefile +++ b/corrector_module/Makefile @@ -1,10 +1,11 @@ clean: @echo "Cleaning project..." @find . -type d -name "__pycache__" -exec rm -rf {} + + @rm -f ./test_results.xml @rm -rf .coverage @rm -rf .tox/ @rm -rf build/ @rm -rf dist/ @rm -rf *.egg-info/ - @rm -rf opmon_collector/tests/responses/Test/ + @rm -rf ../htmlcov/corrector_module/ @echo "Project cleaned." \ No newline at end of file diff --git a/opendata_collector_module/Makefile b/opendata_collector_module/Makefile index 6be15f5..90c9f05 100644 --- a/opendata_collector_module/Makefile +++ b/opendata_collector_module/Makefile @@ -1,10 +1,11 @@ clean: @echo "Cleaning project..." @find . -type d -name "__pycache__" -exec rm -rf {} + + @rm -f ./test_results.xml @rm -rf .coverage @rm -rf .tox/ @rm -rf build/ @rm -rf dist/ @rm -rf *.egg-info/ - @rm -rf opmon_collector/tests/responses/Test/ + @rm -rf ../htmlcov/opendata_collector_module/ @echo "Project cleaned." \ No newline at end of file diff --git a/opendata_module/Makefile b/opendata_module/Makefile index 6be15f5..4c7f9f4 100644 --- a/opendata_module/Makefile +++ b/opendata_module/Makefile @@ -1,10 +1,11 @@ clean: @echo "Cleaning project..." @find . -type d -name "__pycache__" -exec rm -rf {} + + @rm -f ./test_results.xml @rm -rf .coverage @rm -rf .tox/ @rm -rf build/ @rm -rf dist/ @rm -rf *.egg-info/ - @rm -rf opmon_collector/tests/responses/Test/ + @rm -rf ../htmlcov/opendata_module/ @echo "Project cleaned." \ No newline at end of file diff --git a/reports_module/Makefile b/reports_module/Makefile index 6be15f5..ac3b1cb 100644 --- a/reports_module/Makefile +++ b/reports_module/Makefile @@ -1,10 +1,11 @@ clean: @echo "Cleaning project..." @find . -type d -name "__pycache__" -exec rm -rf {} + + @rm -f ./test_results.xml @rm -rf .coverage @rm -rf .tox/ @rm -rf build/ @rm -rf dist/ @rm -rf *.egg-info/ - @rm -rf opmon_collector/tests/responses/Test/ + @rm -rf ../htmlcov/reports_module/ @echo "Project cleaned." \ No newline at end of file From d0b1d7470cc60dd4aa359cbf7d72a08ab9e68d38 Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Mon, 4 Nov 2024 04:10:33 +0200 Subject: [PATCH 16/36] fix: Freeze pydyf's version in dependencies to fix reports during runtime Refs: OPMONDEV-187 --- .github/dependabot.yml | 3 +++ reports_module/setup.py | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a55caac..2f5695f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -52,6 +52,9 @@ updates: - dependency-name: "pyparsing" versions: - ">= 3.2.0" + - dependency-name: "pydyf" + versions: + - ">= 0.11.0" - package-ecosystem: "github-actions" directory: "/.github/workflows" diff --git a/reports_module/setup.py b/reports_module/setup.py index 446a28a..dd4b062 100644 --- a/reports_module/setup.py +++ b/reports_module/setup.py @@ -42,6 +42,7 @@ 'numpy==1.24.4', 'contourpy==1.1.1', 'pyparsing==3.1.4', + 'pydyf==0.10.0', ] classifiers = [ From 5781228ace08c3e7d8afbaef55ebe4b6de4bd689 Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Tue, 12 Nov 2024 11:40:42 +0200 Subject: [PATCH 17/36] chore: Add license header to all source code Refs: OPMONDEV-187 --- analysis_module/Makefile | 15 +++++- .../opmon_analyzer/AnalyzerDatabaseManager.py | 40 ++++++++-------- analysis_module/opmon_analyzer/__init__.py | 40 ++++++++-------- .../opmon_analyzer/analyzer_conf.py | 40 ++++++++-------- analysis_module/opmon_analyzer/constants.py | 23 ++++++++++ .../opmon_analyzer/find_anomalies.py | 40 ++++++++-------- .../opmon_analyzer/logger_manager.py | 40 ++++++++-------- analysis_module/opmon_analyzer/main.py | 40 ++++++++-------- .../models/AveragesByTimeperiodModel.py | 40 ++++++++-------- .../models/DuplicateMessageIdModel.py | 40 ++++++++-------- .../models/FailedRequestRatioModel.py | 40 ++++++++-------- .../opmon_analyzer/models/TimeSyncModel.py | 40 ++++++++-------- .../opmon_analyzer/models/__init__.py | 40 ++++++++-------- .../models/tests/test_analyzer_models.py | 40 ++++++++-------- .../opmon_analyzer/settings_parser.py | 40 ++++++++-------- ...rain_or_update_historic_averages_models.py | 40 ++++++++-------- ...rain_or_update_historic_averages_models.py | 40 ++++++++-------- analysis_ui_module/Makefile | 16 ++++++- .../opmon_analyzer_ui/__init__.py | 40 ++++++++-------- analysis_ui_module/opmon_analyzer_ui/admin.py | 40 ++++++++-------- analysis_ui_module/opmon_analyzer_ui/apps.py | 40 ++++++++-------- .../opmon_analyzer_ui/constants.py | 23 ++++++++++ .../opmon_analyzer_ui/db_manager.py | 40 ++++++++-------- .../opmon_analyzer_ui/django_settings.py | 23 ++++++++++ .../opmon_analyzer_ui/logger_manager.py | 40 ++++++++-------- .../opmon_analyzer_ui/migrations/__init__.py | 40 ++++++++-------- .../opmon_analyzer_ui/models.py | 40 ++++++++-------- .../opmon_analyzer_ui/settings_parser.py | 40 ++++++++-------- .../tests/test_settings_parser.py | 23 ++++++++++ analysis_ui_module/opmon_analyzer_ui/urls.py | 40 ++++++++-------- analysis_ui_module/opmon_analyzer_ui/views.py | 40 ++++++++-------- analysis_ui_module/usr/manage.py | 40 ++++++++-------- analysis_ui_module/usr/wsgi.py | 45 +++++++++--------- .../metrics_statistics/__init__.py | 23 ++++++++++ .../central_server_client.py | 40 ++++++++-------- anonymizer_module/metrics_statistics/main.py | 40 ++++++++-------- .../metrics_statistics/mongodb_manager.py | 23 ++++++++++ .../metrics_statistics/postgresql_manager.py | 41 +++++++++-------- .../metrics_statistics/settings_parser.py | 40 ++++++++-------- .../metrics_statistics/statistics_manager.py | 24 ++++++++++ .../tests/test_mongodb_manager.py | 24 ++++++++++ .../tests/test_statistics_manager.py | 24 ++++++++++ .../opmon_anonymizer/__init__.py | 40 ++++++++-------- .../opmon_anonymizer/anonymizer.py | 40 ++++++++-------- .../external_files/create_indices.py | 40 ++++++++-------- .../opmon_anonymizer/iio/__init__.py | 40 ++++++++-------- .../opmon_anonymizer/iio/mongodbmanager.py | 40 ++++++++-------- .../opmon_anonymizer/iio/opendata_writer.py | 40 ++++++++-------- .../iio/postgresql_manager.py | 40 ++++++++-------- anonymizer_module/opmon_anonymizer/main.py | 41 +++++++++-------- .../opmon_anonymizer/opendata_anonymizer.py | 40 ++++++++-------- .../opmon_anonymizer/settings_parser.py | 40 ++++++++-------- .../tests/manual/drop_example_table.py | 24 ++++++++++ .../tests/test_anonymization_job.py | 40 ++++++++-------- .../tests/test_anonymization_process.py | 40 ++++++++-------- .../opmon_anonymizer/tests/test_anonymizer.py | 40 ++++++++-------- .../opmon_anonymizer/tests/test_main.py | 24 ++++++++++ .../tests/test_opendata_anonymizer.py | 24 ++++++++++ .../tests/test_settings_parser.py | 23 ++++++++++ .../opmon_anonymizer/transformers/__init__.py | 40 ++++++++-------- .../opmon_anonymizer/transformers/default.py | 40 ++++++++-------- .../opmon_anonymizer/utils/__init__.py | 40 ++++++++-------- .../opmon_anonymizer/utils/logger_manager.py | 40 ++++++++-------- archive_module/Makefile | 11 +++++ archive_module/clean_data_archive.py | 23 ++++++++++ archive_module/clean_data_archive2.py | 23 ++++++++++ archive_module/cron_clean_data_archive.sh | 23 ++++++++++ archive_module/cron_raw_messages_archive.sh | 23 ++++++++++ archive_module/get_settings.py | 23 ++++++++++ archive_module/raw_messages_archive.py | 23 ++++++++++ archive_module/settings_sample.py | 24 ++++++++++ collector_module/Makefile | 17 ++++++- collector_module/opmon_collector/__init__.py | 40 ++++++++-------- .../opmon_collector/central_server_client.py | 40 ++++++++-------- .../collector_multiprocessing.py | 40 ++++++++-------- .../opmon_collector/collector_worker.py | 40 ++++++++-------- .../opmon_collector/database_manager.py | 46 ++++++++++--------- .../opmon_collector/logger_manager.py | 40 ++++++++-------- collector_module/opmon_collector/main.py | 40 ++++++++-------- .../opmon_collector/pid_file_handler.py | 40 ++++++++-------- .../opmon_collector/security_server_client.py | 40 ++++++++-------- collector_module/opmon_collector/settings.py | 40 ++++++++-------- .../tests/test_central_server_client.py | 40 ++++++++-------- .../tests/test_collector_multiprocessing.py | 40 ++++++++-------- .../tests/test_collector_worker.py | 40 ++++++++-------- .../tests/test_database_manager.py | 23 ++++++++++ .../tests/test_logger_manager.py | 40 ++++++++-------- .../opmon_collector/tests/test_main.py | 23 ++++++++++ .../tests/test_pid_file_handler.py | 40 ++++++++-------- .../tests/test_security_server_client.py | 40 ++++++++-------- .../opmon_collector/tests/test_settings.py | 23 ++++++++++ .../tests/test_update_servers.py | 40 ++++++++-------- .../opmon_collector/update_servers.py | 45 +++++++++--------- .../opmon_mongodb_maintenance/__init__.py | 40 ++++++++-------- .../create_indexes.py | 40 ++++++++-------- .../opmon_mongodb_maintenance/create_users.py | 45 +++++++++--------- .../hash_speed_test.py | 45 +++++++++--------- .../opmon_mongodb_maintenance/main.py | 40 ++++++++-------- .../raw_data_archive.py | 45 +++++++++--------- .../read_speed_test.py | 45 +++++++++--------- .../tests/test_create_indexes.py | 40 ++++++++-------- .../tests/test_create_users.py | 44 +++++++++--------- .../tests/test_mongo_maintenance_main.py | 40 ++++++++-------- corrector_module/Makefile | 15 +++++- corrector_module/opmon_corrector/__init__.py | 40 ++++++++-------- .../opmon_corrector/corrector_batch.py | 40 ++++++++-------- .../opmon_corrector/corrector_worker.py | 40 ++++++++-------- .../opmon_corrector/correctord.py | 40 ++++++++-------- .../opmon_corrector/database_manager.py | 46 ++++++++++--------- .../opmon_corrector/document_manager.py | 46 ++++++++++--------- .../opmon_corrector/logger_manager.py | 40 ++++++++-------- .../opmon_corrector/settings_parser.py | 40 ++++++++-------- .../tests/test_corrector_batch.py | 23 ++++++++++ .../tests/test_document_manager.py | 40 ++++++++-------- .../tests/test_settings_parser.py | 44 +++++++++--------- integration_tests/Makefile | 11 +++++ integration_tests/__init__.py | 23 ++++++++++ integration_tests/ci_analyzer/__init__.py | 23 ++++++++++ .../ci_analyzer/ci_analyzer_settings.py | 23 ++++++++++ .../test_analyzer_aggregation_queries.py | 23 ++++++++++ .../ci_analyzer/test_analyzer_timeperiods.py | 23 ++++++++++ integration_tests/ci_anonymizer/__init__.py | 23 ++++++++++ .../ci_anonymizer/ci_anonymizer_settings.py | 23 ++++++++++ integration_tests/ci_anonymizer/ci_helper.py | 23 ++++++++++ .../ci_anonymizer/test_anonymizer.py | 23 ++++++++++ .../ci_collector/test_collector.py | 23 ++++++++++ integration_tests/ci_corrector/__init__.py | 23 ++++++++++ .../ci_corrector/ci_corrector_settings.py | 23 ++++++++++ .../ci_corrector/test_corrector.py | 23 ++++++++++ integration_tests/ci_reports/__init__.py | 23 ++++++++++ .../ci_reports/ci_reports_settings.py | 23 ++++++++++ .../ci_reports/test_factsheet_manager_CI.py | 23 ++++++++++ .../ci_reports/test_report_worker_CI.py | 23 ++++++++++ integration_tests/helpers/__init__.py | 23 ++++++++++ .../helpers/ci_analyzer_db_handler.py | 23 ++++++++++ integration_tests/helpers/ci_db_connector.py | 23 ++++++++++ integration_tests/helpers/ci_helper.py | 23 ++++++++++ .../helpers/ci_postgres_handler.py | 23 ++++++++++ integration_tests/helpers/cl_db_handler.py | 23 ++++++++++ integration_tests/helpers/field_names.py | 24 ++++++++++ opendata_collector_module/Makefile | 15 +++++- .../metrics_opendata_collector/__init__.py | 40 ++++++++-------- .../metrics_opendata_collector/constants.py | 40 ++++++++-------- .../logger_manager.py | 40 ++++++++-------- .../metrics_opendata_collector/main.py | 40 ++++++++-------- .../mongodb_manager.py | 40 ++++++++-------- .../multiprocessing_utils.py | 23 ++++++++++ .../opendata_api_client.py | 40 ++++++++-------- .../opendata_collector.py | 40 ++++++++-------- .../metrics_opendata_collector/settings.py | 40 ++++++++-------- .../tests/test_main.py | 23 ++++++++++ .../tests/test_opendata_collector.py | 23 ++++++++++ opendata_module/Makefile | 17 ++++++- opendata_module/opmon_opendata/__init__.py | 40 ++++++++-------- .../opmon_opendata/api/__init__.py | 40 ++++++++-------- opendata_module/opmon_opendata/api/admin.py | 40 ++++++++-------- opendata_module/opmon_opendata/api/apps.py | 40 ++++++++-------- opendata_module/opmon_opendata/api/forms.py | 23 ++++++++++ opendata_module/opmon_opendata/api/helpers.py | 40 ++++++++-------- .../opmon_opendata/api/input_validator.py | 40 ++++++++-------- .../opmon_opendata/api/migrations/__init__.py | 23 ++++++++++ opendata_module/opmon_opendata/api/models.py | 40 ++++++++-------- .../opmon_opendata/api/postgresql_manager.py | 40 ++++++++-------- opendata_module/opmon_opendata/api/urls.py | 40 ++++++++-------- opendata_module/opmon_opendata/api/views.py | 40 ++++++++-------- .../opmon_opendata/django_settings.py | 23 ++++++++++ .../opmon_opendata/gui/__init__.py | 40 ++++++++-------- opendata_module/opmon_opendata/gui/admin.py | 40 ++++++++-------- opendata_module/opmon_opendata/gui/apps.py | 40 ++++++++-------- .../opmon_opendata/gui/migrations/__init__.py | 40 ++++++++-------- opendata_module/opmon_opendata/gui/models.py | 40 ++++++++-------- opendata_module/opmon_opendata/gui/urls.py | 40 ++++++++-------- opendata_module/opmon_opendata/gui/views.py | 40 ++++++++-------- .../opmon_opendata/logger_manager.py | 40 ++++++++-------- .../opendata_settings_parser.py | 40 ++++++++-------- .../opmon_opendata/settings_parser.py | 40 ++++++++-------- .../opmon_opendata/tests/__init__.py | 40 ++++++++-------- .../tests/manual/create_example_table.py | 23 ++++++++++ .../tests/manual/drop_example_table.py | 23 ++++++++++ .../opmon_opendata/tests/test_api.py | 23 ++++++++++ .../tests/test_input_validator.py | 40 ++++++++-------- .../tests/test_logger_manager.py | 23 ++++++++++ .../opmon_opendata/tests/test_settings.py | 23 ++++++++++ .../opmon_opendata/tests/test_utils.py | 23 ++++++++++ opendata_module/opmon_opendata/urls.py | 23 ++++++++++ .../opmon_postgresql_maintenance/__init__.py | 40 ++++++++-------- .../create_users.py | 45 +++++++++--------- .../tests/test_create_users.py | 40 ++++++++-------- reports_module/Makefile | 15 +++++- reports_module/opmon_reports/__init__.py | 40 ++++++++-------- reports_module/opmon_reports/constants.py | 40 ++++++++-------- .../opmon_reports/database_manager.py | 40 ++++++++-------- .../opmon_reports/logger_manager.py | 40 ++++++++-------- reports_module/opmon_reports/main.py | 40 ++++++++-------- .../opmon_reports/mongodb_handler.py | 40 ++++++++-------- .../opmon_reports/notification_manager.py | 40 ++++++++-------- .../opmon_reports/notifications_main.py | 40 ++++++++-------- .../opmon_reports/report_manager.py | 40 ++++++++-------- reports_module/opmon_reports/report_row.py | 40 ++++++++-------- .../opmon_reports/reports_arguments.py | 40 ++++++++-------- reports_module/opmon_reports/reports_main.py | 40 ++++++++-------- .../opmon_reports/settings_parser.py | 40 ++++++++-------- .../tests/test_notification_manager.py | 23 ++++++++++ .../tests/test_report_manager.py | 23 ++++++++++ .../opmon_reports/tests/test_report_row.py | 23 ++++++++++ .../tests/test_time_date_tools.py | 23 ++++++++++ .../opmon_reports/tests/test_tools.py | 23 ++++++++++ .../tests/test_xroad_descriptor.py | 23 ++++++++++ .../opmon_reports/time_date_tools.py | 40 ++++++++-------- reports_module/opmon_reports/tools.py | 40 ++++++++-------- reports_module/opmon_reports/translator.py | 40 ++++++++-------- .../opmon_reports/unique_subsystems.py | 40 ++++++++-------- .../opmon_reports/xroad_descriptor.py | 40 ++++++++-------- .../opmon_reports/xroad_descriptor_schema.py | 40 ++++++++-------- 214 files changed, 4601 insertions(+), 2663 deletions(-) create mode 100644 archive_module/Makefile create mode 100644 integration_tests/Makefile diff --git a/analysis_module/Makefile b/analysis_module/Makefile index a8b296f..eb70f8f 100644 --- a/analysis_module/Makefile +++ b/analysis_module/Makefile @@ -8,4 +8,17 @@ clean: @rm -rf dist/ @rm -rf *.egg-info/ @rm -rf ../htmlcov/analysis_module/ - @echo "Project cleaned." \ No newline at end of file + @echo "Project cleaned." + +license: + @echo "Checking if licenseheaders library is installed..." + @if pip show licenseheaders > /dev/null 2>&1; then \ + echo "licenseheaders is installed."; \ + else \ + echo "licenseheaders is not installed. Installing it..."; \ + pip install licenseheaders --no-input; \ + fi + @echo "Adding license to opmon_analyzer module..." + @licenseheaders -t ../LICENSE.MD -E py -d ./opmon_analyzer + @echo "Note: bin directory is not updated by the tool. Make sure to update it manually." + @echo "License added." diff --git a/analysis_module/opmon_analyzer/AnalyzerDatabaseManager.py b/analysis_module/opmon_analyzer/AnalyzerDatabaseManager.py index 05348d2..f15b86c 100644 --- a/analysis_module/opmon_analyzer/AnalyzerDatabaseManager.py +++ b/analysis_module/opmon_analyzer/AnalyzerDatabaseManager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import urllib.parse diff --git a/analysis_module/opmon_analyzer/__init__.py b/analysis_module/opmon_analyzer/__init__.py index 8d8cefa..f356979 100644 --- a/analysis_module/opmon_analyzer/__init__.py +++ b/analysis_module/opmon_analyzer/__init__.py @@ -1,23 +1,25 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. __version__ = '0.1.0' diff --git a/analysis_module/opmon_analyzer/analyzer_conf.py b/analysis_module/opmon_analyzer/analyzer_conf.py index 3a586f0..6ba1e01 100644 --- a/analysis_module/opmon_analyzer/analyzer_conf.py +++ b/analysis_module/opmon_analyzer/analyzer_conf.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. class DataModelConfiguration: """Create data model time windows and thresholds based on settings.yaml""" diff --git a/analysis_module/opmon_analyzer/constants.py b/analysis_module/opmon_analyzer/constants.py index b9a6fff..fdcc2df 100644 --- a/analysis_module/opmon_analyzer/constants.py +++ b/analysis_module/opmon_analyzer/constants.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# timestamp_field = 'requestInTs' # The MIT License diff --git a/analysis_module/opmon_analyzer/find_anomalies.py b/analysis_module/opmon_analyzer/find_anomalies.py index 79c0a71..a7c7641 100644 --- a/analysis_module/opmon_analyzer/find_anomalies.py +++ b/analysis_module/opmon_analyzer/find_anomalies.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import traceback diff --git a/analysis_module/opmon_analyzer/logger_manager.py b/analysis_module/opmon_analyzer/logger_manager.py index 4352f83..1b400ae 100644 --- a/analysis_module/opmon_analyzer/logger_manager.py +++ b/analysis_module/opmon_analyzer/logger_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import json import logging diff --git a/analysis_module/opmon_analyzer/main.py b/analysis_module/opmon_analyzer/main.py index ed1a378..73821b8 100644 --- a/analysis_module/opmon_analyzer/main.py +++ b/analysis_module/opmon_analyzer/main.py @@ -1,26 +1,28 @@ #!/usr/bin/env python3 -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import argparse diff --git a/analysis_module/opmon_analyzer/models/AveragesByTimeperiodModel.py b/analysis_module/opmon_analyzer/models/AveragesByTimeperiodModel.py index 7f4b83b..9b98bfa 100644 --- a/analysis_module/opmon_analyzer/models/AveragesByTimeperiodModel.py +++ b/analysis_module/opmon_analyzer/models/AveragesByTimeperiodModel.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import pandas as pd import numpy as np diff --git a/analysis_module/opmon_analyzer/models/DuplicateMessageIdModel.py b/analysis_module/opmon_analyzer/models/DuplicateMessageIdModel.py index 075e40d..02cf6b8 100644 --- a/analysis_module/opmon_analyzer/models/DuplicateMessageIdModel.py +++ b/analysis_module/opmon_analyzer/models/DuplicateMessageIdModel.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import pandas as pd from datetime import datetime diff --git a/analysis_module/opmon_analyzer/models/FailedRequestRatioModel.py b/analysis_module/opmon_analyzer/models/FailedRequestRatioModel.py index 79de0a4..a3aeb51 100644 --- a/analysis_module/opmon_analyzer/models/FailedRequestRatioModel.py +++ b/analysis_module/opmon_analyzer/models/FailedRequestRatioModel.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import pandas as pd from datetime import datetime diff --git a/analysis_module/opmon_analyzer/models/TimeSyncModel.py b/analysis_module/opmon_analyzer/models/TimeSyncModel.py index c0ca640..546b96b 100644 --- a/analysis_module/opmon_analyzer/models/TimeSyncModel.py +++ b/analysis_module/opmon_analyzer/models/TimeSyncModel.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import pandas as pd import numpy as np diff --git a/analysis_module/opmon_analyzer/models/__init__.py b/analysis_module/opmon_analyzer/models/__init__.py index 5933e5a..65504ce 100644 --- a/analysis_module/opmon_analyzer/models/__init__.py +++ b/analysis_module/opmon_analyzer/models/__init__.py @@ -1,21 +1,23 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. diff --git a/analysis_module/opmon_analyzer/models/tests/test_analyzer_models.py b/analysis_module/opmon_analyzer/models/tests/test_analyzer_models.py index 4aceb5a..8be1293 100644 --- a/analysis_module/opmon_analyzer/models/tests/test_analyzer_models.py +++ b/analysis_module/opmon_analyzer/models/tests/test_analyzer_models.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os import pytest diff --git a/analysis_module/opmon_analyzer/settings_parser.py b/analysis_module/opmon_analyzer/settings_parser.py index f794a89..0e0e310 100644 --- a/analysis_module/opmon_analyzer/settings_parser.py +++ b/analysis_module/opmon_analyzer/settings_parser.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from os import listdir from os.path import isfile, join diff --git a/analysis_module/opmon_analyzer/tests/test_train_or_update_historic_averages_models.py b/analysis_module/opmon_analyzer/tests/test_train_or_update_historic_averages_models.py index f050add..7247457 100644 --- a/analysis_module/opmon_analyzer/tests/test_train_or_update_historic_averages_models.py +++ b/analysis_module/opmon_analyzer/tests/test_train_or_update_historic_averages_models.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import datetime diff --git a/analysis_module/opmon_analyzer/train_or_update_historic_averages_models.py b/analysis_module/opmon_analyzer/train_or_update_historic_averages_models.py index 8233c5b..6dfebb2 100644 --- a/analysis_module/opmon_analyzer/train_or_update_historic_averages_models.py +++ b/analysis_module/opmon_analyzer/train_or_update_historic_averages_models.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. # TODO: add exception handling # diff --git a/analysis_ui_module/Makefile b/analysis_ui_module/Makefile index aeb4e6c..e661362 100644 --- a/analysis_ui_module/Makefile +++ b/analysis_ui_module/Makefile @@ -8,4 +8,18 @@ clean: @rm -rf dist/ @rm -rf *.egg-info/ @rm -rf ../htmlcov/analysis_ui_module/ - @echo "Project cleaned." \ No newline at end of file + @echo "Project cleaned." + +license: + @echo "Checking if licenseheaders library is installed..." + @if pip show licenseheaders > /dev/null 2>&1; then \ + echo "licenseheaders is installed."; \ + else \ + echo "licenseheaders is not installed. Installing it..."; \ + pip install licenseheaders --no-input; \ + fi + @echo "Adding license to opmon_analyzer_ui module..." + @licenseheaders -t ../LICENSE.MD -E py -d ./opmon_analyzer_ui + @echo "Adding license to usr module..." + @licenseheaders -t ../LICENSE.MD -E py -d ./usr + @echo "License added." diff --git a/analysis_ui_module/opmon_analyzer_ui/__init__.py b/analysis_ui_module/opmon_analyzer_ui/__init__.py index 8d8cefa..f356979 100644 --- a/analysis_ui_module/opmon_analyzer_ui/__init__.py +++ b/analysis_ui_module/opmon_analyzer_ui/__init__.py @@ -1,23 +1,25 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. __version__ = '0.1.0' diff --git a/analysis_ui_module/opmon_analyzer_ui/admin.py b/analysis_ui_module/opmon_analyzer_ui/admin.py index f3e2086..88cd21d 100644 --- a/analysis_ui_module/opmon_analyzer_ui/admin.py +++ b/analysis_ui_module/opmon_analyzer_ui/admin.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from django.contrib import admin # noqa: F401 diff --git a/analysis_ui_module/opmon_analyzer_ui/apps.py b/analysis_ui_module/opmon_analyzer_ui/apps.py index 0bc12d9..62da865 100644 --- a/analysis_ui_module/opmon_analyzer_ui/apps.py +++ b/analysis_ui_module/opmon_analyzer_ui/apps.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from django.apps import AppConfig diff --git a/analysis_ui_module/opmon_analyzer_ui/constants.py b/analysis_ui_module/opmon_analyzer_ui/constants.py index e08d15e..ba67c8a 100644 --- a/analysis_ui_module/opmon_analyzer_ui/constants.py +++ b/analysis_ui_module/opmon_analyzer_ui/constants.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# service_call_fields = ["clientXRoadInstance", "clientMemberClass", "clientMemberCode", diff --git a/analysis_ui_module/opmon_analyzer_ui/db_manager.py b/analysis_ui_module/opmon_analyzer_ui/db_manager.py index ca5853f..9ee3acc 100644 --- a/analysis_ui_module/opmon_analyzer_ui/db_manager.py +++ b/analysis_ui_module/opmon_analyzer_ui/db_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from pymongo import MongoClient import pymongo diff --git a/analysis_ui_module/opmon_analyzer_ui/django_settings.py b/analysis_ui_module/opmon_analyzer_ui/django_settings.py index a96590e..5b7c2da 100644 --- a/analysis_ui_module/opmon_analyzer_ui/django_settings.py +++ b/analysis_ui_module/opmon_analyzer_ui/django_settings.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Django settings for analyzer_ui project. diff --git a/analysis_ui_module/opmon_analyzer_ui/logger_manager.py b/analysis_ui_module/opmon_analyzer_ui/logger_manager.py index 4352f83..1b400ae 100644 --- a/analysis_ui_module/opmon_analyzer_ui/logger_manager.py +++ b/analysis_ui_module/opmon_analyzer_ui/logger_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import json import logging diff --git a/analysis_ui_module/opmon_analyzer_ui/migrations/__init__.py b/analysis_ui_module/opmon_analyzer_ui/migrations/__init__.py index 5933e5a..65504ce 100644 --- a/analysis_ui_module/opmon_analyzer_ui/migrations/__init__.py +++ b/analysis_ui_module/opmon_analyzer_ui/migrations/__init__.py @@ -1,21 +1,23 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. diff --git a/analysis_ui_module/opmon_analyzer_ui/models.py b/analysis_ui_module/opmon_analyzer_ui/models.py index 939c813..efc69d5 100644 --- a/analysis_ui_module/opmon_analyzer_ui/models.py +++ b/analysis_ui_module/opmon_analyzer_ui/models.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from django.db import models # noqa: F401 diff --git a/analysis_ui_module/opmon_analyzer_ui/settings_parser.py b/analysis_ui_module/opmon_analyzer_ui/settings_parser.py index e2e4683..f925b51 100644 --- a/analysis_ui_module/opmon_analyzer_ui/settings_parser.py +++ b/analysis_ui_module/opmon_analyzer_ui/settings_parser.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import errno from os import listdir diff --git a/analysis_ui_module/opmon_analyzer_ui/tests/test_settings_parser.py b/analysis_ui_module/opmon_analyzer_ui/tests/test_settings_parser.py index d366506..96ea78b 100644 --- a/analysis_ui_module/opmon_analyzer_ui/tests/test_settings_parser.py +++ b/analysis_ui_module/opmon_analyzer_ui/tests/test_settings_parser.py @@ -1,4 +1,27 @@ #!/usr/bin/env python3 +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Unit tests for collector settings.py diff --git a/analysis_ui_module/opmon_analyzer_ui/urls.py b/analysis_ui_module/opmon_analyzer_ui/urls.py index b9b1c88..72c7881 100644 --- a/analysis_ui_module/opmon_analyzer_ui/urls.py +++ b/analysis_ui_module/opmon_analyzer_ui/urls.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from django.urls import include, path from . import views diff --git a/analysis_ui_module/opmon_analyzer_ui/views.py b/analysis_ui_module/opmon_analyzer_ui/views.py index 2ff40a0..c05b9b5 100644 --- a/analysis_ui_module/opmon_analyzer_ui/views.py +++ b/analysis_ui_module/opmon_analyzer_ui/views.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import datetime import json diff --git a/analysis_ui_module/usr/manage.py b/analysis_ui_module/usr/manage.py index 7372049..217886b 100644 --- a/analysis_ui_module/usr/manage.py +++ b/analysis_ui_module/usr/manage.py @@ -1,26 +1,28 @@ #!/usr/bin/env python -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os import sys diff --git a/analysis_ui_module/usr/wsgi.py b/analysis_ui_module/usr/wsgi.py index e3d10c1..9b5d21a 100644 --- a/analysis_ui_module/usr/wsgi.py +++ b/analysis_ui_module/usr/wsgi.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ WSGI config for analyzer_ui project. @@ -7,28 +30,6 @@ https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ """ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - import os from django.core.wsgi import get_wsgi_application diff --git a/anonymizer_module/metrics_statistics/__init__.py b/anonymizer_module/metrics_statistics/__init__.py index e69de29..65504ce 100644 --- a/anonymizer_module/metrics_statistics/__init__.py +++ b/anonymizer_module/metrics_statistics/__init__.py @@ -0,0 +1,23 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# diff --git a/anonymizer_module/metrics_statistics/central_server_client.py b/anonymizer_module/metrics_statistics/central_server_client.py index 6177834..d2df285 100644 --- a/anonymizer_module/metrics_statistics/central_server_client.py +++ b/anonymizer_module/metrics_statistics/central_server_client.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import re import xml.etree.ElementTree as ET diff --git a/anonymizer_module/metrics_statistics/main.py b/anonymizer_module/metrics_statistics/main.py index 61d4f9a..7a5a855 100644 --- a/anonymizer_module/metrics_statistics/main.py +++ b/anonymizer_module/metrics_statistics/main.py @@ -1,26 +1,28 @@ #!/usr/bin/env python3 -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import argparse import logging diff --git a/anonymizer_module/metrics_statistics/mongodb_manager.py b/anonymizer_module/metrics_statistics/mongodb_manager.py index eec64a9..9e18d00 100644 --- a/anonymizer_module/metrics_statistics/mongodb_manager.py +++ b/anonymizer_module/metrics_statistics/mongodb_manager.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ MongoDB Manager - Opendata Module""" # The MIT License diff --git a/anonymizer_module/metrics_statistics/postgresql_manager.py b/anonymizer_module/metrics_statistics/postgresql_manager.py index 2d03f72..96b66ba 100644 --- a/anonymizer_module/metrics_statistics/postgresql_manager.py +++ b/anonymizer_module/metrics_statistics/postgresql_manager.py @@ -1,24 +1,27 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. + from datetime import datetime from logging import Logger from typing import Dict, List, Optional, Tuple, TypedDict diff --git a/anonymizer_module/metrics_statistics/settings_parser.py b/anonymizer_module/metrics_statistics/settings_parser.py index 9a320f9..1b2f1d3 100644 --- a/anonymizer_module/metrics_statistics/settings_parser.py +++ b/anonymizer_module/metrics_statistics/settings_parser.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import errno import re diff --git a/anonymizer_module/metrics_statistics/statistics_manager.py b/anonymizer_module/metrics_statistics/statistics_manager.py index f5132bd..a9afc25 100644 --- a/anonymizer_module/metrics_statistics/statistics_manager.py +++ b/anonymizer_module/metrics_statistics/statistics_manager.py @@ -1,3 +1,27 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + import json from logging import Logger from pprint import pformat diff --git a/anonymizer_module/metrics_statistics/tests/test_mongodb_manager.py b/anonymizer_module/metrics_statistics/tests/test_mongodb_manager.py index 497a3c1..01549e4 100644 --- a/anonymizer_module/metrics_statistics/tests/test_mongodb_manager.py +++ b/anonymizer_module/metrics_statistics/tests/test_mongodb_manager.py @@ -1,3 +1,27 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + import logging from datetime import datetime diff --git a/anonymizer_module/metrics_statistics/tests/test_statistics_manager.py b/anonymizer_module/metrics_statistics/tests/test_statistics_manager.py index b5c7cc1..004fed1 100644 --- a/anonymizer_module/metrics_statistics/tests/test_statistics_manager.py +++ b/anonymizer_module/metrics_statistics/tests/test_statistics_manager.py @@ -1,3 +1,27 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + import json import logging import sqlite3 diff --git a/anonymizer_module/opmon_anonymizer/__init__.py b/anonymizer_module/opmon_anonymizer/__init__.py index c64fb83..b2d8653 100644 --- a/anonymizer_module/opmon_anonymizer/__init__.py +++ b/anonymizer_module/opmon_anonymizer/__init__.py @@ -1,23 +1,25 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. __version__ = '1.3.0' diff --git a/anonymizer_module/opmon_anonymizer/anonymizer.py b/anonymizer_module/opmon_anonymizer/anonymizer.py index 77f8b98..b65218e 100644 --- a/anonymizer_module/opmon_anonymizer/anonymizer.py +++ b/anonymizer_module/opmon_anonymizer/anonymizer.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os import re diff --git a/anonymizer_module/opmon_anonymizer/external_files/create_indices.py b/anonymizer_module/opmon_anonymizer/external_files/create_indices.py index afe16f0..7c1a695 100644 --- a/anonymizer_module/opmon_anonymizer/external_files/create_indices.py +++ b/anonymizer_module/opmon_anonymizer/external_files/create_indices.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import logging import os diff --git a/anonymizer_module/opmon_anonymizer/iio/__init__.py b/anonymizer_module/opmon_anonymizer/iio/__init__.py index 5933e5a..65504ce 100644 --- a/anonymizer_module/opmon_anonymizer/iio/__init__.py +++ b/anonymizer_module/opmon_anonymizer/iio/__init__.py @@ -1,21 +1,23 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. diff --git a/anonymizer_module/opmon_anonymizer/iio/mongodbmanager.py b/anonymizer_module/opmon_anonymizer/iio/mongodbmanager.py index e7a5c26..55eb7bd 100644 --- a/anonymizer_module/opmon_anonymizer/iio/mongodbmanager.py +++ b/anonymizer_module/opmon_anonymizer/iio/mongodbmanager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import datetime import sys diff --git a/anonymizer_module/opmon_anonymizer/iio/opendata_writer.py b/anonymizer_module/opmon_anonymizer/iio/opendata_writer.py index c1b126e..2f3a833 100644 --- a/anonymizer_module/opmon_anonymizer/iio/opendata_writer.py +++ b/anonymizer_module/opmon_anonymizer/iio/opendata_writer.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os import yaml diff --git a/anonymizer_module/opmon_anonymizer/iio/postgresql_manager.py b/anonymizer_module/opmon_anonymizer/iio/postgresql_manager.py index 5f96fdf..6e46a7b 100644 --- a/anonymizer_module/opmon_anonymizer/iio/postgresql_manager.py +++ b/anonymizer_module/opmon_anonymizer/iio/postgresql_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from datetime import datetime diff --git a/anonymizer_module/opmon_anonymizer/main.py b/anonymizer_module/opmon_anonymizer/main.py index 1a54df4..5f437ef 100644 --- a/anonymizer_module/opmon_anonymizer/main.py +++ b/anonymizer_module/opmon_anonymizer/main.py @@ -1,24 +1,27 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. + import argparse from datetime import datetime from typing import Optional, Union diff --git a/anonymizer_module/opmon_anonymizer/opendata_anonymizer.py b/anonymizer_module/opmon_anonymizer/opendata_anonymizer.py index 11cdf66..008ef7b 100644 --- a/anonymizer_module/opmon_anonymizer/opendata_anonymizer.py +++ b/anonymizer_module/opmon_anonymizer/opendata_anonymizer.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os from typing import List, Optional diff --git a/anonymizer_module/opmon_anonymizer/settings_parser.py b/anonymizer_module/opmon_anonymizer/settings_parser.py index 2df1eb2..4a13189 100644 --- a/anonymizer_module/opmon_anonymizer/settings_parser.py +++ b/anonymizer_module/opmon_anonymizer/settings_parser.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from os import listdir from os.path import isfile, join diff --git a/anonymizer_module/opmon_anonymizer/tests/manual/drop_example_table.py b/anonymizer_module/opmon_anonymizer/tests/manual/drop_example_table.py index a8f74f5..9eff697 100644 --- a/anonymizer_module/opmon_anonymizer/tests/manual/drop_example_table.py +++ b/anonymizer_module/opmon_anonymizer/tests/manual/drop_example_table.py @@ -1,3 +1,27 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + import logging import os import sys diff --git a/anonymizer_module/opmon_anonymizer/tests/test_anonymization_job.py b/anonymizer_module/opmon_anonymizer/tests/test_anonymization_job.py index e2909f5..0b61708 100644 --- a/anonymizer_module/opmon_anonymizer/tests/test_anonymization_job.py +++ b/anonymizer_module/opmon_anonymizer/tests/test_anonymization_job.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os import re diff --git a/anonymizer_module/opmon_anonymizer/tests/test_anonymization_process.py b/anonymizer_module/opmon_anonymizer/tests/test_anonymization_process.py index bcda9fe..c0eff55 100644 --- a/anonymizer_module/opmon_anonymizer/tests/test_anonymization_process.py +++ b/anonymizer_module/opmon_anonymizer/tests/test_anonymization_process.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os import json diff --git a/anonymizer_module/opmon_anonymizer/tests/test_anonymizer.py b/anonymizer_module/opmon_anonymizer/tests/test_anonymizer.py index de7429f..08a51fd 100644 --- a/anonymizer_module/opmon_anonymizer/tests/test_anonymizer.py +++ b/anonymizer_module/opmon_anonymizer/tests/test_anonymizer.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os diff --git a/anonymizer_module/opmon_anonymizer/tests/test_main.py b/anonymizer_module/opmon_anonymizer/tests/test_main.py index c3efef8..14af54e 100644 --- a/anonymizer_module/opmon_anonymizer/tests/test_main.py +++ b/anonymizer_module/opmon_anonymizer/tests/test_main.py @@ -1,3 +1,27 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + import pytest import opmon_anonymizer.main as main diff --git a/anonymizer_module/opmon_anonymizer/tests/test_opendata_anonymizer.py b/anonymizer_module/opmon_anonymizer/tests/test_opendata_anonymizer.py index b281e34..082cd88 100644 --- a/anonymizer_module/opmon_anonymizer/tests/test_opendata_anonymizer.py +++ b/anonymizer_module/opmon_anonymizer/tests/test_opendata_anonymizer.py @@ -1,3 +1,27 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + import os from logging import StreamHandler from operator import eq, gt, is_not, le, lt diff --git a/anonymizer_module/opmon_anonymizer/tests/test_settings_parser.py b/anonymizer_module/opmon_anonymizer/tests/test_settings_parser.py index 1ac0390..5667a3c 100644 --- a/anonymizer_module/opmon_anonymizer/tests/test_settings_parser.py +++ b/anonymizer_module/opmon_anonymizer/tests/test_settings_parser.py @@ -1,4 +1,27 @@ #!/usr/bin/env python3 +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Unit tests for collector settings.py diff --git a/anonymizer_module/opmon_anonymizer/transformers/__init__.py b/anonymizer_module/opmon_anonymizer/transformers/__init__.py index 631f031..be960cd 100644 --- a/anonymizer_module/opmon_anonymizer/transformers/__init__.py +++ b/anonymizer_module/opmon_anonymizer/transformers/__init__.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from . import default diff --git a/anonymizer_module/opmon_anonymizer/transformers/default.py b/anonymizer_module/opmon_anonymizer/transformers/default.py index 0cb408d..01b2103 100644 --- a/anonymizer_module/opmon_anonymizer/transformers/default.py +++ b/anonymizer_module/opmon_anonymizer/transformers/default.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from datetime import datetime diff --git a/anonymizer_module/opmon_anonymizer/utils/__init__.py b/anonymizer_module/opmon_anonymizer/utils/__init__.py index 5933e5a..65504ce 100644 --- a/anonymizer_module/opmon_anonymizer/utils/__init__.py +++ b/anonymizer_module/opmon_anonymizer/utils/__init__.py @@ -1,21 +1,23 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. diff --git a/anonymizer_module/opmon_anonymizer/utils/logger_manager.py b/anonymizer_module/opmon_anonymizer/utils/logger_manager.py index e90a48c..050cf58 100644 --- a/anonymizer_module/opmon_anonymizer/utils/logger_manager.py +++ b/anonymizer_module/opmon_anonymizer/utils/logger_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import json import logging diff --git a/archive_module/Makefile b/archive_module/Makefile new file mode 100644 index 0000000..7540dc8 --- /dev/null +++ b/archive_module/Makefile @@ -0,0 +1,11 @@ +license: + @echo "Checking if licenseheaders library is installed..." + @if pip show licenseheaders > /dev/null 2>&1; then \ + echo "licenseheaders is installed."; \ + else \ + echo "licenseheaders is not installed. Installing it..."; \ + pip install licenseheaders --no-input; \ + fi + @echo "Adding license to integration_tests..." + @licenseheaders -t ../LICENSE.MD -E py sh + @echo "License added." diff --git a/archive_module/clean_data_archive.py b/archive_module/clean_data_archive.py index a58d8a6..fc21f5f 100644 --- a/archive_module/clean_data_archive.py +++ b/archive_module/clean_data_archive.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Archive Clean Data Usage example: diff --git a/archive_module/clean_data_archive2.py b/archive_module/clean_data_archive2.py index b84f1a3..2ef10b3 100644 --- a/archive_module/clean_data_archive2.py +++ b/archive_module/clean_data_archive2.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Archive Clean Data Usage example: diff --git a/archive_module/cron_clean_data_archive.sh b/archive_module/cron_clean_data_archive.sh index 7e90c7f..c5d7129 100644 --- a/archive_module/cron_clean_data_archive.sh +++ b/archive_module/cron_clean_data_archive.sh @@ -1,4 +1,27 @@ #!/bin/bash +## +## The MIT License +## Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +## Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +## +## Permission is hereby granted, free of charge, to any person obtaining a copy +## of this software and associated documentation files (the "Software"), to deal +## in the Software without restriction, including without limitation the rights +## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +## copies of the Software, and to permit persons to whom the Software is +## furnished to do so, subject to the following conditions: +## +## The above copyright notice and this permission notice shall be included in +## all copies or substantial portions of the Software. +## +## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +## THE SOFTWARE. +## if [ "$#" -ne 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then echo "Usage: ${0}" diff --git a/archive_module/cron_raw_messages_archive.sh b/archive_module/cron_raw_messages_archive.sh index 956b08e..6fa0de4 100644 --- a/archive_module/cron_raw_messages_archive.sh +++ b/archive_module/cron_raw_messages_archive.sh @@ -1,4 +1,27 @@ #!/bin/bash +## +## The MIT License +## Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +## Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +## +## Permission is hereby granted, free of charge, to any person obtaining a copy +## of this software and associated documentation files (the "Software"), to deal +## in the Software without restriction, including without limitation the rights +## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +## copies of the Software, and to permit persons to whom the Software is +## furnished to do so, subject to the following conditions: +## +## The above copyright notice and this permission notice shall be included in +## all copies or substantial portions of the Software. +## +## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +## THE SOFTWARE. +## if [ "$#" -ne 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then echo "Usage: ${0}" diff --git a/archive_module/get_settings.py b/archive_module/get_settings.py index 3502720..884adf0 100644 --- a/archive_module/get_settings.py +++ b/archive_module/get_settings.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import sys import settings diff --git a/archive_module/raw_messages_archive.py b/archive_module/raw_messages_archive.py index 0c808d3..07c4953 100644 --- a/archive_module/raw_messages_archive.py +++ b/archive_module/raw_messages_archive.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Archive Raw Messages Usage example: diff --git a/archive_module/settings_sample.py b/archive_module/settings_sample.py index 7715089..cc6c82a 100644 --- a/archive_module/settings_sample.py +++ b/archive_module/settings_sample.py @@ -1,3 +1,27 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + # -------------------------------------------------------- # General settings # -------------------------------------------------------- diff --git a/collector_module/Makefile b/collector_module/Makefile index 1261331..1f7c3e9 100644 --- a/collector_module/Makefile +++ b/collector_module/Makefile @@ -9,4 +9,19 @@ clean: @rm -rf *.egg-info/ @rm -rf opmon_collector/tests/responses/Test/ @rm -rf ../htmlcov/collector_module/ - @echo "Project cleaned." \ No newline at end of file + @echo "Project cleaned." + +license: + @echo "Checking if licenseheaders library is installed..." + @if pip show licenseheaders > /dev/null 2>&1; then \ + echo "licenseheaders is installed."; \ + else \ + echo "licenseheaders is not installed. Installing it..."; \ + pip install licenseheaders --no-input; \ + fi + @echo "Adding license to opmon_collector module..." + @licenseheaders -t ../LICENSE.MD -E py -d ./opmon_collector + @echo "Adding license to opmon_mongodb_maintenance module..." + @licenseheaders -t ../LICENSE.MD -E py -d ./opmon_mongodb_maintenance + @echo "Note: bin directory is not updated by the tool. Make sure to update it manually." + @echo "License added." diff --git a/collector_module/opmon_collector/__init__.py b/collector_module/opmon_collector/__init__.py index c64fb83..b2d8653 100644 --- a/collector_module/opmon_collector/__init__.py +++ b/collector_module/opmon_collector/__init__.py @@ -1,23 +1,25 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. __version__ = '1.3.0' diff --git a/collector_module/opmon_collector/central_server_client.py b/collector_module/opmon_collector/central_server_client.py index 892f7d0..004a1f0 100644 --- a/collector_module/opmon_collector/central_server_client.py +++ b/collector_module/opmon_collector/central_server_client.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import re import xml.etree.ElementTree as ET diff --git a/collector_module/opmon_collector/collector_multiprocessing.py b/collector_module/opmon_collector/collector_multiprocessing.py index 9e204c6..7b4df17 100644 --- a/collector_module/opmon_collector/collector_multiprocessing.py +++ b/collector_module/opmon_collector/collector_multiprocessing.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import time from multiprocessing import Pool diff --git a/collector_module/opmon_collector/collector_worker.py b/collector_module/opmon_collector/collector_worker.py index 14a5d91..2a7a20c 100644 --- a/collector_module/opmon_collector/collector_worker.py +++ b/collector_module/opmon_collector/collector_worker.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import datetime import json diff --git a/collector_module/opmon_collector/database_manager.py b/collector_module/opmon_collector/database_manager.py index 99c8413..8aa5e48 100644 --- a/collector_module/opmon_collector/database_manager.py +++ b/collector_module/opmon_collector/database_manager.py @@ -1,27 +1,29 @@ -""" Database Manager - Collector Module -""" - -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. +""" +Database Manager - Collector Module +""" import time import urllib.parse diff --git a/collector_module/opmon_collector/logger_manager.py b/collector_module/opmon_collector/logger_manager.py index e90a48c..050cf58 100644 --- a/collector_module/opmon_collector/logger_manager.py +++ b/collector_module/opmon_collector/logger_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import json import logging diff --git a/collector_module/opmon_collector/main.py b/collector_module/opmon_collector/main.py index 46bfd85..2581282 100644 --- a/collector_module/opmon_collector/main.py +++ b/collector_module/opmon_collector/main.py @@ -1,26 +1,28 @@ #!/usr/bin/env python3 -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import argparse import sys diff --git a/collector_module/opmon_collector/pid_file_handler.py b/collector_module/opmon_collector/pid_file_handler.py index ac5c851..b9dcce3 100644 --- a/collector_module/opmon_collector/pid_file_handler.py +++ b/collector_module/opmon_collector/pid_file_handler.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import atexit import contextlib diff --git a/collector_module/opmon_collector/security_server_client.py b/collector_module/opmon_collector/security_server_client.py index 3a7fa65..b83ad13 100644 --- a/collector_module/opmon_collector/security_server_client.py +++ b/collector_module/opmon_collector/security_server_client.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. class SecurityServerClient: def __init__(self): diff --git a/collector_module/opmon_collector/settings.py b/collector_module/opmon_collector/settings.py index adec831..0f59bf4 100644 --- a/collector_module/opmon_collector/settings.py +++ b/collector_module/opmon_collector/settings.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from os import listdir from os.path import isfile, join diff --git a/collector_module/opmon_collector/tests/test_central_server_client.py b/collector_module/opmon_collector/tests/test_central_server_client.py index e139777..5500220 100644 --- a/collector_module/opmon_collector/tests/test_central_server_client.py +++ b/collector_module/opmon_collector/tests/test_central_server_client.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import pytest import os diff --git a/collector_module/opmon_collector/tests/test_collector_multiprocessing.py b/collector_module/opmon_collector/tests/test_collector_multiprocessing.py index 2712634..88dee5a 100644 --- a/collector_module/opmon_collector/tests/test_collector_multiprocessing.py +++ b/collector_module/opmon_collector/tests/test_collector_multiprocessing.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import pytest import os diff --git a/collector_module/opmon_collector/tests/test_collector_worker.py b/collector_module/opmon_collector/tests/test_collector_worker.py index 9aacd75..66d73e2 100644 --- a/collector_module/opmon_collector/tests/test_collector_worker.py +++ b/collector_module/opmon_collector/tests/test_collector_worker.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os import pathlib diff --git a/collector_module/opmon_collector/tests/test_database_manager.py b/collector_module/opmon_collector/tests/test_database_manager.py index 07f9cca..bc3851e 100644 --- a/collector_module/opmon_collector/tests/test_database_manager.py +++ b/collector_module/opmon_collector/tests/test_database_manager.py @@ -1,4 +1,27 @@ #!/usr/bin/env python3 +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Unit tests for database_manager.py diff --git a/collector_module/opmon_collector/tests/test_logger_manager.py b/collector_module/opmon_collector/tests/test_logger_manager.py index b3e966b..007c537 100644 --- a/collector_module/opmon_collector/tests/test_logger_manager.py +++ b/collector_module/opmon_collector/tests/test_logger_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import pytest import os diff --git a/collector_module/opmon_collector/tests/test_main.py b/collector_module/opmon_collector/tests/test_main.py index eefecd6..9a38908 100644 --- a/collector_module/opmon_collector/tests/test_main.py +++ b/collector_module/opmon_collector/tests/test_main.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Unit tests for main.py """ diff --git a/collector_module/opmon_collector/tests/test_pid_file_handler.py b/collector_module/opmon_collector/tests/test_pid_file_handler.py index 72f7b8d..d77a7d8 100644 --- a/collector_module/opmon_collector/tests/test_pid_file_handler.py +++ b/collector_module/opmon_collector/tests/test_pid_file_handler.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import pytest import os diff --git a/collector_module/opmon_collector/tests/test_security_server_client.py b/collector_module/opmon_collector/tests/test_security_server_client.py index b65b0df..1627f1c 100644 --- a/collector_module/opmon_collector/tests/test_security_server_client.py +++ b/collector_module/opmon_collector/tests/test_security_server_client.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from io import StringIO import xml.etree.ElementTree as ET diff --git a/collector_module/opmon_collector/tests/test_settings.py b/collector_module/opmon_collector/tests/test_settings.py index 5993762..a3c3f3d 100644 --- a/collector_module/opmon_collector/tests/test_settings.py +++ b/collector_module/opmon_collector/tests/test_settings.py @@ -1,4 +1,27 @@ #!/usr/bin/env python3 +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Unit tests for collector settings.py diff --git a/collector_module/opmon_collector/tests/test_update_servers.py b/collector_module/opmon_collector/tests/test_update_servers.py index fea7718..72ee6b2 100644 --- a/collector_module/opmon_collector/tests/test_update_servers.py +++ b/collector_module/opmon_collector/tests/test_update_servers.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os import pathlib diff --git a/collector_module/opmon_collector/update_servers.py b/collector_module/opmon_collector/update_servers.py index 6ff1c5b..9efa633 100644 --- a/collector_module/opmon_collector/update_servers.py +++ b/collector_module/opmon_collector/update_servers.py @@ -1,29 +1,30 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Gets list of server information from CENTRALSERVER Stores updated list into collector_state.server_list """ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - from .central_server_client import CentralServerClient from .database_manager import DatabaseManager from .logger_manager import LoggerManager diff --git a/collector_module/opmon_mongodb_maintenance/__init__.py b/collector_module/opmon_mongodb_maintenance/__init__.py index 5933e5a..65504ce 100644 --- a/collector_module/opmon_mongodb_maintenance/__init__.py +++ b/collector_module/opmon_mongodb_maintenance/__init__.py @@ -1,21 +1,23 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. diff --git a/collector_module/opmon_mongodb_maintenance/create_indexes.py b/collector_module/opmon_mongodb_maintenance/create_indexes.py index 3450927..08d1431 100644 --- a/collector_module/opmon_mongodb_maintenance/create_indexes.py +++ b/collector_module/opmon_mongodb_maintenance/create_indexes.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import logging diff --git a/collector_module/opmon_mongodb_maintenance/create_users.py b/collector_module/opmon_mongodb_maintenance/create_users.py index 78cec76..2f80bed 100644 --- a/collector_module/opmon_mongodb_maintenance/create_users.py +++ b/collector_module/opmon_mongodb_maintenance/create_users.py @@ -1,31 +1,32 @@ #!/usr/bin/env python3 +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Script to create MongoDb users for X-Road Metrics tools. """ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - import logging import secrets import string diff --git a/collector_module/opmon_mongodb_maintenance/hash_speed_test.py b/collector_module/opmon_mongodb_maintenance/hash_speed_test.py index 7ba1321..90ad902 100644 --- a/collector_module/opmon_mongodb_maintenance/hash_speed_test.py +++ b/collector_module/opmon_mongodb_maintenance/hash_speed_test.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Hash check speed in MongoDB Clean Data Usage example: @@ -6,28 +29,6 @@ """ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - import time import getpass import argparse diff --git a/collector_module/opmon_mongodb_maintenance/main.py b/collector_module/opmon_mongodb_maintenance/main.py index ce277ba..2f75a10 100644 --- a/collector_module/opmon_mongodb_maintenance/main.py +++ b/collector_module/opmon_mongodb_maintenance/main.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import argparse diff --git a/collector_module/opmon_mongodb_maintenance/raw_data_archive.py b/collector_module/opmon_mongodb_maintenance/raw_data_archive.py index 5cf3e53..1616d74 100644 --- a/collector_module/opmon_mongodb_maintenance/raw_data_archive.py +++ b/collector_module/opmon_mongodb_maintenance/raw_data_archive.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Archive Raw Data Usage example: @@ -6,28 +29,6 @@ """ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - import time import getpass import argparse diff --git a/collector_module/opmon_mongodb_maintenance/read_speed_test.py b/collector_module/opmon_mongodb_maintenance/read_speed_test.py index 10fca1e..b1186cf 100644 --- a/collector_module/opmon_mongodb_maintenance/read_speed_test.py +++ b/collector_module/opmon_mongodb_maintenance/read_speed_test.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Read speed in MongoDB Raw and Clean Data Usage example: @@ -6,28 +29,6 @@ """ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - import time import getpass import argparse diff --git a/collector_module/opmon_mongodb_maintenance/tests/test_create_indexes.py b/collector_module/opmon_mongodb_maintenance/tests/test_create_indexes.py index a5f25b2..4bd64f0 100644 --- a/collector_module/opmon_mongodb_maintenance/tests/test_create_indexes.py +++ b/collector_module/opmon_mongodb_maintenance/tests/test_create_indexes.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from mongomock import MongoClient diff --git a/collector_module/opmon_mongodb_maintenance/tests/test_create_users.py b/collector_module/opmon_mongodb_maintenance/tests/test_create_users.py index 51be095..2a5a72b 100644 --- a/collector_module/opmon_mongodb_maintenance/tests/test_create_users.py +++ b/collector_module/opmon_mongodb_maintenance/tests/test_create_users.py @@ -1,29 +1,31 @@ #!/usr/bin/env python3 +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Unit tests for create_users.py """ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from argparse import Namespace import yaml diff --git a/collector_module/opmon_mongodb_maintenance/tests/test_mongo_maintenance_main.py b/collector_module/opmon_mongodb_maintenance/tests/test_mongo_maintenance_main.py index 572b174..9a38ce1 100644 --- a/collector_module/opmon_mongodb_maintenance/tests/test_mongo_maintenance_main.py +++ b/collector_module/opmon_mongodb_maintenance/tests/test_mongo_maintenance_main.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from argparse import Namespace from opmon_mongodb_maintenance import main diff --git a/corrector_module/Makefile b/corrector_module/Makefile index 91d0f03..f9b44c6 100644 --- a/corrector_module/Makefile +++ b/corrector_module/Makefile @@ -8,4 +8,17 @@ clean: @rm -rf dist/ @rm -rf *.egg-info/ @rm -rf ../htmlcov/corrector_module/ - @echo "Project cleaned." \ No newline at end of file + @echo "Project cleaned." + +license: + @echo "Checking if licenseheaders library is installed..." + @if pip show licenseheaders > /dev/null 2>&1; then \ + echo "licenseheaders is installed."; \ + else \ + echo "licenseheaders is not installed. Installing it..."; \ + pip install licenseheaders --no-input; \ + fi + @echo "Adding license to opmon_corrector module..." + @licenseheaders -t ../LICENSE.MD -E py -d ./opmon_corrector + @echo "Note: bin directory is not updated by the tool. Make sure to update it manually." + @echo "License added." diff --git a/corrector_module/opmon_corrector/__init__.py b/corrector_module/opmon_corrector/__init__.py index e83f3e0..063b589 100644 --- a/corrector_module/opmon_corrector/__init__.py +++ b/corrector_module/opmon_corrector/__init__.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. __version__ = '1.3.0' diff --git a/corrector_module/opmon_corrector/corrector_batch.py b/corrector_module/opmon_corrector/corrector_batch.py index 4e21c7b..7e9ddd7 100644 --- a/corrector_module/opmon_corrector/corrector_batch.py +++ b/corrector_module/opmon_corrector/corrector_batch.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import multiprocessing import time diff --git a/corrector_module/opmon_corrector/corrector_worker.py b/corrector_module/opmon_corrector/corrector_worker.py index e47757a..99f028b 100644 --- a/corrector_module/opmon_corrector/corrector_worker.py +++ b/corrector_module/opmon_corrector/corrector_worker.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import queue diff --git a/corrector_module/opmon_corrector/correctord.py b/corrector_module/opmon_corrector/correctord.py index 5eecc24..2f3cf8f 100644 --- a/corrector_module/opmon_corrector/correctord.py +++ b/corrector_module/opmon_corrector/correctord.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import argparse import time diff --git a/corrector_module/opmon_corrector/database_manager.py b/corrector_module/opmon_corrector/database_manager.py index e0ec856..3665e69 100644 --- a/corrector_module/opmon_corrector/database_manager.py +++ b/corrector_module/opmon_corrector/database_manager.py @@ -1,27 +1,29 @@ -""" Database Manager - Corrector Module -""" - -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. +""" +Database Manager - Corrector Module +""" import time from datetime import datetime diff --git a/corrector_module/opmon_corrector/document_manager.py b/corrector_module/opmon_corrector/document_manager.py index 16f242b..3806238 100644 --- a/corrector_module/opmon_corrector/document_manager.py +++ b/corrector_module/opmon_corrector/document_manager.py @@ -1,27 +1,29 @@ -""" Document Manager - Corrector Module -""" - -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. +""" +Document Manager - Corrector Module +""" from opmon_corrector import (SECURITY_SERVER_TYPE_CLIENT, SECURITY_SERVER_TYPE_PRODUCER, __version__) diff --git a/corrector_module/opmon_corrector/logger_manager.py b/corrector_module/opmon_corrector/logger_manager.py index cf74c27..9f32257 100644 --- a/corrector_module/opmon_corrector/logger_manager.py +++ b/corrector_module/opmon_corrector/logger_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import json import logging diff --git a/corrector_module/opmon_corrector/settings_parser.py b/corrector_module/opmon_corrector/settings_parser.py index 667f706..12ebaa3 100644 --- a/corrector_module/opmon_corrector/settings_parser.py +++ b/corrector_module/opmon_corrector/settings_parser.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from os import listdir from os.path import isfile, join diff --git a/corrector_module/opmon_corrector/tests/test_corrector_batch.py b/corrector_module/opmon_corrector/tests/test_corrector_batch.py index 663f5cd..c15b5d3 100644 --- a/corrector_module/opmon_corrector/tests/test_corrector_batch.py +++ b/corrector_module/opmon_corrector/tests/test_corrector_batch.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import json import logging import os diff --git a/corrector_module/opmon_corrector/tests/test_document_manager.py b/corrector_module/opmon_corrector/tests/test_document_manager.py index fc62f37..e3bbf55 100644 --- a/corrector_module/opmon_corrector/tests/test_document_manager.py +++ b/corrector_module/opmon_corrector/tests/test_document_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import pytest import pathlib diff --git a/corrector_module/opmon_corrector/tests/test_settings_parser.py b/corrector_module/opmon_corrector/tests/test_settings_parser.py index f289fb2..6f608bb 100644 --- a/corrector_module/opmon_corrector/tests/test_settings_parser.py +++ b/corrector_module/opmon_corrector/tests/test_settings_parser.py @@ -1,29 +1,31 @@ #!/usr/bin/env python3 +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Unit tests for collector settings.py """ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os import pathlib diff --git a/integration_tests/Makefile b/integration_tests/Makefile new file mode 100644 index 0000000..614bfec --- /dev/null +++ b/integration_tests/Makefile @@ -0,0 +1,11 @@ +license: + @echo "Checking if licenseheaders library is installed..." + @if pip show licenseheaders > /dev/null 2>&1; then \ + echo "licenseheaders is installed."; \ + else \ + echo "licenseheaders is not installed. Installing it..."; \ + pip install licenseheaders --no-input; \ + fi + @echo "Adding license to integration_tests..." + @licenseheaders -t ../LICENSE.MD -E py + @echo "License added." diff --git a/integration_tests/__init__.py b/integration_tests/__init__.py index e69de29..65504ce 100644 --- a/integration_tests/__init__.py +++ b/integration_tests/__init__.py @@ -0,0 +1,23 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# diff --git a/integration_tests/ci_analyzer/__init__.py b/integration_tests/ci_analyzer/__init__.py index e69de29..65504ce 100644 --- a/integration_tests/ci_analyzer/__init__.py +++ b/integration_tests/ci_analyzer/__init__.py @@ -0,0 +1,23 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# diff --git a/integration_tests/ci_analyzer/ci_analyzer_settings.py b/integration_tests/ci_analyzer/ci_analyzer_settings.py index 1f363b2..1382123 100644 --- a/integration_tests/ci_analyzer/ci_analyzer_settings.py +++ b/integration_tests/ci_analyzer/ci_analyzer_settings.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# class Settings: diff --git a/integration_tests/ci_analyzer/test_analyzer_aggregation_queries.py b/integration_tests/ci_analyzer/test_analyzer_aggregation_queries.py index 5b4fff8..6622a1d 100644 --- a/integration_tests/ci_analyzer/test_analyzer_aggregation_queries.py +++ b/integration_tests/ci_analyzer/test_analyzer_aggregation_queries.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import unittest from unittest.mock import Mock diff --git a/integration_tests/ci_analyzer/test_analyzer_timeperiods.py b/integration_tests/ci_analyzer/test_analyzer_timeperiods.py index 6b1f996..78536f5 100644 --- a/integration_tests/ci_analyzer/test_analyzer_timeperiods.py +++ b/integration_tests/ci_analyzer/test_analyzer_timeperiods.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import unittest from unittest.mock import Mock diff --git a/integration_tests/ci_anonymizer/__init__.py b/integration_tests/ci_anonymizer/__init__.py index e69de29..65504ce 100644 --- a/integration_tests/ci_anonymizer/__init__.py +++ b/integration_tests/ci_anonymizer/__init__.py @@ -0,0 +1,23 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# diff --git a/integration_tests/ci_anonymizer/ci_anonymizer_settings.py b/integration_tests/ci_anonymizer/ci_anonymizer_settings.py index c55e8bc..05244c7 100644 --- a/integration_tests/ci_anonymizer/ci_anonymizer_settings.py +++ b/integration_tests/ci_anonymizer/ci_anonymizer_settings.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import os x_road_instance = 'ee-dev' diff --git a/integration_tests/ci_anonymizer/ci_helper.py b/integration_tests/ci_anonymizer/ci_helper.py index d59161f..fb46677 100644 --- a/integration_tests/ci_anonymizer/ci_helper.py +++ b/integration_tests/ci_anonymizer/ci_helper.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import json def read_data_from_json(path): diff --git a/integration_tests/ci_anonymizer/test_anonymizer.py b/integration_tests/ci_anonymizer/test_anonymizer.py index 8c38593..bd5d742 100644 --- a/integration_tests/ci_anonymizer/test_anonymizer.py +++ b/integration_tests/ci_anonymizer/test_anonymizer.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import os import json import unittest diff --git a/integration_tests/ci_collector/test_collector.py b/integration_tests/ci_collector/test_collector.py index f4ccbdf..09bff14 100644 --- a/integration_tests/ci_collector/test_collector.py +++ b/integration_tests/ci_collector/test_collector.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import os import signal import subprocess diff --git a/integration_tests/ci_corrector/__init__.py b/integration_tests/ci_corrector/__init__.py index e69de29..65504ce 100644 --- a/integration_tests/ci_corrector/__init__.py +++ b/integration_tests/ci_corrector/__init__.py @@ -0,0 +1,23 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# diff --git a/integration_tests/ci_corrector/ci_corrector_settings.py b/integration_tests/ci_corrector/ci_corrector_settings.py index e89c4dd..fc9d83a 100644 --- a/integration_tests/ci_corrector/ci_corrector_settings.py +++ b/integration_tests/ci_corrector/ci_corrector_settings.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import logging from logging import FileHandler import os diff --git a/integration_tests/ci_corrector/test_corrector.py b/integration_tests/ci_corrector/test_corrector.py index af8f730..edde225 100644 --- a/integration_tests/ci_corrector/test_corrector.py +++ b/integration_tests/ci_corrector/test_corrector.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import unittest import random diff --git a/integration_tests/ci_reports/__init__.py b/integration_tests/ci_reports/__init__.py index e69de29..65504ce 100644 --- a/integration_tests/ci_reports/__init__.py +++ b/integration_tests/ci_reports/__init__.py @@ -0,0 +1,23 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# diff --git a/integration_tests/ci_reports/ci_reports_settings.py b/integration_tests/ci_reports/ci_reports_settings.py index 266e243..bc0c695 100644 --- a/integration_tests/ci_reports/ci_reports_settings.py +++ b/integration_tests/ci_reports/ci_reports_settings.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import logging import os from logging import FileHandler diff --git a/integration_tests/ci_reports/test_factsheet_manager_CI.py b/integration_tests/ci_reports/test_factsheet_manager_CI.py index edf561d..aebdbaa 100644 --- a/integration_tests/ci_reports/test_factsheet_manager_CI.py +++ b/integration_tests/ci_reports/test_factsheet_manager_CI.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import random import unittest from unittest.mock import MagicMock diff --git a/integration_tests/ci_reports/test_report_worker_CI.py b/integration_tests/ci_reports/test_report_worker_CI.py index 2fe9ec7..510a2db 100644 --- a/integration_tests/ci_reports/test_report_worker_CI.py +++ b/integration_tests/ci_reports/test_report_worker_CI.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import json import random import unittest diff --git a/integration_tests/helpers/__init__.py b/integration_tests/helpers/__init__.py index e69de29..65504ce 100644 --- a/integration_tests/helpers/__init__.py +++ b/integration_tests/helpers/__init__.py @@ -0,0 +1,23 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# diff --git a/integration_tests/helpers/ci_analyzer_db_handler.py b/integration_tests/helpers/ci_analyzer_db_handler.py index eb499db..d83a207 100644 --- a/integration_tests/helpers/ci_analyzer_db_handler.py +++ b/integration_tests/helpers/ci_analyzer_db_handler.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import pymongo diff --git a/integration_tests/helpers/ci_db_connector.py b/integration_tests/helpers/ci_db_connector.py index 088596e..2d9d06e 100644 --- a/integration_tests/helpers/ci_db_connector.py +++ b/integration_tests/helpers/ci_db_connector.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import pymongo diff --git a/integration_tests/helpers/ci_helper.py b/integration_tests/helpers/ci_helper.py index a2b47fe..0f783b0 100644 --- a/integration_tests/helpers/ci_helper.py +++ b/integration_tests/helpers/ci_helper.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import collections import hashlib import random diff --git a/integration_tests/helpers/ci_postgres_handler.py b/integration_tests/helpers/ci_postgres_handler.py index e90074d..331e2df 100644 --- a/integration_tests/helpers/ci_postgres_handler.py +++ b/integration_tests/helpers/ci_postgres_handler.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import psycopg2 as pg import psycopg2.extras as pg_extras diff --git a/integration_tests/helpers/cl_db_handler.py b/integration_tests/helpers/cl_db_handler.py index 380e334..299a498 100644 --- a/integration_tests/helpers/cl_db_handler.py +++ b/integration_tests/helpers/cl_db_handler.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import time diff --git a/integration_tests/helpers/field_names.py b/integration_tests/helpers/field_names.py index fc64cfe..b29c6a5 100644 --- a/integration_tests/helpers/field_names.py +++ b/integration_tests/helpers/field_names.py @@ -1,3 +1,27 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + # From RIA string_fields = [ diff --git a/opendata_collector_module/Makefile b/opendata_collector_module/Makefile index 90c9f05..4a4f38b 100644 --- a/opendata_collector_module/Makefile +++ b/opendata_collector_module/Makefile @@ -8,4 +8,17 @@ clean: @rm -rf dist/ @rm -rf *.egg-info/ @rm -rf ../htmlcov/opendata_collector_module/ - @echo "Project cleaned." \ No newline at end of file + @echo "Project cleaned." + +license: + @echo "Checking if licenseheaders library is installed..." + @if pip show licenseheaders > /dev/null 2>&1; then \ + echo "licenseheaders is installed."; \ + else \ + echo "licenseheaders is not installed. Installing it..."; \ + pip install licenseheaders --no-input; \ + fi + @echo "Adding license to metrics_opendata_collector module..." + @licenseheaders -t ../LICENSE.MD -E py -d ./metrics_opendata_collector + @echo "Note: bin directory is not updated by the tool. Make sure to update it manually." + @echo "License added." diff --git a/opendata_collector_module/metrics_opendata_collector/__init__.py b/opendata_collector_module/metrics_opendata_collector/__init__.py index c64fb83..b2d8653 100644 --- a/opendata_collector_module/metrics_opendata_collector/__init__.py +++ b/opendata_collector_module/metrics_opendata_collector/__init__.py @@ -1,23 +1,25 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. __version__ = '1.3.0' diff --git a/opendata_collector_module/metrics_opendata_collector/constants.py b/opendata_collector_module/metrics_opendata_collector/constants.py index 0336193..823b465 100644 --- a/opendata_collector_module/metrics_opendata_collector/constants.py +++ b/opendata_collector_module/metrics_opendata_collector/constants.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. DT_FORMAT_WO_TZ = '%Y-%m-%dT%H:%M:%S' DT_FORMAT_W_TZ = '%Y-%m-%dT%H:%M:%S%z' diff --git a/opendata_collector_module/metrics_opendata_collector/logger_manager.py b/opendata_collector_module/metrics_opendata_collector/logger_manager.py index e9eeb6c..9f3facc 100644 --- a/opendata_collector_module/metrics_opendata_collector/logger_manager.py +++ b/opendata_collector_module/metrics_opendata_collector/logger_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import json import logging diff --git a/opendata_collector_module/metrics_opendata_collector/main.py b/opendata_collector_module/metrics_opendata_collector/main.py index 706e6ec..fe60887 100644 --- a/opendata_collector_module/metrics_opendata_collector/main.py +++ b/opendata_collector_module/metrics_opendata_collector/main.py @@ -1,26 +1,28 @@ #!/usr/bin/env python3 -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal # noqa -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import argparse diff --git a/opendata_collector_module/metrics_opendata_collector/mongodb_manager.py b/opendata_collector_module/metrics_opendata_collector/mongodb_manager.py index abe40d3..53d91e0 100644 --- a/opendata_collector_module/metrics_opendata_collector/mongodb_manager.py +++ b/opendata_collector_module/metrics_opendata_collector/mongodb_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import time import urllib.parse diff --git a/opendata_collector_module/metrics_opendata_collector/multiprocessing_utils.py b/opendata_collector_module/metrics_opendata_collector/multiprocessing_utils.py index a08e6fa..edc8a71 100644 --- a/opendata_collector_module/metrics_opendata_collector/multiprocessing_utils.py +++ b/opendata_collector_module/metrics_opendata_collector/multiprocessing_utils.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# from multiprocessing import Process from metrics_opendata_collector.opendata_collector import collect_opendata diff --git a/opendata_collector_module/metrics_opendata_collector/opendata_api_client.py b/opendata_collector_module/metrics_opendata_collector/opendata_api_client.py index 858d755..d2fe157 100644 --- a/opendata_collector_module/metrics_opendata_collector/opendata_api_client.py +++ b/opendata_collector_module/metrics_opendata_collector/opendata_api_client.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import urllib from datetime import datetime diff --git a/opendata_collector_module/metrics_opendata_collector/opendata_collector.py b/opendata_collector_module/metrics_opendata_collector/opendata_collector.py index f6e1922..1cf17ce 100644 --- a/opendata_collector_module/metrics_opendata_collector/opendata_collector.py +++ b/opendata_collector_module/metrics_opendata_collector/opendata_collector.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import datetime from operator import itemgetter diff --git a/opendata_collector_module/metrics_opendata_collector/settings.py b/opendata_collector_module/metrics_opendata_collector/settings.py index edfd110..331b5c2 100644 --- a/opendata_collector_module/metrics_opendata_collector/settings.py +++ b/opendata_collector_module/metrics_opendata_collector/settings.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import re from os import listdir diff --git a/opendata_collector_module/metrics_opendata_collector/tests/test_main.py b/opendata_collector_module/metrics_opendata_collector/tests/test_main.py index f4d5805..a6b2a6b 100644 --- a/opendata_collector_module/metrics_opendata_collector/tests/test_main.py +++ b/opendata_collector_module/metrics_opendata_collector/tests/test_main.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Unit tests for main.py """ diff --git a/opendata_collector_module/metrics_opendata_collector/tests/test_opendata_collector.py b/opendata_collector_module/metrics_opendata_collector/tests/test_opendata_collector.py index a96fa0a..3a5391d 100644 --- a/opendata_collector_module/metrics_opendata_collector/tests/test_opendata_collector.py +++ b/opendata_collector_module/metrics_opendata_collector/tests/test_opendata_collector.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import os import pathlib from logging import StreamHandler diff --git a/opendata_module/Makefile b/opendata_module/Makefile index 4c7f9f4..6493b0f 100644 --- a/opendata_module/Makefile +++ b/opendata_module/Makefile @@ -8,4 +8,19 @@ clean: @rm -rf dist/ @rm -rf *.egg-info/ @rm -rf ../htmlcov/opendata_module/ - @echo "Project cleaned." \ No newline at end of file + @echo "Project cleaned." + +license: + @echo "Checking if licenseheaders library is installed..." + @if pip show licenseheaders > /dev/null 2>&1; then \ + echo "licenseheaders is installed."; \ + else \ + echo "licenseheaders is not installed. Installing it..."; \ + pip install licenseheaders --no-input; \ + fi + @echo "Adding license to opmon_opendata module..." + @licenseheaders -t ../LICENSE.MD -E py -d ./opmon_opendata + @echo "Adding license to opmon_postgresql_maintenance module..." + @licenseheaders -t ../LICENSE.MD -E py -d ./opmon_postgresql_maintenance + @echo "Note: bin directory is not updated by the tool. Make sure to update it manually." + @echo "License added." diff --git a/opendata_module/opmon_opendata/__init__.py b/opendata_module/opmon_opendata/__init__.py index c64fb83..b2d8653 100644 --- a/opendata_module/opmon_opendata/__init__.py +++ b/opendata_module/opmon_opendata/__init__.py @@ -1,23 +1,25 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. __version__ = '1.3.0' diff --git a/opendata_module/opmon_opendata/api/__init__.py b/opendata_module/opmon_opendata/api/__init__.py index 5933e5a..65504ce 100644 --- a/opendata_module/opmon_opendata/api/__init__.py +++ b/opendata_module/opmon_opendata/api/__init__.py @@ -1,21 +1,23 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. diff --git a/opendata_module/opmon_opendata/api/admin.py b/opendata_module/opmon_opendata/api/admin.py index f3e2086..88cd21d 100644 --- a/opendata_module/opmon_opendata/api/admin.py +++ b/opendata_module/opmon_opendata/api/admin.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from django.contrib import admin # noqa: F401 diff --git a/opendata_module/opmon_opendata/api/apps.py b/opendata_module/opmon_opendata/api/apps.py index 8aa1988..6a147fc 100644 --- a/opendata_module/opmon_opendata/api/apps.py +++ b/opendata_module/opmon_opendata/api/apps.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from django.apps import AppConfig diff --git a/opendata_module/opmon_opendata/api/forms.py b/opendata_module/opmon_opendata/api/forms.py index da539e9..0f49ffd 100644 --- a/opendata_module/opmon_opendata/api/forms.py +++ b/opendata_module/opmon_opendata/api/forms.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import datetime import json diff --git a/opendata_module/opmon_opendata/api/helpers.py b/opendata_module/opmon_opendata/api/helpers.py index 595edec..dfff756 100644 --- a/opendata_module/opmon_opendata/api/helpers.py +++ b/opendata_module/opmon_opendata/api/helpers.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from datetime import datetime from gzip import GzipFile from io import BytesIO diff --git a/opendata_module/opmon_opendata/api/input_validator.py b/opendata_module/opmon_opendata/api/input_validator.py index 4bf3679..a444b3f 100644 --- a/opendata_module/opmon_opendata/api/input_validator.py +++ b/opendata_module/opmon_opendata/api/input_validator.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from datetime import datetime import json diff --git a/opendata_module/opmon_opendata/api/migrations/__init__.py b/opendata_module/opmon_opendata/api/migrations/__init__.py index e69de29..65504ce 100644 --- a/opendata_module/opmon_opendata/api/migrations/__init__.py +++ b/opendata_module/opmon_opendata/api/migrations/__init__.py @@ -0,0 +1,23 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# diff --git a/opendata_module/opmon_opendata/api/models.py b/opendata_module/opmon_opendata/api/models.py index 939c813..efc69d5 100644 --- a/opendata_module/opmon_opendata/api/models.py +++ b/opendata_module/opmon_opendata/api/models.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from django.db import models # noqa: F401 diff --git a/opendata_module/opmon_opendata/api/postgresql_manager.py b/opendata_module/opmon_opendata/api/postgresql_manager.py index 19ab763..2006836 100644 --- a/opendata_module/opmon_opendata/api/postgresql_manager.py +++ b/opendata_module/opmon_opendata/api/postgresql_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from typing import Dict, List, Optional, Tuple diff --git a/opendata_module/opmon_opendata/api/urls.py b/opendata_module/opmon_opendata/api/urls.py index 78c70d4..f53677e 100644 --- a/opendata_module/opmon_opendata/api/urls.py +++ b/opendata_module/opmon_opendata/api/urls.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from django.urls import include, path # noqa: F401 from opmon_opendata import django_settings as settings diff --git a/opendata_module/opmon_opendata/api/views.py b/opendata_module/opmon_opendata/api/views.py index 214828b..f0a424f 100644 --- a/opendata_module/opmon_opendata/api/views.py +++ b/opendata_module/opmon_opendata/api/views.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import json from datetime import datetime from typing import Optional diff --git a/opendata_module/opmon_opendata/django_settings.py b/opendata_module/opmon_opendata/django_settings.py index 099719a..216a1ad 100644 --- a/opendata_module/opmon_opendata/django_settings.py +++ b/opendata_module/opmon_opendata/django_settings.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Django settings for interface project. diff --git a/opendata_module/opmon_opendata/gui/__init__.py b/opendata_module/opmon_opendata/gui/__init__.py index 5933e5a..65504ce 100644 --- a/opendata_module/opmon_opendata/gui/__init__.py +++ b/opendata_module/opmon_opendata/gui/__init__.py @@ -1,21 +1,23 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. diff --git a/opendata_module/opmon_opendata/gui/admin.py b/opendata_module/opmon_opendata/gui/admin.py index f3e2086..88cd21d 100644 --- a/opendata_module/opmon_opendata/gui/admin.py +++ b/opendata_module/opmon_opendata/gui/admin.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from django.contrib import admin # noqa: F401 diff --git a/opendata_module/opmon_opendata/gui/apps.py b/opendata_module/opmon_opendata/gui/apps.py index f9ce3b9..ae8085c 100644 --- a/opendata_module/opmon_opendata/gui/apps.py +++ b/opendata_module/opmon_opendata/gui/apps.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from django.apps import AppConfig diff --git a/opendata_module/opmon_opendata/gui/migrations/__init__.py b/opendata_module/opmon_opendata/gui/migrations/__init__.py index 5933e5a..65504ce 100644 --- a/opendata_module/opmon_opendata/gui/migrations/__init__.py +++ b/opendata_module/opmon_opendata/gui/migrations/__init__.py @@ -1,21 +1,23 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. diff --git a/opendata_module/opmon_opendata/gui/models.py b/opendata_module/opmon_opendata/gui/models.py index 939c813..efc69d5 100644 --- a/opendata_module/opmon_opendata/gui/models.py +++ b/opendata_module/opmon_opendata/gui/models.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from django.db import models # noqa: F401 diff --git a/opendata_module/opmon_opendata/gui/urls.py b/opendata_module/opmon_opendata/gui/urls.py index 907b7f7..a186ebf 100644 --- a/opendata_module/opmon_opendata/gui/urls.py +++ b/opendata_module/opmon_opendata/gui/urls.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from django.urls import include, path # noqa: F401 from . import views diff --git a/opendata_module/opmon_opendata/gui/views.py b/opendata_module/opmon_opendata/gui/views.py index ef3f034..2109171 100644 --- a/opendata_module/opmon_opendata/gui/views.py +++ b/opendata_module/opmon_opendata/gui/views.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import json from typing import Sequence, TypedDict diff --git a/opendata_module/opmon_opendata/logger_manager.py b/opendata_module/opmon_opendata/logger_manager.py index e90a48c..050cf58 100644 --- a/opendata_module/opmon_opendata/logger_manager.py +++ b/opendata_module/opmon_opendata/logger_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import json import logging diff --git a/opendata_module/opmon_opendata/opendata_settings_parser.py b/opendata_module/opmon_opendata/opendata_settings_parser.py index eb86f00..351f038 100644 --- a/opendata_module/opmon_opendata/opendata_settings_parser.py +++ b/opendata_module/opmon_opendata/opendata_settings_parser.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import yaml from opmon_opendata.settings_parser import OpmonSettingsManager diff --git a/opendata_module/opmon_opendata/settings_parser.py b/opendata_module/opmon_opendata/settings_parser.py index 5d8179e..41ac011 100644 --- a/opendata_module/opmon_opendata/settings_parser.py +++ b/opendata_module/opmon_opendata/settings_parser.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import errno from os import listdir diff --git a/opendata_module/opmon_opendata/tests/__init__.py b/opendata_module/opmon_opendata/tests/__init__.py index 5933e5a..65504ce 100644 --- a/opendata_module/opmon_opendata/tests/__init__.py +++ b/opendata_module/opmon_opendata/tests/__init__.py @@ -1,21 +1,23 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. diff --git a/opendata_module/opmon_opendata/tests/manual/create_example_table.py b/opendata_module/opmon_opendata/tests/manual/create_example_table.py index a15cf04..f987a27 100644 --- a/opendata_module/opmon_opendata/tests/manual/create_example_table.py +++ b/opendata_module/opmon_opendata/tests/manual/create_example_table.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import psycopg2 as pg import os import sys diff --git a/opendata_module/opmon_opendata/tests/manual/drop_example_table.py b/opendata_module/opmon_opendata/tests/manual/drop_example_table.py index 80d3573..06c140e 100644 --- a/opendata_module/opmon_opendata/tests/manual/drop_example_table.py +++ b/opendata_module/opmon_opendata/tests/manual/drop_example_table.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import logging import os import sys diff --git a/opendata_module/opmon_opendata/tests/test_api.py b/opendata_module/opmon_opendata/tests/test_api.py index 2f67459..3c4679c 100644 --- a/opendata_module/opmon_opendata/tests/test_api.py +++ b/opendata_module/opmon_opendata/tests/test_api.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import datetime import json diff --git a/opendata_module/opmon_opendata/tests/test_input_validator.py b/opendata_module/opmon_opendata/tests/test_input_validator.py index 472f3b1..b432909 100644 --- a/opendata_module/opmon_opendata/tests/test_input_validator.py +++ b/opendata_module/opmon_opendata/tests/test_input_validator.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import datetime import pytest diff --git a/opendata_module/opmon_opendata/tests/test_logger_manager.py b/opendata_module/opmon_opendata/tests/test_logger_manager.py index d015128..909ed90 100644 --- a/opendata_module/opmon_opendata/tests/test_logger_manager.py +++ b/opendata_module/opmon_opendata/tests/test_logger_manager.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import logging from opmon_opendata.logger_manager import LoggerManager diff --git a/opendata_module/opmon_opendata/tests/test_settings.py b/opendata_module/opmon_opendata/tests/test_settings.py index 04ea900..f90eeb0 100644 --- a/opendata_module/opmon_opendata/tests/test_settings.py +++ b/opendata_module/opmon_opendata/tests/test_settings.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# ROOT_URLCONF = 'opmon_opendata.urls' SECRET_KEY = 'test' diff --git a/opendata_module/opmon_opendata/tests/test_utils.py b/opendata_module/opmon_opendata/tests/test_utils.py index 6c4fea0..8e321be 100644 --- a/opendata_module/opmon_opendata/tests/test_utils.py +++ b/opendata_module/opmon_opendata/tests/test_utils.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import datetime import sqlite3 from logging import StreamHandler diff --git a/opendata_module/opmon_opendata/urls.py b/opendata_module/opmon_opendata/urls.py index be0fe55..ebb8707 100644 --- a/opendata_module/opmon_opendata/urls.py +++ b/opendata_module/opmon_opendata/urls.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Opmon Opendata URL Configuration """ diff --git a/opendata_module/opmon_postgresql_maintenance/__init__.py b/opendata_module/opmon_postgresql_maintenance/__init__.py index 5933e5a..65504ce 100644 --- a/opendata_module/opmon_postgresql_maintenance/__init__.py +++ b/opendata_module/opmon_postgresql_maintenance/__init__.py @@ -1,21 +1,23 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. diff --git a/opendata_module/opmon_postgresql_maintenance/create_users.py b/opendata_module/opmon_postgresql_maintenance/create_users.py index 72deb4c..b390bcb 100644 --- a/opendata_module/opmon_postgresql_maintenance/create_users.py +++ b/opendata_module/opmon_postgresql_maintenance/create_users.py @@ -1,31 +1,32 @@ #!/usr/bin/env python3 +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# """ Script to create PostgreSQL users for X-Road Metrics tools. """ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - import argparse import getpass import logging diff --git a/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py b/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py index 485acec..4c226b1 100644 --- a/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py +++ b/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from unittest.mock import call diff --git a/reports_module/Makefile b/reports_module/Makefile index ac3b1cb..68bb597 100644 --- a/reports_module/Makefile +++ b/reports_module/Makefile @@ -8,4 +8,17 @@ clean: @rm -rf dist/ @rm -rf *.egg-info/ @rm -rf ../htmlcov/reports_module/ - @echo "Project cleaned." \ No newline at end of file + @echo "Project cleaned." + +license: + @echo "Checking if licenseheaders library is installed..." + @if pip show licenseheaders > /dev/null 2>&1; then \ + echo "licenseheaders is installed."; \ + else \ + echo "licenseheaders is not installed. Installing it..."; \ + pip install licenseheaders --no-input; \ + fi + @echo "Adding license to opmon_reports module..." + @licenseheaders -t ../LICENSE.MD -E py -d ./opmon_reports + @echo "Note: bin directory is not updated by the tool. Make sure to update it manually." + @echo "License added." diff --git a/reports_module/opmon_reports/__init__.py b/reports_module/opmon_reports/__init__.py index c64fb83..b2d8653 100644 --- a/reports_module/opmon_reports/__init__.py +++ b/reports_module/opmon_reports/__init__.py @@ -1,23 +1,25 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. __version__ = '1.3.0' diff --git a/reports_module/opmon_reports/constants.py b/reports_module/opmon_reports/constants.py index 80271cc..d554233 100644 --- a/reports_module/opmon_reports/constants.py +++ b/reports_module/opmon_reports/constants.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os diff --git a/reports_module/opmon_reports/database_manager.py b/reports_module/opmon_reports/database_manager.py index ad6d83a..2db105e 100644 --- a/reports_module/opmon_reports/database_manager.py +++ b/reports_module/opmon_reports/database_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import time from typing import Iterable diff --git a/reports_module/opmon_reports/logger_manager.py b/reports_module/opmon_reports/logger_manager.py index 4352f83..1b400ae 100644 --- a/reports_module/opmon_reports/logger_manager.py +++ b/reports_module/opmon_reports/logger_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import json import logging diff --git a/reports_module/opmon_reports/main.py b/reports_module/opmon_reports/main.py index 452a70a..0ab00e4 100644 --- a/reports_module/opmon_reports/main.py +++ b/reports_module/opmon_reports/main.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from .reports_arguments import OpmonReportsArguments from .reports_main import report_main diff --git a/reports_module/opmon_reports/mongodb_handler.py b/reports_module/opmon_reports/mongodb_handler.py index bf6ea7e..d74ca37 100644 --- a/reports_module/opmon_reports/mongodb_handler.py +++ b/reports_module/opmon_reports/mongodb_handler.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import urllib.parse import pymongo diff --git a/reports_module/opmon_reports/notification_manager.py b/reports_module/opmon_reports/notification_manager.py index 0d182d7..2cdc47d 100644 --- a/reports_module/opmon_reports/notification_manager.py +++ b/reports_module/opmon_reports/notification_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import os import smtplib diff --git a/reports_module/opmon_reports/notifications_main.py b/reports_module/opmon_reports/notifications_main.py index 24f4aec..b5143a4 100644 --- a/reports_module/opmon_reports/notifications_main.py +++ b/reports_module/opmon_reports/notifications_main.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import time import traceback diff --git a/reports_module/opmon_reports/report_manager.py b/reports_module/opmon_reports/report_manager.py index 0bf2752..451b509 100644 --- a/reports_module/opmon_reports/report_manager.py +++ b/reports_module/opmon_reports/report_manager.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import operator import os diff --git a/reports_module/opmon_reports/report_row.py b/reports_module/opmon_reports/report_row.py index 947fad4..520d936 100644 --- a/reports_module/opmon_reports/report_row.py +++ b/reports_module/opmon_reports/report_row.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. class AverageValue: def __init__(self): diff --git a/reports_module/opmon_reports/reports_arguments.py b/reports_module/opmon_reports/reports_arguments.py index a5de647..c3fd3fa 100644 --- a/reports_module/opmon_reports/reports_arguments.py +++ b/reports_module/opmon_reports/reports_arguments.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import argparse diff --git a/reports_module/opmon_reports/reports_main.py b/reports_module/opmon_reports/reports_main.py index 7e13155..fc3bc39 100644 --- a/reports_module/opmon_reports/reports_main.py +++ b/reports_module/opmon_reports/reports_main.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import json import time diff --git a/reports_module/opmon_reports/settings_parser.py b/reports_module/opmon_reports/settings_parser.py index 2b45369..8ede63d 100644 --- a/reports_module/opmon_reports/settings_parser.py +++ b/reports_module/opmon_reports/settings_parser.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. from os import listdir from os.path import isfile, join diff --git a/reports_module/opmon_reports/tests/test_notification_manager.py b/reports_module/opmon_reports/tests/test_notification_manager.py index c64e895..0f5ce18 100644 --- a/reports_module/opmon_reports/tests/test_notification_manager.py +++ b/reports_module/opmon_reports/tests/test_notification_manager.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import asyncore import smtpd import threading diff --git a/reports_module/opmon_reports/tests/test_report_manager.py b/reports_module/opmon_reports/tests/test_report_manager.py index f638329..bbc14e0 100644 --- a/reports_module/opmon_reports/tests/test_report_manager.py +++ b/reports_module/opmon_reports/tests/test_report_manager.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import os import pytest diff --git a/reports_module/opmon_reports/tests/test_report_row.py b/reports_module/opmon_reports/tests/test_report_row.py index 2c764c5..275dbc9 100644 --- a/reports_module/opmon_reports/tests/test_report_row.py +++ b/reports_module/opmon_reports/tests/test_report_row.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import pytest import random from opmon_reports.report_row import ReportRow diff --git a/reports_module/opmon_reports/tests/test_time_date_tools.py b/reports_module/opmon_reports/tests/test_time_date_tools.py index 37df1b5..6be32ec 100644 --- a/reports_module/opmon_reports/tests/test_time_date_tools.py +++ b/reports_module/opmon_reports/tests/test_time_date_tools.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# import pytest import datetime from opmon_reports import time_date_tools diff --git a/reports_module/opmon_reports/tests/test_tools.py b/reports_module/opmon_reports/tests/test_tools.py index 8f28bc7..4b7c1d5 100644 --- a/reports_module/opmon_reports/tests/test_tools.py +++ b/reports_module/opmon_reports/tests/test_tools.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# from opmon_reports import tools diff --git a/reports_module/opmon_reports/tests/test_xroad_descriptor.py b/reports_module/opmon_reports/tests/test_xroad_descriptor.py index 9ac1b73..f131585 100644 --- a/reports_module/opmon_reports/tests/test_xroad_descriptor.py +++ b/reports_module/opmon_reports/tests/test_xroad_descriptor.py @@ -1,3 +1,26 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# from json.decoder import JSONDecodeError import mongomock diff --git a/reports_module/opmon_reports/time_date_tools.py b/reports_module/opmon_reports/time_date_tools.py index 1b3dfd8..ecf1005 100644 --- a/reports_module/opmon_reports/time_date_tools.py +++ b/reports_module/opmon_reports/time_date_tools.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import calendar import datetime diff --git a/reports_module/opmon_reports/tools.py b/reports_module/opmon_reports/tools.py index b0e1c30..c0e7d91 100644 --- a/reports_module/opmon_reports/tools.py +++ b/reports_module/opmon_reports/tools.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import string diff --git a/reports_module/opmon_reports/translator.py b/reports_module/opmon_reports/translator.py index 577c2b8..09d46e2 100644 --- a/reports_module/opmon_reports/translator.py +++ b/reports_module/opmon_reports/translator.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. class Translator: def __init__(self, template): diff --git a/reports_module/opmon_reports/unique_subsystems.py b/reports_module/opmon_reports/unique_subsystems.py index 85a0e49..11d150e 100644 --- a/reports_module/opmon_reports/unique_subsystems.py +++ b/reports_module/opmon_reports/unique_subsystems.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. def document_to_pair(document): """ diff --git a/reports_module/opmon_reports/xroad_descriptor.py b/reports_module/opmon_reports/xroad_descriptor.py index b173105..0655899 100644 --- a/reports_module/opmon_reports/xroad_descriptor.py +++ b/reports_module/opmon_reports/xroad_descriptor.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. import json from json import JSONDecodeError diff --git a/reports_module/opmon_reports/xroad_descriptor_schema.py b/reports_module/opmon_reports/xroad_descriptor_schema.py index 10b5812..539256c 100644 --- a/reports_module/opmon_reports/xroad_descriptor_schema.py +++ b/reports_module/opmon_reports/xroad_descriptor_schema.py @@ -1,24 +1,26 @@ -# The MIT License -# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) -# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. # -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. xroad_descriptor_schema = { "type": "array", From 5788027b77746132e4ec89f8e1770dc829c5503a Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Tue, 12 Nov 2024 13:37:26 +0200 Subject: [PATCH 18/36] fix: Add missing make license command in anonymizer module Refs: OPMONDEV-187 --- anonymizer_module/Makefile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/anonymizer_module/Makefile b/anonymizer_module/Makefile index c76bf3b..c219c5f 100644 --- a/anonymizer_module/Makefile +++ b/anonymizer_module/Makefile @@ -8,4 +8,19 @@ clean: @rm -rf dist/ @rm -rf *.egg-info/ @rm -rf ../htmlcov/anonymizer_module/ - @echo "Project cleaned." \ No newline at end of file + @echo "Project cleaned." + +license: + @echo "Checking if licenseheaders library is installed..." + @if pip show licenseheaders > /dev/null 2>&1; then \ + echo "licenseheaders is installed."; \ + else \ + echo "licenseheaders is not installed. Installing it..."; \ + pip install licenseheaders --no-input; \ + fi + @echo "Adding license to metrics_statistics module..." + @licenseheaders -t ../LICENSE.MD -E py -d ./metrics_statistics + @echo "Adding license to opmon_anonymizer module..." + @licenseheaders -t ../LICENSE.MD -E py -d ./opmon_anonymizer + @echo "Note: bin directory is not updated by the tool. Make sure to update it manually." + @echo "License added." From d7696e049c9e3fc173ba5dff5409135ea4ee39f7 Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Wed, 20 Nov 2024 11:33:08 +0200 Subject: [PATCH 19/36] chore: Remove sensitive info from path variables from consumer messages Refs: OPMONDEV-187 --- .../opmon_corrector/corrector_worker.py | 28 ++- .../opmon_corrector/database_manager.py | 12 ++ .../opmon_corrector/document_manager.py | 10 +- .../fixtures/clean_data_after_batch_2.json | 105 +++++++++++ .../tests/fixtures/clean_data_batch_1.json | 106 +++++++++++ .../tests/fixtures/clean_data_batch_3.json | 171 ++++++++++++++++++ .../tests/fixtures/raw_messages_batch_1.json | 68 ++++++- .../raw_messages_batch_3_after_run.json | 104 +++++++++++ .../raw_messages_batch_3_before_run.json | 101 +++++++++++ .../tests/test_corrector_batch.py | 11 ++ 10 files changed, 709 insertions(+), 7 deletions(-) create mode 100644 corrector_module/opmon_corrector/tests/fixtures/clean_data_batch_3.json create mode 100644 corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_3_after_run.json create mode 100644 corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_3_before_run.json diff --git a/corrector_module/opmon_corrector/corrector_worker.py b/corrector_module/opmon_corrector/corrector_worker.py index 99f028b..5dd32a3 100644 --- a/corrector_module/opmon_corrector/corrector_worker.py +++ b/corrector_module/opmon_corrector/corrector_worker.py @@ -141,8 +141,9 @@ def consume_data(self, data): clean_document['correctorStatus'] = 'done' clean_document['matchingType'] = 'regular_pair' clean_document['xRequestId'] = x_request_id + doc_m.correct_client_rest_path(clean_document['client'], clean_document['producer']) self.db_m.update_document_clean_data(clean_document) - self.db_m.mark_as_corrected(doc) + self._post_consume_raw_document(matched_pair.get('client'), matched_pair.get('producer')) return duplicates corrected_document = doc_m.create_json( @@ -153,10 +154,9 @@ def consume_data(self, data): corrected_document['correctorStatus'] = 'done' if len(matched_pair) > 1 else 'processing' corrected_document['matchingType'] = 'regular_pair' if len(matched_pair) > 1 else 'orphan' corrected_document['messageId'] = message_id + doc_m.correct_client_rest_path(corrected_document['client'], corrected_document['producer']) self.db_m.add_to_clean_data(corrected_document) - - for party in matched_pair: - self.db_m.mark_as_corrected(matched_pair[party]) + self._post_consume_raw_document(matched_pair.get('client'), matched_pair.get('producer')) return duplicates @@ -184,5 +184,23 @@ def consume_faulty_data(self, data): cleaned_document['xRequestId'] = '' cleaned_document['matchingType'] = 'orphan' cleaned_document['messageId'] = fixed_doc.get('message_id') or '' + doc_m.correct_client_rest_path(client, producer) self.db_m.add_to_clean_data(cleaned_document) - self.db_m.mark_as_corrected(fixed_doc) + self._post_consume_raw_document(client, producer) + + def _post_consume_raw_document(self, client: dict, producer: dict): + """ + Post consume raw document. If client has a restPath, correct it and mark client and producer as corrected. + Otherwise, just mark client and producer as corrected. + :param client: Client document. + :param producer: Producer document. + :return: None. + """ + if client: + if client and client.get('restPath'): + rest_path = producer.get('restPath') if producer and producer.get('restPath') else "/*" + self.db_m.mark_as_corrected_and_correct_rest_path(client, rest_path) + else: + self.db_m.mark_as_corrected(client) + if producer: + self.db_m.mark_as_corrected(producer) diff --git a/corrector_module/opmon_corrector/database_manager.py b/corrector_module/opmon_corrector/database_manager.py index 3665e69..c0918dc 100644 --- a/corrector_module/opmon_corrector/database_manager.py +++ b/corrector_module/opmon_corrector/database_manager.py @@ -103,6 +103,18 @@ def mark_as_corrected(self, document: dict) -> None: raw_data = db[RAW_DATA_COLLECTION] raw_data.update_one({'_id': doc_id}, {'$set': {'corrected': True}}) + def mark_as_corrected_and_correct_rest_path(self, document: dict, rest_path: str) -> None: + """ + Marks a specific document's "corrected" status to "True" and update restPath value with the new one. + :param document: The input document. + :param rest_path: The input restPath to be used to override existing value. + :return: None + """ + doc_id = document['_id'] + db = self.get_query_db() + raw_data = db[RAW_DATA_COLLECTION] + raw_data.update_one({'_id': doc_id}, {'$set': {'corrected': True, 'restPath': rest_path}}) + def get_faulty_raw_documents(self, limit: int = 1000) -> List[dict]: """ Gets number of documents specified by the limit that have not been corrected and has no xRequestId diff --git a/corrector_module/opmon_corrector/document_manager.py b/corrector_module/opmon_corrector/document_manager.py index 3806238..e2cb0ee 100644 --- a/corrector_module/opmon_corrector/document_manager.py +++ b/corrector_module/opmon_corrector/document_manager.py @@ -332,7 +332,7 @@ def sanitize_document(document: dict) -> dict: } return sanitized_document - def correct_structure(self, doc): + def correct_structure(self, doc: dict) -> dict: """ Check that documents have all required fields. Try to fill in missing fields by heuristics or set them to None as last resort. @@ -356,3 +356,11 @@ def correct_structure(self, doc): if f not in doc: doc[f] = None return doc + + @staticmethod + def correct_client_rest_path(client: dict, producer: dict): + if client and client.get('restPath'): + if producer and producer.get('restPath'): + client['restPath'] = producer.get('restPath') + else: + client['restPath'] = "/*" diff --git a/corrector_module/opmon_corrector/tests/fixtures/clean_data_after_batch_2.json b/corrector_module/opmon_corrector/tests/fixtures/clean_data_after_batch_2.json index 2062df6..bb0a407 100644 --- a/corrector_module/opmon_corrector/tests/fixtures/clean_data_after_batch_2.json +++ b/corrector_module/opmon_corrector/tests/fixtures/clean_data_after_batch_2.json @@ -901,5 +901,110 @@ "correctorTime" : 1671453542.47041, "correctorStatus" : "processing", "matchingType" : "orphan" + }, + { + "client": { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.63.89", + "securityServerType": "Client", + "requestInTs": 1671066024362, + "requestOutTs": 1671066024362, + "responseInTs": 1671066024390, + "responseOutTs": 1671066024403, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/string/*", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId": "171b7b78-e8f7-4b78-b486-601371ebe6af", + "statusCode": 200, + "serviceType": "REST", + "insertTime": 1671090130.61985, + "serviceVersion": null, + "representedPartyClass": null, + "representedPartyCode": null, + "messageUserId": null, + "messageIssue": null, + "requestMimeSize": null, + "responseMimeSize": null, + "faultCode": null, + "faultString": null + }, + "producer": { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.60.226", + "securityServerType": "Producer", + "requestInTs": 1671066024379, + "requestOutTs": 1671066024383, + "responseInTs": 1671066024384, + "responseOutTs": 1671066024390, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/string/*", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId": "171b7b78-e8f7-4b78-b486-601371ebe6af", + "statusCode": 200, + "serviceType": "OPENAPI3", + "insertTime": 1671090130.54086, + "serviceVersion": null, + "representedPartyClass": null, + "representedPartyCode": null, + "messageUserId": null, + "messageIssue": null, + "requestMimeSize": null, + "responseMimeSize": null, + "faultCode": null, + "faultString": null + }, + "xRequestId": "171b7b78-e8f7-4b78-b486-601371ebe6af", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "totalDuration": 41, + "clientSsRequestDuration": 0, + "clientSsResponseDuration": 13, + "producerDurationClientView": 28, + "producerDurationProducerView": 11, + "producerSsRequestDuration": 4, + "producerSsResponseDuration": 6, + "producerIsDuration": 1, + "requestNwDuration": 17, + "responseNwDuration": 0, + "clientRequestSize": 206, + "producerRequestSize": 206, + "clientResponseSize": 1408, + "producerResponseSize": 1408, + "correctorTime": 1671453654.53553, + "correctorStatus": "done", + "matchingType": "regular_pair" } ] diff --git a/corrector_module/opmon_corrector/tests/fixtures/clean_data_batch_1.json b/corrector_module/opmon_corrector/tests/fixtures/clean_data_batch_1.json index 2da1a4e..963b5a1 100644 --- a/corrector_module/opmon_corrector/tests/fixtures/clean_data_batch_1.json +++ b/corrector_module/opmon_corrector/tests/fixtures/clean_data_batch_1.json @@ -826,5 +826,111 @@ "correctorTime" : 1670762642.34124, "correctorStatus" : "done", "matchingType" : "orphan" +}, +{ + "client" : { + "monitoringDataTs" : 1671066024, + "securityServerInternalIp" : "172.31.63.89", + "securityServerType" : "Client", + "requestInTs" : 1671066024362, + "requestOutTs" : 1671066024362, + "responseInTs" : 1671066024390, + "responseOutTs" : 1671066024403, + "clientXRoadInstance" : "LTT", + "clientMemberClass" : "TEST", + "clientMemberCode" : "TEST1", + "clientSubsystemCode" : "SUB1", + "serviceXRoadInstance" : "LTT", + "serviceMemberClass" : "TEST", + "serviceMemberCode" : "TEST2", + "serviceSubsystemCode" : "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/string/*", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "messageProtocolVersion" : "1", + "clientSecurityServerAddress" : "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress" : "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize" : 206, + "responseSize" : 1408, + "requestAttachmentCount" : 0, + "responseAttachmentCount" : 0, + "succeeded" : true, + "xRequestId" : "171b7b78-e8f7-4b78-b486-601371ebe6af", + "statusCode" : 200, + "serviceType" : "REST", + "insertTime" : 1671090130.61985, + "serviceVersion" : null, + "representedPartyClass" : null, + "representedPartyCode" : null, + "messageUserId" : null, + "messageIssue" : null, + "requestMimeSize" : null, + "responseMimeSize" : null, + "faultCode" : null, + "faultString" : null + }, + "producer" : { + "monitoringDataTs" : 1671066024, + "securityServerInternalIp" : "172.31.60.226", + "securityServerType" : "Producer", + "requestInTs" : 1671066024379, + "requestOutTs" : 1671066024383, + "responseInTs" : 1671066024384, + "responseOutTs" : 1671066024390, + "clientXRoadInstance" : "LTT", + "clientMemberClass" : "TEST", + "clientMemberCode" : "TEST1", + "clientSubsystemCode" : "SUB1", + "serviceXRoadInstance" : "LTT", + "serviceMemberClass" : "TEST", + "serviceMemberCode" : "TEST2", + "serviceSubsystemCode" : "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/string/*", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "messageProtocolVersion" : "1", + "clientSecurityServerAddress" : "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress" : "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize" : 206, + "responseSize" : 1408, + "requestAttachmentCount" : 0, + "responseAttachmentCount" : 0, + "succeeded" : true, + "xRequestId" : "171b7b78-e8f7-4b78-b486-601371ebe6af", + "statusCode" : 200, + "serviceType" : "OPENAPI3", + "insertTime" : 1671090130.54086, + "serviceVersion" : null, + "representedPartyClass" : null, + "representedPartyCode" : null, + "messageUserId" : null, + "messageIssue" : null, + "requestMimeSize" : null, + "responseMimeSize" : null, + "faultCode" : null, + "faultString" : null + }, + + "xRequestId" : "171b7b78-e8f7-4b78-b486-601371ebe6af", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "totalDuration" : 41, + "clientSsRequestDuration" : 0, + "clientSsResponseDuration" : 13, + "producerDurationClientView" : 28, + "producerDurationProducerView" : 11, + "producerSsRequestDuration" : 4, + "producerSsResponseDuration" : 6, + "producerIsDuration" : 1, + "requestNwDuration" : 17, + "responseNwDuration" : 0, + "clientRequestSize" : 206, + "producerRequestSize" : 206, + "clientResponseSize" : 1408, + "producerResponseSize" : 1408, + "correctorTime" : 1671453654.53553, + "correctorStatus" : "done", + "matchingType" : "regular_pair" } ] diff --git a/corrector_module/opmon_corrector/tests/fixtures/clean_data_batch_3.json b/corrector_module/opmon_corrector/tests/fixtures/clean_data_batch_3.json new file mode 100644 index 0000000..105555a --- /dev/null +++ b/corrector_module/opmon_corrector/tests/fixtures/clean_data_batch_3.json @@ -0,0 +1,171 @@ +[ + { + "client": { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.63.89", + "securityServerType": "Client", + "requestInTs": 1671066024362, + "requestOutTs": 1671066024362, + "responseInTs": 1671066024390, + "responseOutTs": 1671066024403, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/int/*", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId": "171b7b78-e8f7-4b78-b486-601371ebe6af", + "statusCode": 200, + "serviceType": "REST", + "insertTime": 1671090130.61985, + "serviceVersion": null, + "representedPartyClass": null, + "representedPartyCode": null, + "messageUserId": null, + "messageIssue": null, + "requestMimeSize": null, + "responseMimeSize": null, + "faultCode": null, + "faultString": null + }, + "producer": { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.60.226", + "securityServerType": "Producer", + "requestInTs": 1671066024379, + "requestOutTs": 1671066024383, + "responseInTs": 1671066024384, + "responseOutTs": 1671066024390, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/int/*", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId": "171b7b78-e8f7-4b78-b486-601371ebe6af", + "statusCode": 200, + "serviceType": "OPENAPI3", + "insertTime": 1671090130.54086, + "serviceVersion": null, + "representedPartyClass": null, + "representedPartyCode": null, + "messageUserId": null, + "messageIssue": null, + "requestMimeSize": null, + "responseMimeSize": null, + "faultCode": null, + "faultString": null + }, + "xRequestId": "171b7b78-e8f7-4b78-b486-601371ebe6af", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "totalDuration": 41, + "clientSsRequestDuration": 0, + "clientSsResponseDuration": 13, + "producerDurationClientView": 28, + "producerDurationProducerView": 11, + "producerSsRequestDuration": 4, + "producerSsResponseDuration": 6, + "producerIsDuration": 1, + "requestNwDuration": 17, + "responseNwDuration": 0, + "clientRequestSize": 206, + "producerRequestSize": 206, + "clientResponseSize": 1408, + "producerResponseSize": 1408, + "correctorTime": 1671453654.53553, + "correctorStatus": "done", + "matchingType": "regular_pair" + }, + { + "client": { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.63.89", + "securityServerType": "Client", + "requestInTs": 1671066024362, + "requestOutTs": 1671066024362, + "responseInTs": 1671066024390, + "responseOutTs": 1671066024403, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/*", + "messageId": "LTT-13e93625-e59e-46fa-bc90-c53c14da71fd", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId": "3063ca6a-e389-4586-b4d1-7b4b284d2487", + "statusCode": 200, + "serviceType": "REST", + "insertTime": 1671090130.61985, + "serviceVersion": null, + "representedPartyClass": null, + "representedPartyCode": null, + "messageUserId": null, + "messageIssue": null, + "requestMimeSize": null, + "responseMimeSize": null, + "faultCode": null, + "faultString": null + }, + "producer": null, + "xRequestId": "3063ca6a-e389-4586-b4d1-7b4b284d2487", + "messageId": "LTT-13e93625-e59e-46fa-bc90-c53c14da71fd", + "totalDuration": 41, + "clientSsRequestDuration": 0, + "clientSsResponseDuration": 13, + "producerDurationClientView": 28, + "producerDurationProducerView": null, + "producerSsRequestDuration": null, + "producerSsResponseDuration": null, + "producerIsDuration": null, + "requestNwDuration": null, + "responseNwDuration": null, + "clientRequestSize": 206, + "producerRequestSize": null, + "clientResponseSize": 1408, + "producerResponseSize": null, + "correctorTime": 1671451218.56741, + "correctorStatus": "processing", + "matchingType": "orphan" + } +] \ No newline at end of file diff --git a/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_1.json b/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_1.json index d3ef5c1..2acbe19 100644 --- a/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_1.json +++ b/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_1.json @@ -410,5 +410,71 @@ "faultCode" : "Client.InvalidHttpMethod", "faultString" : "Must use POST request method instead of GET", "insertTime" : 1670665587.61187 -} +}, + { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.60.226", + "securityServerType": "Producer", + "requestInTs": 1671066024379, + "requestOutTs": 1671066024383, + "responseInTs": 1671066024384, + "responseOutTs": 1671066024390, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/string/*", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId" : "171b7b78-e8f7-4b78-b486-601371ebe6af", + "statusCode": 200, + "serviceType": "OPENAPI3", + "insertTime": 1671090130.54086 + }, + { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.63.89", + "securityServerType": "Client", + "requestInTs": 1671066024362, + "requestOutTs": 1671066024362, + "responseInTs": 1671066024390, + "responseOutTs": 1671066024403, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/string/250", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId" : "171b7b78-e8f7-4b78-b486-601371ebe6af", + "statusCode": 200, + "serviceType": "REST", + "insertTime": 1671090130.61985 + } ] diff --git a/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_3_after_run.json b/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_3_after_run.json new file mode 100644 index 0000000..ead1bd5 --- /dev/null +++ b/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_3_after_run.json @@ -0,0 +1,104 @@ +[ + { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.60.226", + "securityServerType": "Producer", + "requestInTs": 1671066024379, + "requestOutTs": 1671066024383, + "responseInTs": 1671066024384, + "responseOutTs": 1671066024390, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/int/*", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId": "171b7b78-e8f7-4b78-b486-601371ebe6af", + "statusCode": 200, + "serviceType": "OPENAPI3", + "insertTime": 1671090130.54086, + "corrected": true + }, + { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.63.89", + "securityServerType": "Client", + "requestInTs": 1671066024362, + "requestOutTs": 1671066024362, + "responseInTs": 1671066024390, + "responseOutTs": 1671066024403, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/int/*", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId": "171b7b78-e8f7-4b78-b486-601371ebe6af", + "statusCode": 200, + "serviceType": "REST", + "insertTime": 1671090130.61985, + "corrected": true + }, + { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.63.89", + "securityServerType": "Client", + "requestInTs": 1671066024362, + "requestOutTs": 1671066024362, + "responseInTs": 1671066024390, + "responseOutTs": 1671066024403, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/*", + "messageId": "LTT-13e93625-e59e-46fa-bc90-c53c14da71fd", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId": "3063ca6a-e389-4586-b4d1-7b4b284d2487", + "statusCode": 200, + "serviceType": "REST", + "insertTime": 1671090130.61985, + "corrected": true + } +] \ No newline at end of file diff --git a/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_3_before_run.json b/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_3_before_run.json new file mode 100644 index 0000000..c58a369 --- /dev/null +++ b/corrector_module/opmon_corrector/tests/fixtures/raw_messages_batch_3_before_run.json @@ -0,0 +1,101 @@ +[ + { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.60.226", + "securityServerType": "Producer", + "requestInTs": 1671066024379, + "requestOutTs": 1671066024383, + "responseInTs": 1671066024384, + "responseOutTs": 1671066024390, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/int/*", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId": "171b7b78-e8f7-4b78-b486-601371ebe6af", + "statusCode": 200, + "serviceType": "OPENAPI3", + "insertTime": 1671090130.54086 + }, + { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.63.89", + "securityServerType": "Client", + "requestInTs": 1671066024362, + "requestOutTs": 1671066024362, + "responseInTs": 1671066024390, + "responseOutTs": 1671066024403, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/int/15", + "messageId": "LTT-7c237207-1ed4-43d9-9152-a8ba02a251ab", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId": "171b7b78-e8f7-4b78-b486-601371ebe6af", + "statusCode": 200, + "serviceType": "REST", + "insertTime": 1671090130.61985 + }, + { + "monitoringDataTs": 1671066024, + "securityServerInternalIp": "172.31.63.89", + "securityServerType": "Client", + "requestInTs": 1671066024362, + "requestOutTs": 1671066024362, + "responseInTs": 1671066024390, + "responseOutTs": 1671066024403, + "clientXRoadInstance": "LTT", + "clientMemberClass": "TEST", + "clientMemberCode": "TEST1", + "clientSubsystemCode": "SUB1", + "serviceXRoadInstance": "LTT", + "serviceMemberClass": "TEST", + "serviceMemberCode": "TEST2", + "serviceSubsystemCode": "SUB3", + "serviceCode": "random", + "restMethod": "GET", + "restPath": "/string/250", + "messageId": "LTT-13e93625-e59e-46fa-bc90-c53c14da71fd", + "messageProtocolVersion": "1", + "clientSecurityServerAddress": "xroad-long-term-testing-ss1.i.x-road.rocks", + "serviceSecurityServerAddress": "xroad-long-term-testing-rh1.i.x-road.rocks", + "requestSize": 206, + "responseSize": 1408, + "requestAttachmentCount": 0, + "responseAttachmentCount": 0, + "succeeded": true, + "xRequestId": "3063ca6a-e389-4586-b4d1-7b4b284d2487", + "statusCode": 200, + "serviceType": "REST", + "insertTime": 1671090130.61985 + } +] \ No newline at end of file diff --git a/corrector_module/opmon_corrector/tests/test_corrector_batch.py b/corrector_module/opmon_corrector/tests/test_corrector_batch.py index c15b5d3..2e787e7 100644 --- a/corrector_module/opmon_corrector/tests/test_corrector_batch.py +++ b/corrector_module/opmon_corrector/tests/test_corrector_batch.py @@ -174,6 +174,17 @@ def test_corrector_batch_2(mongo, batch): actual_clean_data = get_documents(mongo, 'clean_data') compare_documents(actual_clean_data, expected_clean_data) +@freeze_time("2022-12-10") +def test_corrector_rest_path(mongo, batch): + insert_fixture(mongo, 'raw_messages', read_fixture('raw_messages_batch_3_before_run')) + batch.run({}) + + expected_clean_data = read_fixture('clean_data_batch_3') + actual_clean_data = get_documents(mongo, 'clean_data') + compare_documents(actual_clean_data, expected_clean_data) + expected_raw_data_after = read_fixture('raw_messages_batch_3_after_run') + actual_corrected_raw_documents = get_documents(mongo, 'raw_messages', {'corrected': True}) + compare_documents(actual_corrected_raw_documents, expected_raw_data_after) @freeze_time("2022-12-10") def test_corrector_batch_duplicates(mongo, batch, caplog): From 7d3e2c4df3d5eac1119f00a46e31c30007819434 Mon Sep 17 00:00:00 2001 From: Mohamed ElBeltagy <60988715+melbeltagy@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:49:19 +0200 Subject: [PATCH 20/36] fix: Migrate mongopy's collection#update to collection#update_one (#150) * fix: Migrate mongopy's collection#update to collection#update_one Refs: OPMONDEV-187 * fix: Use correct syntax to update_one in corrector's database_manager Refs: OPMONDEV-187 --- anonymizer_module/opmon_anonymizer/iio/mongodbmanager.py | 8 ++++---- corrector_module/opmon_corrector/database_manager.py | 2 +- reports_module/opmon_reports/database_manager.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/anonymizer_module/opmon_anonymizer/iio/mongodbmanager.py b/anonymizer_module/opmon_anonymizer/iio/mongodbmanager.py index 55eb7bd..cf282ee 100644 --- a/anonymizer_module/opmon_anonymizer/iio/mongodbmanager.py +++ b/anonymizer_module/opmon_anonymizer/iio/mongodbmanager.py @@ -138,9 +138,9 @@ def set_last_processed_timestamp(self): if not self.last_processed_timestamp: return - self.state_db.state.update( + self.state_db.state.update_one( {'key': 'last_mongodb_timestamp'}, - {'key': 'last_mongodb_timestamp', 'value': str(self.last_processed_timestamp)}, + {"$set": {'key': 'last_mongodb_timestamp', 'value': str(self.last_processed_timestamp)}}, upsert=True ) @@ -219,8 +219,8 @@ def set_last_processed_timestamp(self) -> None: if not self.last_processed_timestamp: return - self.state_db.opendata_state.update( + self.state_db.opendata_state.update_one( {'key': 'last_mongodb_timestamp'}, - {'key': 'last_mongodb_timestamp', 'value': str(self.last_processed_timestamp)}, + {"$set": {'key': 'last_mongodb_timestamp', 'value': str(self.last_processed_timestamp)}}, upsert=True ) diff --git a/corrector_module/opmon_corrector/database_manager.py b/corrector_module/opmon_corrector/database_manager.py index 3665e69..353d925 100644 --- a/corrector_module/opmon_corrector/database_manager.py +++ b/corrector_module/opmon_corrector/database_manager.py @@ -235,7 +235,7 @@ def update_document_clean_data(self, document: dict) -> None: try: db = self.get_query_db() clean_data = db[CLEAN_DATA_COLLECTION] - clean_data.replace_one({'_id': document['_id']}, document) + clean_data.update_one({'_id': document['_id']}, {"$set": document}) except Exception as e: self.logger_m.log_exception('DatabaseManager.update_form_clean_data', repr(e)) raise e diff --git a/reports_module/opmon_reports/database_manager.py b/reports_module/opmon_reports/database_manager.py index 2db105e..145d61e 100644 --- a/reports_module/opmon_reports/database_manager.py +++ b/reports_module/opmon_reports/database_manager.py @@ -350,7 +350,7 @@ def mark_as_sent(self, object_id): db = self.mongodb_handler.get_reports_state_db() collection = db[NOTIFICATION_COLLECTION] - collection.update( + collection.update_one( { "_id": object_id }, @@ -376,7 +376,7 @@ def mark_as_sent_error(self, object_id, error_message): db = self.mongodb_handler.get_reports_state_db() collection = db[NOTIFICATION_COLLECTION] - collection.update( + collection.update_one( { "_id": object_id }, From b476a3f0b43853073d6e9d8fbb9713fb29ae6e42 Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Mon, 25 Nov 2024 01:58:11 +0200 Subject: [PATCH 21/36] chore: map restMethod and restPath on opendata and anonymizer modules Refs: OPMONDEV-187 --- anonymizer_module/etc/field_data.yaml | 6 ++++++ anonymizer_module/etc/field_translations.list | 4 ++++ opendata_module/etc/field_data.yaml | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/anonymizer_module/etc/field_data.yaml b/anonymizer_module/etc/field_data.yaml index 9f3f4e3..79d1332 100644 --- a/anonymizer_module/etc/field_data.yaml +++ b/anonymizer_module/etc/field_data.yaml @@ -49,6 +49,12 @@ fields: serviceType: description: Type of service, possible values are WSDL, REST, OPENAPI3 type: varchar(255) + restMethod: + description: REST method + type: varchar(255) + restPath: + description: REST path + type: varchar(255) messageProtocolVersion: description: X-Road message protocol version type: varchar(255) diff --git a/anonymizer_module/etc/field_translations.list b/anonymizer_module/etc/field_translations.list index 09d3365..0f7478f 100644 --- a/anonymizer_module/etc/field_translations.list +++ b/anonymizer_module/etc/field_translations.list @@ -48,3 +48,7 @@ client.messageId -> messageId producer.messageId -> messageId client.serviceType -> serviceType producer.serviceType -> serviceType +client.restMethod -> restMethod +producer.restMethod -> restMethod +client.restPath -> restPath +producer.restPath -> restPath diff --git a/opendata_module/etc/field_data.yaml b/opendata_module/etc/field_data.yaml index 9f3f4e3..79d1332 100644 --- a/opendata_module/etc/field_data.yaml +++ b/opendata_module/etc/field_data.yaml @@ -49,6 +49,12 @@ fields: serviceType: description: Type of service, possible values are WSDL, REST, OPENAPI3 type: varchar(255) + restMethod: + description: REST method + type: varchar(255) + restPath: + description: REST path + type: varchar(255) messageProtocolVersion: description: X-Road message protocol version type: varchar(255) From 3bce8e575315b30d2fc903355dc3b7c82b57077b Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Mon, 25 Nov 2024 01:59:12 +0200 Subject: [PATCH 22/36] fix: Freeze rpds-py's version in dependencies to fix reports during installation Refs: OPMONDEV-187 --- .github/dependabot.yml | 3 +++ reports_module/setup.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 2f5695f..21caf37 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -55,6 +55,9 @@ updates: - dependency-name: "pydyf" versions: - ">= 0.11.0" + - dependency-name: "rpds-py" + versions: + - ">= 0.21.0" - package-ecosystem: "github-actions" directory: "/.github/workflows" diff --git a/reports_module/setup.py b/reports_module/setup.py index dd4b062..c8dc39c 100644 --- a/reports_module/setup.py +++ b/reports_module/setup.py @@ -25,7 +25,7 @@ from setuptools import setup, find_packages # The following dependencies has newer versions, but require Python 3.9 or higher -# matplotlib, pandas, weasyprint, numpy, contourpy, pyparsing +# matplotlib, pandas, weasyprint, numpy, contourpy, pyparsing, rpds-py requirements = [ 'markupsafe==2.1.5', @@ -43,6 +43,7 @@ 'contourpy==1.1.1', 'pyparsing==3.1.4', 'pydyf==0.10.0', + "rpds-py==0.20.1" ] classifiers = [ From b84838332cba2c93c167d3fd2dae417d5a3319e8 Mon Sep 17 00:00:00 2001 From: Mohamed Elbeltagy Date: Mon, 25 Nov 2024 02:02:53 +0200 Subject: [PATCH 23/36] chore: add restMethod to comparison list in corrector Refs: OPMONDEV-187 --- corrector_module/etc/settings.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/corrector_module/etc/settings.yaml b/corrector_module/etc/settings.yaml index 7047c5b..5bd8f69 100644 --- a/corrector_module/etc/settings.yaml +++ b/corrector_module/etc/settings.yaml @@ -73,6 +73,7 @@ corrector: - 'faultString' - 'responseMimeSize' - 'messageId' + - 'restMethod' # If no match is found for a record using the above criteria, it will be matched again as an "orphan". # Data fields that need to match in both a client record and a service record to mark the records as an orphan-match: From 4a00f0ea409f8caafda0bfa5e66b3d07a97f2c12 Mon Sep 17 00:00:00 2001 From: Mohamed ElBeltagy <60988715+melbeltagy@users.noreply.github.com> Date: Mon, 30 Dec 2024 14:31:05 +0200 Subject: [PATCH 24/36] docs: Add Developer's Guide documentation (#154) * docs: Add Developer's Guide documentation Refs: OPMONDEV-187 --- README.md | 2 + docs/dev_guide/developer_guide.md | 216 ++++++++++++++++++++++++++++++ 2 files changed, 218 insertions(+) create mode 100644 docs/dev_guide/developer_guide.md diff --git a/README.md b/README.md index 1c00bca..b7fee27 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,8 @@ Networking module is written in [**R**](https://www.r-project.org/). get access to the [X-Road Metrics Backlog](https://nordic-institute.atlassian.net/jira/software/c/projects/OPMONDEV/boards/2/backlog). +Follow the [developer's guide](./docs/dev_guide/developer_guide.md) to setup your local development environment + Submit a pull request to [X-Road Metrics source code Github repository](https://github.com/nordic-institute/X-Road-Metrics) or an enhancement request to the diff --git a/docs/dev_guide/developer_guide.md b/docs/dev_guide/developer_guide.md new file mode 100644 index 0000000..09db9dc --- /dev/null +++ b/docs/dev_guide/developer_guide.md @@ -0,0 +1,216 @@ +# Developer Guide + +## Table of Contents + +- [Developer Guide](#developer-guide) + - [Table of Contents](#table-of-contents) + - [Introduction](#introduction) + - [Setup Development Environment](#setup-development-environment) + - [Generic Steps](#generic-steps) + - [Install make](#install-make) + - [Install pyenv](#install-pyenv) + - [Install Python](#install-python) + - [Install setuptools](#install-setuptools) + - [Install tox](#install-tox) + - [Module Specific Steps](#module-specific-steps) + - [Create a virtual environment](#create-a-virtual-environment) + - [Activate the virtual environment](#activate-the-virtual-environment) + - [Development Workflow](#development-workflow) + - [Run lint checks, type checking, and tests](#run-lint-checks-type-checking-and-tests) + - [Run lint checks only](#run-lint-checks-only) + - [Run type checking only](#run-type-checking-only) + - [Run tests only](#run-tests-only) + - [Creating a pull request](#creating-a-pull-request) + - [Prerequisites](#prerequisites) + - [Branch naming, PRs, and commit messages](#branch-naming-prs-and-commit-messages) + - [Building a docker image](#building-a-docker-image) + - [Useful commands](#useful-commands) + - [Display list of installed virtual environments](#display-list-of-installed-virtual-environments) + - [Deactivate the virtual environment](#deactivate-the-virtual-environment) + - [Remove the virtual environment:](#remove-the-virtual-environment) + - [Display the list of installed Python versions:](#display-the-list-of-installed-python-versions) + - [Remove the Python version:](#remove-the-python-version) + +## Introduction + +This document provides a guide for developers to set up their development environment and contribute to the project. +Steps consists of generic steps that are required only once, +and module-specific steps that are required for each module. +The document also provides information on how to contribute to the project. + +## Setup Development Environment + +### Generic Steps + +The following steps are required only once when setting up the development environment. + +#### Install make + +```bash +sudo apt install make +``` + +#### Install pyenv + +> [!NOTE] +> For up-to-date installation instructions, please refer to [official website](https://github.com/pyenv/pyenv-installer) + +```bash +curl https://pyenv.run | bash +``` + +#### Install Python + +To get a list of latest Python versions available: +```bash +pyenv install --list | grep 3.8 +``` + +Currently, the latest version is `3.8.20`. To install it: + +```bash +pyenv install 3.8.20 +``` + +#### Install setuptools + +```bash +pip install setuptools +``` + +#### Install tox + +> [!NOTE] +> If tox is installed globally, it will be available for all virtual environments. +> If it's not installed globally, you will need to install it for each virtual environment. + +```bash +pip install tox +``` + +### Module Specific Steps + +The following steps are required for each module when setting up the development environment. + +#### Create a virtual environment + +> [!NOTE] +> Replace `collector` with the module's name + +```bash +pyenv virtualenv collector +``` + +#### Activate the virtual environment + +> [!NOTE] +> Replace `collector` with the module's name + +```bash +pyenv activate collector +``` + +## Development Workflow + +After following the setup steps, you can start developing the module. +The following commands are available for each module. + +### Run lint checks, type checking, and tests + +The following command will run lint checks, type checking, and tests: + +```bash +tox +``` + +### Run lint checks only + +```bash +tox -e lint +``` + +### Run type checking only + +```bash +tox -e type +``` + +### Run tests only + +```bash +tox -e py38 +``` + +## Creating a pull request + +### Prerequisites + +> [!IMPORTANT] +> When opening a pull request, please provide a signed Contributor Licence Agreement (CLA). More information can be found +> [here](https://github.com/nordic-institute/X-Road/blob/develop/CONTRIBUTING.md#legal-notice). + +For each module, run `tox` to make sure that the code is linted, typed, and tested. + +```bash +tox +``` + +For each module, make sure that the license headers are up to date using this command: + +```bash +make license +``` + +### Branch naming, PRs, and commit messages + +Please follow the style guide for branch names, PRs, and commit messages +as described in the [style guide](https://github.com/nordic-institute/X-Road/blob/develop/CONTRIBUTING.md#styleguides). + +## Building a docker image + +Before building a docker image, clean up the project to reduce image size. +_`tox` command caches a lot of files that might be over 500MB._ + +```bash +make clean +``` + +## Useful commands + +### Display list of installed virtual environments + +```bash +pyenv virtualenvs +``` + +An example output: +_The `*` indicates which virtualenv is active._ + +```bash + 3.8.20/envs/collector (created from /home/xrduser/.pyenv/versions/3.8.20) +* collector (created from /home/xrduser/.pyenv/versions/3.8.20) +``` + +### Deactivate the virtual environment + +```bash +pyenv deactivate +``` + +### Remove the virtual environment + +```bash +pyenv virtualenv-delete collector +``` + +### Display the list of installed Python versions + +```bash +pyenv versions +``` + +### Remove the Python version + +```bash +pyenv uninstall 3.8.20 +``` From 1e7b350dc2f3b89199ab91aa43b3bda361134a40 Mon Sep 17 00:00:00 2001 From: Jevgeni Krutov Date: Wed, 18 Dec 2024 19:18:22 +0200 Subject: [PATCH 25/36] feat: As a Metrics User I want the database migration to check if fields are missing and add them for the anonymizer module implemented logic that patches DB table structure refs: OPMONDEV-189 --- .../iio/postgresql_manager.py | 23 +++ .../tests/test_postgresql_manager.py | 137 ++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 anonymizer_module/opmon_anonymizer/tests/test_postgresql_manager.py diff --git a/anonymizer_module/opmon_anonymizer/iio/postgresql_manager.py b/anonymizer_module/opmon_anonymizer/iio/postgresql_manager.py index 6e46a7b..6fa1659 100644 --- a/anonymizer_module/opmon_anonymizer/iio/postgresql_manager.py +++ b/anonymizer_module/opmon_anonymizer/iio/postgresql_manager.py @@ -23,6 +23,7 @@ # from datetime import datetime +from typing import List, Tuple import psycopg2 as pg @@ -94,6 +95,10 @@ def _ensure_table(self, schema, index_columns): cursor = connection.cursor() if not self._table_exists(cursor): self._create_table(cursor, schema, index_columns) + else: + missing_cols = self._get_missing_columns(cursor, schema) + if missing_cols: + self._add_columns(cursor, schema, missing_cols) except Exception as e: error = f'Failed to ensure postgres table {self._table_name} ' \ @@ -122,6 +127,24 @@ def _create_table(self, cursor, schema, index_columns): for column_name in index_columns: cursor.execute(f'CREATE INDEX {column_name}_idx ON {self._table_name} ({column_name});') + def _get_missing_columns(self, cursor: pg.extensions.cursor, schema: List[Tuple[str, str]]) -> List[str]: + required_cols: List[str] = [key for key, _ in schema] + cursor.execute(""" + SELECT column_name FROM information_schema.columns + WHERE table_schema = 'public' + AND column_name <> 'id' + AND table_name = %s; + """, (self._table_name,)) + existing_cols: List[str] = [row[0] for row in cursor.fetchall()] + missing_cols: List[str] = [col for col in required_cols if + col.lower() not in {ec.lower() for ec in existing_cols}] + return missing_cols + + def _add_columns(self, cursor: pg.extensions.cursor, schema: List[Tuple[str, str]], cols_to_add: List[str]) -> None: + col_name_and_type = [(col_name, col_type) for col_name, col_type in schema if col_name in cols_to_add] + for col_name, col_type in col_name_and_type: + cursor.execute(f'ALTER TABLE {self._table_name} ADD {col_name} {col_type};') + def _ensure_privileges(self): try: with pg.connect(self._connection_string, **self._connect_args) as connection: diff --git a/anonymizer_module/opmon_anonymizer/tests/test_postgresql_manager.py b/anonymizer_module/opmon_anonymizer/tests/test_postgresql_manager.py new file mode 100644 index 0000000..7ec5309 --- /dev/null +++ b/anonymizer_module/opmon_anonymizer/tests/test_postgresql_manager.py @@ -0,0 +1,137 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + +import unittest +from unittest.mock import call, patch, MagicMock +from opmon_anonymizer.iio.postgresql_manager import PostgreSqlManager + + +class TestPostgreSqlManager(unittest.TestCase): + + def setUp(self): + self.mock_connect = patch('opmon_anonymizer.iio.postgresql_manager.pg.connect').start() + self.mock_connection = MagicMock() + self.mock_cursor = MagicMock() + self.mock_connect.return_value.__enter__.return_value = self.mock_connection + self.mock_connection.cursor.return_value = self.mock_cursor + + self.postgres_settings = { + 'table-name': 'test_table', + 'readonly-users': [], + 'host': 'localhost', + 'database-name': 'test_db' + } + self.logger = MagicMock() + + def test_table_gets_created_when_not_present(self): + self.mock_cursor.execute.side_effect = lambda query, params=None: 'false' if query == """ + SELECT EXISTS ( + SELECT FROM information_schema.tables + WHERE table_schema = 'public' + AND table_name = test_table + ); + """ else None + self.mock_cursor.fetchone.return_value = [False] + + table_schema = [('column1', 'VARCHAR'), ('column2', 'INTEGER')] + index_columns = ['column1'] + + PostgreSqlManager(self.postgres_settings, table_schema, index_columns, self.logger) + + self.mock_cursor.execute.assert_has_calls([ + call('CREATE TABLE test_table (id SERIAL PRIMARY KEY, column1 VARCHAR, column2 INTEGER);'), + call('CREATE INDEX column1_idx ON test_table (column1);') + ]) + + def test_table_gets_altered_when_columns_not_present(self): + query_exists = """ + SELECT EXISTS ( + SELECT FROM information_schema.tables + WHERE table_schema = 'public' + AND table_name = test_table + ); + """ + query_columns = """ + SELECT column_name FROM information_schema.columns + WHERE table_schema = 'public' + AND column_name <> 'id' + AND table_name = test_table; + """ + + def execute_side_effect(query, params=None): + if query == query_exists: + return 'true' + elif query == query_columns: + return [['column1'], ['column3']] + else: + return None + + self.mock_cursor.execute.side_effect = execute_side_effect + self.mock_cursor.fetchone.return_value = [True] + self.mock_cursor.fetchall.return_value = [['column1'], ['column3']] + + table_schema = [('column1', 'VARCHAR'), ('column2', 'INTEGER'), ('column3', 'VARCHAR'), ('column4', 'VARCHAR')] + index_columns = [] + + PostgreSqlManager(self.postgres_settings, table_schema, index_columns, self.logger) + + self.mock_cursor.execute.assert_has_calls([ + call('ALTER TABLE test_table ADD column2 INTEGER;'), + call('ALTER TABLE test_table ADD column4 VARCHAR;') + ]) + + def test_table_not_altered_when_no_missing_columns(self): + query_exists = """ + SELECT EXISTS ( + SELECT FROM information_schema.tables + WHERE table_schema = 'public' + AND table_name = test_table + ); + """ + query_columns = """ + SELECT column_name FROM information_schema.columns + WHERE table_schema = 'public' + AND column_name <> 'id' + AND table_name = test_table; + """ + + def execute_side_effect(query, params=None): + if query == query_exists: + return 'true' + elif query == query_columns: + return [['column1'], ['column2']] + else: + return None + + self.mock_cursor.execute.side_effect = execute_side_effect + self.mock_cursor.fetchone.return_value = [True] + self.mock_cursor.fetchall.return_value = [['column1'], ['column2']] + + table_schema = [('column1', 'VARCHAR'), ('column2', 'INTEGER')] + index_columns = [] + + PostgreSqlManager(self.postgres_settings, table_schema, index_columns, self.logger) + + assert call(['ALTER TABLE test_table ADD column1 INTEGER;', + 'ALTER TABLE test_table ADD column2 VARCHAR;']) not in self.mock_cursor.mock_calls From ff3747e79f75471f6aa3cedcbe1fd48b285f826e Mon Sep 17 00:00:00 2001 From: "petteri.kivimaki" Date: Wed, 22 Jan 2025 10:43:06 +0200 Subject: [PATCH 26/36] Update ORT config - Update path excludes. - Remove Maven-specific scope excludes. --- .ort.yml | 39 ++++++--------------------------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/.ort.yml b/.ort.yml index 14f9c51..cbd15ea 100644 --- a/.ort.yml +++ b/.ort.yml @@ -7,39 +7,12 @@ excludes: - pattern: "3RD-PARTY-NOTICES.txt" reason: "DOCUMENTATION_OF" comment: "3rd party notices." - - scopes: - - pattern: "checkstyle" - reason: "BUILD_DEPENDENCY_OF" - comment: "Packages for code styling checks (testing) only." - - - pattern: "devDependencies" - reason: "DEV_DEPENDENCY_OF" - comment: "Packages for development only." - - - pattern: "jacocoAgent" - reason: "TEST_DEPENDENCY_OF" - comment: "Packages for code coverage (testing) only." - - - pattern: "jacocoAnt" - reason: "TEST_DEPENDENCY_OF" - comment: "Packages for code coverage (testing) only." - - - pattern: "test.*" - reason: "TEST_DEPENDENCY_OF" - comment: "Packages for testing only." - - - pattern: "annotationProcessor" - reason: "DEV_DEPENDENCY_OF" - comment: "Packages for development only." - - - pattern: "compileClasspath" - reason: "DEV_DEPENDENCY_OF" - comment: "Packages for development only." - - - pattern: "compileOnly" - reason: "DEV_DEPENDENCY_OF" - comment: "Packages for development only." + - pattern: "**/tests/**" + reason: "TEST_OF" + comment: "This directory contains tests." + - pattern: "**/test_results.html" + reason: "TEST_OF" + comment: "This file contains contains test results." resolutions: rule_violations: From 1a7dd87f11450e4b5641a3d8424f127c52bad489 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 22:37:48 +0000 Subject: [PATCH 27/36] chore(deps): bump django Bumps the python-major group with 1 update in the /opendata_module directory: [django](https://github.com/django/django). Updates `django` from 3.2.20 to 4.2.18 - [Commits](https://github.com/django/django/compare/3.2.20...4.2.18) --- updated-dependencies: - dependency-name: django dependency-type: direct:production update-type: version-update:semver-major dependency-group: python-major ... Signed-off-by: dependabot[bot] --- opendata_module/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendata_module/setup.py b/opendata_module/setup.py index d6d8014..918e5e6 100644 --- a/opendata_module/setup.py +++ b/opendata_module/setup.py @@ -27,7 +27,7 @@ requirements = [ 'setuptools==75.2.0', 'dill==0.3.9', - 'django==3.2.20', + 'django==4.2.18', 'pymongo==4.10.1', 'pyyaml==6.0.2', 'psycopg2==2.9.10', From 3a91366ca553103bd01d33ac3e01b483b0301e4b Mon Sep 17 00:00:00 2001 From: Jevgeni Krutov Date: Tue, 28 Jan 2025 15:59:31 +0200 Subject: [PATCH 28/36] chore(deps): Update django to 4.2.18; remove deprecated option (#160) --- opendata_module/opmon_opendata/django_settings.py | 1 - opendata_module/opmon_opendata/tests/test_settings.py | 1 - 2 files changed, 2 deletions(-) diff --git a/opendata_module/opmon_opendata/django_settings.py b/opendata_module/opmon_opendata/django_settings.py index 216a1ad..071db1b 100644 --- a/opendata_module/opmon_opendata/django_settings.py +++ b/opendata_module/opmon_opendata/django_settings.py @@ -146,7 +146,6 @@ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True -USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) diff --git a/opendata_module/opmon_opendata/tests/test_settings.py b/opendata_module/opmon_opendata/tests/test_settings.py index f90eeb0..6633086 100644 --- a/opendata_module/opmon_opendata/tests/test_settings.py +++ b/opendata_module/opmon_opendata/tests/test_settings.py @@ -27,5 +27,4 @@ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True -USE_L10N = True USE_TZ = True From 94a13474b7e5792ac8222e9abc07161641317d9a Mon Sep 17 00:00:00 2001 From: Jevgeni Krutov Date: Tue, 28 Jan 2025 16:18:49 +0200 Subject: [PATCH 29/36] feat: Prepare opendata_collector_module for release (#161) * feat: Prepare opendata_collector_module for release fix type checking error bump vcrpy test requirement enable od-collector tests for github actions bump lib versions fix cron example fail under 60pct of coverage enable dependabot for opendata_collector_module refs: OPMONDEV-191 --- .github/dependabot.yml | 2 +- .github/workflows/run-tests.yml | 40 +++++++++---------- .../etc/opendata_sources_settings.yaml | 2 +- .../mongodb_manager.py | 2 +- opendata_collector_module/setup.py | 6 +-- .../test_requirements.txt | 2 +- opendata_collector_module/tox.ini | 2 +- run_tests.sh | 34 ---------------- 8 files changed, 28 insertions(+), 62 deletions(-) delete mode 100755 run_tests.sh diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 21caf37..5c5a710 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,7 +8,7 @@ updates: - "/anonymizer_module" - "/collector_module" - "/corrector_module" - #- "/opendata_collector_module" + - "/opendata_collector_module" - "/opendata_module" - "/reports_module" schedule: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 547edbb..c1c03d1 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -81,26 +81,26 @@ jobs: run: pip install tox - name: Run tox tests run: tox - # Test-Opendata-Collector: - # name: OpenData Collector Tests - # runs-on: ubuntu-22.04 - # defaults: - # run: - # working-directory: ./opendata_collector_module - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3.8 - # uses: actions/setup-python@v5 - # with: - # python-version: '3.8' - # cache: 'pip' - # cache-dependency-path: ./opendata_collector_module/setup.py - # - name: Install dependencies - # run: pip install -r test_requirements.txt - # - name: Install tox - # run: pip install tox - # - name: Run tox tests - # run: tox + Test-Opendata-Collector: + name: OpenData Collector Tests + runs-on: ubuntu-22.04 + defaults: + run: + working-directory: ./opendata_collector_module + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: '3.8' + cache: 'pip' + cache-dependency-path: ./opendata_collector_module/setup.py + - name: Install dependencies + run: pip install -r test_requirements.txt + - name: Install tox + run: pip install tox + - name: Run tox tests + run: tox Test-Reports: name: Reports Tests runs-on: ubuntu-22.04 diff --git a/opendata_collector_module/etc/opendata_sources_settings.yaml b/opendata_collector_module/etc/opendata_sources_settings.yaml index 0e10156..4f0a46d 100644 --- a/opendata_collector_module/etc/opendata_sources_settings.yaml +++ b/opendata_collector_module/etc/opendata_sources_settings.yaml @@ -16,7 +16,7 @@ # url: https://example1:/api/harvest # limit: 2000 # from_dt: '2022-12-05T00:00:00' - # until_dt: '2023-05-01T00:00:00 + # until_dt: '2023-05-01T00:00:00' # opendata_api_tz_offset: '+0200' # verify_ssl: False # diff --git a/opendata_collector_module/metrics_opendata_collector/mongodb_manager.py b/opendata_collector_module/metrics_opendata_collector/mongodb_manager.py index 53d91e0..2149bc2 100644 --- a/opendata_collector_module/metrics_opendata_collector/mongodb_manager.py +++ b/opendata_collector_module/metrics_opendata_collector/mongodb_manager.py @@ -47,7 +47,7 @@ def __init__(self, settings: dict, instance_id: str) -> None: 'tls': bool(settings['mongodb'].get('tls')), 'tlsCAFile': settings['mongodb'].get('tls-ca-file'), } - self.client = MongoClient(self.get_mongo_uri(settings), **connect_args) + self.client: MongoClient = MongoClient(self.get_mongo_uri(settings), **connect_args) self.query_db = self.client[f'query_db_{xroad}'] self.state_db = self.client[f'opendata_collector_state_{xroad}'] diff --git a/opendata_collector_module/setup.py b/opendata_collector_module/setup.py index 90922c8..983522e 100644 --- a/opendata_collector_module/setup.py +++ b/opendata_collector_module/setup.py @@ -25,10 +25,10 @@ from setuptools import setup requirements = [ - 'setuptools==75.1.0', - 'pymongo==4.9.1', + 'setuptools==75.3.0', + 'pymongo==4.10.1', 'requests==2.32.3', - 'tqdm==4.66.5', + 'tqdm==4.67.1', 'pyyaml==6.0.2', 'urllib3==2.2.3', ] diff --git a/opendata_collector_module/test_requirements.txt b/opendata_collector_module/test_requirements.txt index cb70b1c..0caab98 100644 --- a/opendata_collector_module/test_requirements.txt +++ b/opendata_collector_module/test_requirements.txt @@ -4,4 +4,4 @@ pytest-mock pytest-ruff pytest-html ruff -vcrpy==1.5.2 +vcrpy==6.0.2 diff --git a/opendata_collector_module/tox.ini b/opendata_collector_module/tox.ini index 7831221..a0f3e25 100644 --- a/opendata_collector_module/tox.ini +++ b/opendata_collector_module/tox.ini @@ -7,7 +7,7 @@ deps = -r test_requirements.txt install_command=pip install --only-binary=numpy {opts} numpy {packages} commands = coverage run --source metrics_opendata_collector -m pytest metrics_opendata_collector/ - coverage report --include=metrics_opendata_collector/* + coverage report --include=metrics_opendata_collector/* --fail-under=60 coverage html -d ../htmlcov/opendata_collector_module --include=metrics_opendata_collector/* [testenv:lint] diff --git a/run_tests.sh b/run_tests.sh deleted file mode 100755 index a17f455..0000000 --- a/run_tests.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# pip install pytest -# pip install ruff - -export REPORTS_RUN_ENV="REPORTS_TEST" - -#set -e - -# Run Pep8 Tests -#ruff check analysis_module -#ruff check analysis_ui_module -ruff check anonymizer_module -ruff check collector_module -ruff check corrector_module -ruff check opendata_collector_module -ruff check opendata_module -ruff check reports_module - -## Run Tests -#pytest --cache-clear --ruff analysis_module --html=analysis_module/test_results.html --self-contained-html -#pytest --cache-clear --ruff analysis_ui_module --html=analysis_ui_module/test_results.html --self-contained-html -pytest --cache-clear --ruff anonymizer_module --html=anonymizer_module/test_results.html --self-contained-html -pytest --cache-clear --ruff collector_module --html=collector_module/test_results.html --self-contained-html -pytest --cache-clear --ruff corrector_module --html=corrector_module/test_results.html --self-contained-html -#pytest --cache-clear --ruff opendata_collector_module --html=opendata_collector_module/test_results.html --self-contained-html -pytest --cache-clear --ruff opendata_module --html=opendata_module/test_results.html --self-contained-html -pytest --cache-clear --ruff reports_module --html=reports_module/test_results.html --self-contained-html - -# Run CI Tests -if [[ $1 == 'CI' ]] ; then - echo "Test integration" - python3 -m pytest integration_tests -fi From e824ecd5f2661916bb1636e69a42266ae084e060 Mon Sep 17 00:00:00 2001 From: Jevgeni Krutov Date: Wed, 29 Jan 2025 11:48:11 +0200 Subject: [PATCH 30/36] chore: ignore dependencies by dependabot; bump some dependency versions --- .github/dependabot.yml | 9 +++++++++ anonymizer_module/setup.py | 2 +- collector_module/setup.py | 4 ++-- corrector_module/setup.py | 2 +- opendata_module/setup.py | 2 +- reports_module/setup.py | 4 ++-- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5c5a710..f923680 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -58,6 +58,15 @@ updates: - dependency-name: "rpds-py" versions: - ">= 0.21.0" + - dependency-name: "vcrpy" + versions: + - ">= 7.0.0" + - dependency-name: "setuptools" + versions: + - ">= 75.4.0" + - dependency-name: "urllib3" + versions: + - ">= 2.3.0" - package-ecosystem: "github-actions" directory: "/.github/workflows" diff --git a/anonymizer_module/setup.py b/anonymizer_module/setup.py index 63afecd..276bc6a 100644 --- a/anonymizer_module/setup.py +++ b/anonymizer_module/setup.py @@ -25,7 +25,7 @@ from setuptools import setup, find_packages requirements = [ - 'setuptools==75.2.0', + 'setuptools==75.3.0', 'pymongo==4.10.1', 'pyyaml==6.0.2', 'psycopg2==2.9.10', diff --git a/collector_module/setup.py b/collector_module/setup.py index 10a1efe..41705b2 100644 --- a/collector_module/setup.py +++ b/collector_module/setup.py @@ -25,10 +25,10 @@ from setuptools import setup requirements = [ - 'setuptools==75.2.0', + 'setuptools==75.3.0', 'pymongo==4.10.1', 'requests==2.32.3', - 'tqdm==4.66.5', + 'tqdm==4.67.1', 'pyyaml==6.0.2', 'urllib3==2.2.3', ] diff --git a/corrector_module/setup.py b/corrector_module/setup.py index 96214f5..1467d21 100644 --- a/corrector_module/setup.py +++ b/corrector_module/setup.py @@ -25,7 +25,7 @@ from setuptools import setup requirements = [ - 'setuptools==75.2.0', + 'setuptools==75.3.0', 'pymongo==4.10.1', 'pyyaml==6.0.2', ] diff --git a/opendata_module/setup.py b/opendata_module/setup.py index 918e5e6..32cde42 100644 --- a/opendata_module/setup.py +++ b/opendata_module/setup.py @@ -25,7 +25,7 @@ from setuptools import setup, find_packages requirements = [ - 'setuptools==75.2.0', + 'setuptools==75.3.0', 'dill==0.3.9', 'django==4.2.18', 'pymongo==4.10.1', diff --git a/reports_module/setup.py b/reports_module/setup.py index c8dc39c..505ff41 100644 --- a/reports_module/setup.py +++ b/reports_module/setup.py @@ -29,8 +29,8 @@ requirements = [ 'markupsafe==2.1.5', - 'Jinja2==3.1.4', - 'matplotlib==3.1.2', + 'Jinja2==3.1.5', + 'matplotlib==3.7.5', 'pandas==2.0.3', 'weasyprint==61.2', 'Pillow==10.4.0', From b0259ebb7daf0e9cadda9ba735f817c575aaddac Mon Sep 17 00:00:00 2001 From: Jevgeni Krutov Date: Thu, 30 Jan 2025 10:31:44 +0200 Subject: [PATCH 31/36] chore: bump version to 1.4.0 Refs: OPMONDEV-190 --- anonymizer_module/opmon_anonymizer/__init__.py | 2 +- collector_module/opmon_collector/__init__.py | 2 +- corrector_module/opmon_corrector/__init__.py | 2 +- .../metrics_opendata_collector/__init__.py | 2 +- opendata_module/opmon_opendata/__init__.py | 2 +- reports_module/opmon_reports/__init__.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/anonymizer_module/opmon_anonymizer/__init__.py b/anonymizer_module/opmon_anonymizer/__init__.py index b2d8653..b02576c 100644 --- a/anonymizer_module/opmon_anonymizer/__init__.py +++ b/anonymizer_module/opmon_anonymizer/__init__.py @@ -22,4 +22,4 @@ # THE SOFTWARE. # -__version__ = '1.3.0' +__version__ = '1.4.0' diff --git a/collector_module/opmon_collector/__init__.py b/collector_module/opmon_collector/__init__.py index b2d8653..b02576c 100644 --- a/collector_module/opmon_collector/__init__.py +++ b/collector_module/opmon_collector/__init__.py @@ -22,4 +22,4 @@ # THE SOFTWARE. # -__version__ = '1.3.0' +__version__ = '1.4.0' diff --git a/corrector_module/opmon_corrector/__init__.py b/corrector_module/opmon_corrector/__init__.py index 063b589..9778996 100644 --- a/corrector_module/opmon_corrector/__init__.py +++ b/corrector_module/opmon_corrector/__init__.py @@ -22,7 +22,7 @@ # THE SOFTWARE. # -__version__ = '1.3.0' +__version__ = '1.4.0' SECURITY_SERVER_TYPE_CLIENT = 'client' SECURITY_SERVER_TYPE_PRODUCER = 'producer' diff --git a/opendata_collector_module/metrics_opendata_collector/__init__.py b/opendata_collector_module/metrics_opendata_collector/__init__.py index b2d8653..b02576c 100644 --- a/opendata_collector_module/metrics_opendata_collector/__init__.py +++ b/opendata_collector_module/metrics_opendata_collector/__init__.py @@ -22,4 +22,4 @@ # THE SOFTWARE. # -__version__ = '1.3.0' +__version__ = '1.4.0' diff --git a/opendata_module/opmon_opendata/__init__.py b/opendata_module/opmon_opendata/__init__.py index b2d8653..b02576c 100644 --- a/opendata_module/opmon_opendata/__init__.py +++ b/opendata_module/opmon_opendata/__init__.py @@ -22,4 +22,4 @@ # THE SOFTWARE. # -__version__ = '1.3.0' +__version__ = '1.4.0' diff --git a/reports_module/opmon_reports/__init__.py b/reports_module/opmon_reports/__init__.py index b2d8653..b02576c 100644 --- a/reports_module/opmon_reports/__init__.py +++ b/reports_module/opmon_reports/__init__.py @@ -22,4 +22,4 @@ # THE SOFTWARE. # -__version__ = '1.3.0' +__version__ = '1.4.0' From 4b8c791c27ada9f9960b8728b1c7627eada4e820 Mon Sep 17 00:00:00 2001 From: Jevgeni Krutov Date: Thu, 30 Jan 2025 16:46:42 +0200 Subject: [PATCH 32/36] chore: dependabot - ignore pymongo >= 4.11 because it requires python >= 3.9 --- .github/dependabot.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f923680..3fd22e5 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -67,6 +67,9 @@ updates: - dependency-name: "urllib3" versions: - ">= 2.3.0" + - dependency-name: "pymongo" + versions: + - ">= 4.11.0" - package-ecosystem: "github-actions" directory: "/.github/workflows" From 81f31a5407758b5c9ce1556d80157ee39d5ef02e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 22:42:04 +0000 Subject: [PATCH 33/36] chore(deps): bump django Bumps the python-minor-patch group with 1 update in the /opendata_module directory: [django](https://github.com/django/django). Updates `django` from 4.2.18 to 4.2.19 - [Commits](https://github.com/django/django/compare/4.2.18...4.2.19) --- updated-dependencies: - dependency-name: django dependency-type: direct:production update-type: version-update:semver-patch dependency-group: python-minor-patch ... Signed-off-by: dependabot[bot] --- opendata_module/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendata_module/setup.py b/opendata_module/setup.py index 32cde42..d403e7c 100644 --- a/opendata_module/setup.py +++ b/opendata_module/setup.py @@ -27,7 +27,7 @@ requirements = [ 'setuptools==75.3.0', 'dill==0.3.9', - 'django==4.2.18', + 'django==4.2.19', 'pymongo==4.10.1', 'pyyaml==6.0.2', 'psycopg2==2.9.10', From 203671999b959845e77ea9036117ba15b364a442 Mon Sep 17 00:00:00 2001 From: Jevgeni Krutov Date: Fri, 7 Feb 2025 14:49:19 +0200 Subject: [PATCH 34/36] fix: exclude backslashes from initially generated passwords Refs: OPMONDEV-192 --- collector_module/opmon_mongodb_maintenance/create_users.py | 4 +++- .../opmon_mongodb_maintenance/tests/test_create_users.py | 6 ++++++ .../opmon_postgresql_maintenance/create_users.py | 4 +++- .../opmon_postgresql_maintenance/tests/test_create_users.py | 5 +++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/collector_module/opmon_mongodb_maintenance/create_users.py b/collector_module/opmon_mongodb_maintenance/create_users.py index 2f80bed..5a3709b 100644 --- a/collector_module/opmon_mongodb_maintenance/create_users.py +++ b/collector_module/opmon_mongodb_maintenance/create_users.py @@ -115,8 +115,10 @@ def _generate_password(): Password contains lower-case, upper-case, numbers and special characters. Based on best-practice recipe from https://docs.python.org/3/library/secrets.html. + Some characters are avoided because they cause issues in a .yaml file, even after being escaped. """ - alphabet = string.ascii_letters + string.digits + string.punctuation + avoid_chars = "\\" + alphabet = "".join(c for c in (string.ascii_letters + string.digits + string.punctuation) if c not in avoid_chars) while True: password = ''.join(secrets.choice(alphabet) for _ in range(12)) if (any(c.islower() for c in password) diff --git a/collector_module/opmon_mongodb_maintenance/tests/test_create_users.py b/collector_module/opmon_mongodb_maintenance/tests/test_create_users.py index 2a5a72b..d09e6fc 100644 --- a/collector_module/opmon_mongodb_maintenance/tests/test_create_users.py +++ b/collector_module/opmon_mongodb_maintenance/tests/test_create_users.py @@ -134,6 +134,12 @@ def test_opmon_user_generation_without_passwords(mocker): assert to_find in passwords.keys() +def test_generated_password_has_no_backslashes(): + backslash_char = "\\" + for _ in range(1000): + password = create_users._generate_password() + assert backslash_char not in password + def test_password_escaping(): password = """:/foo'"\\_*{}[]''""" escaped_password = create_users._escape_password(password) diff --git a/opendata_module/opmon_postgresql_maintenance/create_users.py b/opendata_module/opmon_postgresql_maintenance/create_users.py index b390bcb..c6ad81d 100644 --- a/opendata_module/opmon_postgresql_maintenance/create_users.py +++ b/opendata_module/opmon_postgresql_maintenance/create_users.py @@ -250,8 +250,10 @@ def _generate_password() -> str: Password contains lower-case, upper-case, numbers and special characters. Based on best-practice recipe from https://docs.python.org/3/library/secrets.html. + Some characters are avoided because they cause issues in a .yaml file, even after being escaped. """ - alphabet = string.ascii_letters + string.digits + string.punctuation + avoid_chars = "\\" + alphabet = "".join(c for c in (string.ascii_letters + string.digits + string.punctuation) if c not in avoid_chars) while True: password = ''.join(secrets.choice(alphabet) for i in range(12)) if (any(c.islower() for c in password) diff --git a/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py b/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py index 4c226b1..c96a0ba 100644 --- a/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py +++ b/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py @@ -160,6 +160,11 @@ def test_grant_priviledges(mocker): for call_args_list in cursor.execute.call_args_list: assert call_args_list.args[0].startswith('GRANT') +def test_generated_password_has_no_backslashes(): + backslash_char = "\\" + for _ in range(1000): + password = create_users._generate_password() + assert backslash_char not in password def test_password_escaping(): password = """:/foo'"\\_*{}[]''""" From 1ab8c4b3057cc4cae331b3cbf0c33c8e838faec7 Mon Sep 17 00:00:00 2001 From: Jevgeni Krutov Date: Fri, 7 Feb 2025 17:38:48 +0200 Subject: [PATCH 35/36] fix according to CR --- .../opmon_mongodb_maintenance/create_users.py | 16 +++++++++++++--- .../tests/test_create_users.py | 7 +++---- .../create_users.py | 18 ++++++++++++++---- .../tests/test_create_users.py | 7 +++---- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/collector_module/opmon_mongodb_maintenance/create_users.py b/collector_module/opmon_mongodb_maintenance/create_users.py index 5a3709b..c24ba30 100644 --- a/collector_module/opmon_mongodb_maintenance/create_users.py +++ b/collector_module/opmon_mongodb_maintenance/create_users.py @@ -109,16 +109,26 @@ def _print_users(passwords: dict): [print(f'{user:<{width}}| {password} | {_escape_password(password)}') for user, password in passwords.items()] +def _get_password_character_set(): + """ + Generate a set of characters from which to compose a password. + Some characters are avoided because they cause issues in a .yaml file, even after being escaped. + """ + avoid_chars = "\\" + allowed_character_set = "".join( + c for c in (string.ascii_letters + string.digits + string.punctuation) + if c not in avoid_chars + ) + return allowed_character_set + def _generate_password(): """ Generate a random 12 character password. Password contains lower-case, upper-case, numbers and special characters. Based on best-practice recipe from https://docs.python.org/3/library/secrets.html. - Some characters are avoided because they cause issues in a .yaml file, even after being escaped. """ - avoid_chars = "\\" - alphabet = "".join(c for c in (string.ascii_letters + string.digits + string.punctuation) if c not in avoid_chars) + alphabet = _get_password_character_set() while True: password = ''.join(secrets.choice(alphabet) for _ in range(12)) if (any(c.islower() for c in password) diff --git a/collector_module/opmon_mongodb_maintenance/tests/test_create_users.py b/collector_module/opmon_mongodb_maintenance/tests/test_create_users.py index d09e6fc..f91d8d5 100644 --- a/collector_module/opmon_mongodb_maintenance/tests/test_create_users.py +++ b/collector_module/opmon_mongodb_maintenance/tests/test_create_users.py @@ -134,11 +134,10 @@ def test_opmon_user_generation_without_passwords(mocker): assert to_find in passwords.keys() -def test_generated_password_has_no_backslashes(): +def test_password_character_set(): backslash_char = "\\" - for _ in range(1000): - password = create_users._generate_password() - assert backslash_char not in password + allowed_chars = create_users._get_password_character_set() + assert backslash_char not in allowed_chars def test_password_escaping(): password = """:/foo'"\\_*{}[]''""" diff --git a/opendata_module/opmon_postgresql_maintenance/create_users.py b/opendata_module/opmon_postgresql_maintenance/create_users.py index c6ad81d..9b3c0ae 100644 --- a/opendata_module/opmon_postgresql_maintenance/create_users.py +++ b/opendata_module/opmon_postgresql_maintenance/create_users.py @@ -244,16 +244,26 @@ def _print_users(passwords: Dict[str, str]) -> None: [print(f'{user:<{width}}| {password} | {_escape_password(password)}') for user, password in passwords.items()] -def _generate_password() -> str: +def _get_password_character_set(): + """ + Generate a set of characters from which to compose a password. + Some characters are avoided because they cause issues in a .yaml file, even after being escaped. + """ + avoid_chars = "\\" + allowed_character_set = "".join( + c for c in (string.ascii_letters + string.digits + string.punctuation) + if c not in avoid_chars + ) + return allowed_character_set + +def _generate_password(): """ Generate a random 12 character password. Password contains lower-case, upper-case, numbers and special characters. Based on best-practice recipe from https://docs.python.org/3/library/secrets.html. - Some characters are avoided because they cause issues in a .yaml file, even after being escaped. """ - avoid_chars = "\\" - alphabet = "".join(c for c in (string.ascii_letters + string.digits + string.punctuation) if c not in avoid_chars) + alphabet = _get_password_character_set() while True: password = ''.join(secrets.choice(alphabet) for i in range(12)) if (any(c.islower() for c in password) diff --git a/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py b/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py index c96a0ba..ce81fb1 100644 --- a/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py +++ b/opendata_module/opmon_postgresql_maintenance/tests/test_create_users.py @@ -160,11 +160,10 @@ def test_grant_priviledges(mocker): for call_args_list in cursor.execute.call_args_list: assert call_args_list.args[0].startswith('GRANT') -def test_generated_password_has_no_backslashes(): +def test_password_character_set(): backslash_char = "\\" - for _ in range(1000): - password = create_users._generate_password() - assert backslash_char not in password + allowed_chars = create_users._get_password_character_set() + assert backslash_char not in allowed_chars def test_password_escaping(): password = """:/foo'"\\_*{}[]''""" From 7a5244e96f07b916670fc9644ca8183e2078643e Mon Sep 17 00:00:00 2001 From: Jevgeni Krutov Date: Mon, 10 Feb 2025 18:15:13 +0200 Subject: [PATCH 36/36] fix: Fix structure of JSON returned by 'daily_logs' endpoint Refs: OPMONDEV-193 --- opendata_module/opmon_opendata/api/helpers.py | 8 ++- .../opmon_opendata/tests/test_helpers.py | 72 +++++++++++++++++++ 2 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 opendata_module/opmon_opendata/tests/test_helpers.py diff --git a/opendata_module/opmon_opendata/api/helpers.py b/opendata_module/opmon_opendata/api/helpers.py index dfff756..cccdeff 100644 --- a/opendata_module/opmon_opendata/api/helpers.py +++ b/opendata_module/opmon_opendata/api/helpers.py @@ -60,13 +60,15 @@ def generate_ndjson_stream(postgres: PostgreSQL_LogManager, date: datetime, with GzipFile(fileobj=gzip_buffer, mode='wb') as gzip_file: count = 0 buffer_size = settings['opendata'].get('stream-buffer-lines', DEFAULT_STREAM_BUFFER_LINES) - for row in data_cursor: + gzip_file.write(b'[\n') + for idx, row in enumerate(data_cursor): + if idx > 0: + gzip_file.write(b',\n') json_obj = {column_name: row[column_idx] for column_idx, column_name in enumerate(column_names)} # Must manually convert Postgres dates to string to be compatible with JSON format for date_column in date_columns: json_obj[date_column] = datetime.strftime(json_obj[date_column], '%Y-%m-%d') gzip_file.write(bytes(json.dumps(json_obj), 'utf-8')) - gzip_file.write(b'\n') count += 1 if count == buffer_size: count = 0 @@ -78,6 +80,8 @@ def generate_ndjson_stream(postgres: PostgreSQL_LogManager, date: datetime, # Empty buffer to free memory gzip_buffer.truncate(0) gzip_buffer.seek(0) + gzip_file.write(b'\n]') + # Final data gets written when GzipFile is closed yield gzip_buffer.getvalue() diff --git a/opendata_module/opmon_opendata/tests/test_helpers.py b/opendata_module/opmon_opendata/tests/test_helpers.py new file mode 100644 index 0000000..79b885c --- /dev/null +++ b/opendata_module/opmon_opendata/tests/test_helpers.py @@ -0,0 +1,72 @@ +# +# The MIT License +# Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) +# Copyright (c) 2017-2020 Estonian Information System Authority (RIA) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +import gzip +import json +import io +import pytest + +from datetime import date, datetime +from opmon_opendata.api import helpers + + +SETTINGS = { + 'opendata': {} +} + + +@pytest.fixture +def postgres(mocker): + return mocker.Mock() + + +@pytest.mark.parametrize( + "column_types, data_cursor, expected_output", + [ + # Test case: Multiple results + ( + [('foo', 'integer'), ('bar', 'character varying'), ('baz', 'date')], + [('1', 'aaa', date(2025, 1, 1)), ('2', 'bbb', date(2025, 2, 2))], + [{'foo': '1', 'bar': 'aaa', 'baz': '2025-01-01'}, + {'foo': '2', 'bar': 'bbb', 'baz': '2025-02-02'}] + ), + # Test case: No results + ( + [('foo', 'integer')], + [], + [] + ) + ] +) +def test_generate_ndjson_stream_creates_correct_json(postgres, column_types, data_cursor, expected_output): + postgres.get_column_names_and_types.return_value = column_types + postgres.get_data_cursor.return_value = data_cursor + gzipped_file_stream = helpers.generate_ndjson_stream(postgres, datetime.now(), [], [], [], SETTINGS) + decompressed_data = decompress_gzip(gzipped_file_stream) + assert json.loads(decompressed_data) == expected_output + +def decompress_gzip(gzipped_file_stream): + compressed_data = b"".join(gzipped_file_stream) + with gzip.GzipFile(fileobj=io.BytesIO(compressed_data), mode="rb") as f: + decompressed_data = f.read().decode() + return decompressed_data