Skip to content

Commit

Permalink
fix: Clean up krb self written stuff entirely (#72)
Browse files Browse the repository at this point in the history
* fix: cleanup krb stuff entirely

fix: version

* chore: update todo-counter badge

---------

Co-authored-by: GitHub Action <[email protected]>
  • Loading branch information
yv-svstl and actions-user authored Mar 4, 2025
1 parent 0f5123f commit 341a82c
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 351 deletions.
8 changes: 4 additions & 4 deletions .github/assets/todo-count-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 0 additions & 84 deletions tests/unit/test_krb_timeout.py

This file was deleted.

15 changes: 0 additions & 15 deletions tests/unit/test_parse_kinit.py

This file was deleted.

23 changes: 23 additions & 0 deletions wunderkafka/config/krb/rdkafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
from wunderkafka.config.rdkafka import RDKafkaConfig
from wunderkafka.config.generated import enums

import time
import subprocess

REQUIRES_KERBEROS = frozenset([enums.SecurityProtocol.sasl_ssl, enums.SecurityProtocol.sasl_plaintext])


def exclude_gssapi(builtin_features: str) -> str:
features = [feature.strip() for feature in builtin_features.split(',') if feature.strip() != 'sasl_gssapi']
Expand Down Expand Up @@ -45,3 +50,21 @@ def challenge_krb_arg(exc: KafkaError, config: RDKafkaConfig) -> RDKafkaConfig:
logger.warning(f'Changing builtin.features: {old} -> {new}')
config.builtin_features = new
return config


def init_kerberos(kinit_cmd: str, timeout: int = 60) -> None:
t0 = time.perf_counter()
refresh_cmd = kinit_cmd.split()
try:
subprocess.run(refresh_cmd, timeout=timeout, stdout=subprocess.PIPE, check=True)
# Will retry shortly
except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as exc:
logger.error(exc.output)
logger.error(exc.stdout)
logger.error(exc.stderr)
logger.error(f'Command: {refresh_cmd} exit error: {str(exc)}')
logger.warning("Krb not refreshed!")
else:
duration = int(1000 * (time.perf_counter() - t0))
logger.info(f'Refreshed! ({duration} ms)')

Empty file removed wunderkafka/hotfixes/__init__.py
Empty file.
121 changes: 0 additions & 121 deletions wunderkafka/hotfixes/watchdog/__init__.py

This file was deleted.

Empty file.
121 changes: 0 additions & 121 deletions wunderkafka/hotfixes/watchdog/krb/ticket.py

This file was deleted.

Loading

0 comments on commit 341a82c

Please sign in to comment.