Skip to content

Logging TypeError within ssl_context_factory.py #53

@dpandya-cisco

Description

@dpandya-cisco

Summary

The conjur-api-python library encounters a TypeError due to an incorrect logging format specifier in conjur_api/http/ssl/ssl_context_factory.py. The %d specifier is used for os_type, which is not a numeric type, leading to logging errors in the specific environment described below.

Steps to Reproduce

  1. Setup an environment to run in a Docker container on GitHub Actions using ubuntu-latest.
  2. Install the conjur-api-python library.
  3. Execute a function that involves SSL context creation, such as authentication or API requests.
  4. Observe the log output for errors related to logging format.

Expected Results

The logging statement should correctly format the os_type using %s, allowing for clean log output without errors.

Actual Results

The logging statement results in a TypeError: %d format: a real number is required, not OSTypes. This error appears in logs and affects log clarity. Sample log output below:

Failed to log following message properly: Creating SSLContext from OS TrustStore for '%d'
TypeError: %d format: a real number is required, not OSTypes
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/logging/__init__.py", line 998, in format
    return fmt.format(record)
           ~~~~~~~~~~^^^^^^^^
  File "/usr/local/lib/python3.13/logging/__init__.py", line 711, in format
    record.message = record.getMessage()
                     ~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/logging/__init__.py", line 400, in getMessage
    msg = msg % self.args
          ~~~~^~~~~~~~~~~
TypeError: %d format: a real number is required, not OSTypes

Reproducible

  • [✓] Always
  • Sometimes
  • Non-Reproducible

Version/Tag number

conjur-api-python library version: v0.1.3
Python version: 3.13
Docker image: docker.io/library/python:3.13.2-slim-bullseye@sha256:c527a33e5265d0f830994d1b3237d38840a7b7986a8b9374a4b941ac34048190

Environment setup

  • Running in a Docker container on GitHub Actions using ubuntu-latest.
  • Python version 3.13 is used within the Docker container.
  • The environment includes AWS integration for resource access.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions