Skip to content

Commit

Permalink
Merge pull request #793 from containers/optimize-rename-variables
Browse files Browse the repository at this point in the history
_engine is set to None or has a value
  • Loading branch information
rhatdan authored Feb 12, 2025
2 parents 5bf0e81 + 8186aed commit d22af11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions ramalama/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ def _run(parser):
help="require HTTPS and verify certificates when contacting registries",
)


def run_parser(subparsers):
parser = subparsers.add_parser("run", help="run specified AI Model as a chatbot")
_run(parser)
Expand Down
10 changes: 4 additions & 6 deletions ramalama/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,14 @@
DEFAULT_IMAGE = "quay.io/ramalama/ramalama"


_engine = ""
_engine = -1 # -1 means cached variable not set yet


def container_manager():
global _engine
if _engine != "":
if _engine == "None":
return None
if _engine != -1:
return _engine

_engine = "None"
engine = os.getenv("RAMALAMA_CONTAINER_ENGINE")
if engine is not None:
_engine = engine
Expand All @@ -51,7 +48,8 @@ def container_manager():
_engine = "docker"
return _engine

return None
_engine = None
return _engine


def is_podman_machine_running_with_krunkit():
Expand Down

0 comments on commit d22af11

Please sign in to comment.