added patches-and-logs

This commit is contained in:
Oscar Krause 2025-03-25 20:47:23 +01:00
parent d4751754e8
commit 002dac1641
3 changed files with 1359 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,50 @@
diff --git a/root/lease_single_controller.py.bak b/var/lib/docker/overlay2/76a66d3e0c3f9813efcb469f14f3a066889d94af2e75fc8523fb651835812418/merged/venv/lib/python3.12/site-packages/nls_services_lease/controllers/lease_single_controller.py
index c042d03..fba9c0b 100755
--- a/root/lease_single_controller.py.bak
+++ b/var/lib/docker/overlay2/76a66d3e0c3f9813efcb469f14f3a066889d94af2e75fc8523fb651835812418/merged/venv/lib/python3.12/site-packages/nls_services_lease/controllers/lease_single_controller.py
@@ -6,6 +6,7 @@ from datetime import datetime
from flask import make_response
from nls_common_utils import SemanticLogger
import logging
+from pprint import pformat
from nls_common_utils import Config
from werkzeug.http import dump_cookie
from nls_core_common import CommonManager
@@ -22,6 +23,10 @@ from flask import send_file
from nls_services_lease import util
import json
+debugger = logging.getLogger()
+debugger.setLevel(logging.DEBUG)
+debugger.debug("HELLO")
+
supported_endpoints_on_secondary = ['logins_controller',
'/service_instance_manager/v1.nls_services_service_instance_controllers_ip_address_controller_set_ip_address',
'/service_instance_manager/v1.nls_services_service_instance_controllers_va_manager_controller_restart_service',
@@ -177,6 +182,7 @@ def config_token(config_token_request):
:rtype: dict
"""
+ debugger.debug("CONFIG-TOKEN called")
try:
if should_redirect(request.endpoint, request.method):
data = request.get_json(silent=True)
@@ -227,7 +233,8 @@ def config_token(config_token_request):
assert valid
# allows optional fields in request not specified in api spec
body = data
-
+ debugger.debug("INFO")
+ debugger.debug(pformat(json.dumps(body)))
auth = None
event_args = {
'path': path_args,
@@ -246,6 +253,8 @@ def config_token(config_token_request):
_commonManager.set_service_instance_context(event_args);
response_headers = None
data = _leaseSingle.config_token(event_args)
+ debugger.info("DATA")
+ debugger.debug(pformat(json.dumps(data)))
if isinstance(data, tuple) and len(data)==2:
data, response_headers = data
if data is not None and 'config_token' == 'generate_license':

View File

@ -0,0 +1,76 @@
diff --git a/license_file_processor.py.bak b/var/lib/docker/overlay2/76a66d3e0c3f9813efcb469f14f3a066889d94af2e75fc8523fb651835812418/merged/venv/lib/python3.12/site-packages/nls_dal_file_common/license_file_processor.py
index 0619733..6a257ec 100755
--- a/license_file_processor.py.bak
+++ b/var/lib/docker/overlay2/76a66d3e0c3f9813efcb469f14f3a066889d94af2e75fc8523fb651835812418/merged/venv/lib/python3.12/site-packages/nls_dal_file_common/license_file_processor.py
@@ -1,4 +1,8 @@
import base64
+
+import logging
+from pprint import pformat
+
from binascii import Error as BinAsciiError
from json import JSONDecodeError
from json import dumps as json_dumps
@@ -20,6 +24,9 @@ from .processor_util import ProcessorUtil
log = SemanticLogger.get_logger(__name__)
+debugger = logging.getLogger()
+debugger.setLevel(logging.DEBUG)
+debugger.info("Hello")
class LicenseFileProcessor:
@@ -110,15 +117,29 @@ class LicenseFileProcessor:
def read_license_payload(self, license_container_str, private_key_string):
try:
+ debugger.info("license_container_str (raw)")
+ debugger.debug(pformat(license_container_str))
+
# Decode whole string object into LicenseFileContainer object
license_container_str = base64.b64decode(license_container_str.encode('utf-8')).decode('utf-8')
license_file_container = LicenseFileContainer.from_dict(JsonUtils.from_json(license_container_str))
+ debugger.info("license_container_str (str)")
+ debugger.debug(pformat(license_container_str))
# Decode preamble and payload
encrypted_payload_str = base64.b64decode(license_file_container.payload.encode('utf-8')).decode('utf-8')
+ debugger.info("encrypted_payload_str")
+ debugger.debug(pformat(encrypted_payload_str))
private_key = PrivateKey.from_data(private_key_string)
+ debugger.info("private_key")
+ debugger.debug(pformat(private_key_string))
+ debugger.debug(pformat(private_key))
license_file_decoded = private_key.decrypt_aes(encrypted_payload_str)
+ debugger.info("license_file_decoded")
+ debugger.debug(pformat(license_file_decoded))
payload = LicenseFilePayload.from_dict(JsonUtils.from_json(license_file_decoded))
+ debugger.info("payload")
+ debugger.debug(pformat(payload))
# Decode product mapping data
product_mapping_token = license_file_container.preamble.product_mapping_token
@@ -129,16 +150,22 @@ class LicenseFileProcessor:
decrypted_product_mapping_token = private_key.decrypt_aes(encrypted_product_mapping_token)
product_mapping_token = \
ProductMappingFileContainer.from_dict(JsonUtils.from_json(decrypted_product_mapping_token))
+ debugger.debug(pformat(product_mapping_token))
# Api Key preamble
api_key_models = self._get_api_key_preamble(license_file_container, private_key_string)
+ debugger.debug(pformat(api_key_models))
# Cert response preamble
dls_certificate_token = self._get_dls_certificate_token_preamble(license_file_container, private_key_string)
+ debugger.debug(pformat(dls_certificate_token))
# Feature display mapping token
dls_feat_display_map_token = \
self._get_dls_feature_display_mapping_token(license_file_container, private_key_string)
+
+ debugger.info("CUSTOM BREAK")
+ raise Excpetion("BREAK HERE")
except (UnicodeDecodeError, BinAsciiError) as be:
log.exception(f'Error processing license file, invalid license file: {be}')
raise BadRequestError('Invalid license file format') from be