Skip to content

Commit

Permalink
RHINENG-14214: log msg when archive size exceeds limit_2 (#407)
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoxue Wang <[email protected]>
  • Loading branch information
JoySnow authored Jan 10, 2025
1 parent 761a117 commit 055cb38
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/puptoo/process/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ def validate_size(path, extra):
extra["request_id"]
)
# TODO: actively reject payloads that exceed our configured max size
# err_msg = f"Archive exceeds unextracted file limit of {config.MAX_EXTRACTED_SIZE}"
# raise Exception(err_msg)
elif total_size >= int(config.MAX_EXTRACTED_SIZE_L2):
# Request for debugging usage in insights-engine
logger.info(
"Unpacked archive exceeds extracted file size limit of %s (but within limit %s), request_id: %s",
config.MAX_EXTRACTED_SIZE_L2,
config.MAX_EXTRACTED_SIZE,
extra["request_id"]
)


@contextmanager
Expand Down Expand Up @@ -83,8 +89,9 @@ def extract(msg, extra, remove=True):
'bios_uuid', 'ip_addresses', 'mac_addresses', 'fqdn'
]


def validateCanonicalFacts(facts):
if (all(key in facts for key in PROVIDER)
or not any(key in facts for key in PROVIDER)) and any(key in facts for key in FACTS_EXCEPT_PROVIDER):
or not any(key in facts for key in PROVIDER)) and any(key in facts for key in FACTS_EXCEPT_PROVIDER):
return True
return False
1 change: 1 addition & 0 deletions src/puptoo/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def get_namespace():
FACT_EXTRACT_LOGLEVEL = os.getenv("FACT_EXTRACT_LOGLEVEL", "ERROR")
DISABLE_PROMETHEUS = True if os.getenv("DISABLE_PROMETHEUS") == "True" else False
MAX_EXTRACTED_SIZE = os.getenv("MAX_EXTRACTED_SIZE", 1000000000) # 1GB Default
MAX_EXTRACTED_SIZE_L2 = os.getenv("MAX_EXTRACTED_SIZE", 536870912) # 512MB Default
NAMESPACE = get_namespace()
HOSTNAME = os.environ.get("HOSTNAME")
BUILD_COMMIT = os.getenv("OPENSHIFT_BUILD_COMMIT", "not_in_openshift")
Expand Down

0 comments on commit 055cb38

Please sign in to comment.