refactor: AgentProvider.dockerfile always returns Path, never None
The convention is that every provider declares a Dockerfile location; callers that care whether the file actually exists check .is_file(). Drops all `is not None` guards on the property result.
This commit is contained in:
@@ -95,7 +95,7 @@ def fetch_current_dockerfile(slug: str) -> str:
|
||||
if override is not None:
|
||||
return override
|
||||
repo_dockerfile = get_provider("claude").dockerfile
|
||||
if repo_dockerfile is not None and repo_dockerfile.is_file():
|
||||
if repo_dockerfile.is_file():
|
||||
return repo_dockerfile.read_text()
|
||||
raise CapabilityApplyError(
|
||||
f"no per-bottle Dockerfile for {slug} and no provider Dockerfile at "
|
||||
|
||||
@@ -102,14 +102,11 @@ def resolve_plan(
|
||||
dockerfile_path = _resolve_manifest_dockerfile(provider.dockerfile, spec)
|
||||
else:
|
||||
p_dockerfile = provider_obj.dockerfile
|
||||
if p_dockerfile is not None:
|
||||
if provider.template in PROVIDER_TEMPLATES:
|
||||
image_default = provider_runtime.image
|
||||
else:
|
||||
image_default = f"bot-bottle-{provider.template}:{slug}"
|
||||
dockerfile_path = str(p_dockerfile)
|
||||
else:
|
||||
if provider.template in PROVIDER_TEMPLATES:
|
||||
image_default = provider_runtime.image
|
||||
else:
|
||||
image_default = f"bot-bottle-{provider.template}:{slug}"
|
||||
dockerfile_path = str(p_dockerfile)
|
||||
image = image_default
|
||||
derived_image = ""
|
||||
runtime_image = image
|
||||
@@ -217,7 +214,7 @@ def resolve_plan(
|
||||
)
|
||||
dockerfile_content = (
|
||||
supervise_dockerfile_path.read_text(encoding="utf-8")
|
||||
if supervise_dockerfile_path is not None and supervise_dockerfile_path.is_file()
|
||||
if supervise_dockerfile_path.is_file()
|
||||
else ""
|
||||
)
|
||||
supervise_dir = supervise_state_dir(slug)
|
||||
|
||||
@@ -122,14 +122,11 @@ def resolve_plan(
|
||||
image_default = f"bot-bottle-{provider.template}:{slug}"
|
||||
else:
|
||||
p_dockerfile = provider_obj.dockerfile
|
||||
if p_dockerfile is not None:
|
||||
agent_dockerfile_path = str(p_dockerfile)
|
||||
if provider.template in PROVIDER_TEMPLATES:
|
||||
image_default = provider_runtime.image
|
||||
else:
|
||||
image_default = f"bot-bottle-{provider.template}:{slug}"
|
||||
else:
|
||||
agent_dockerfile_path = str(p_dockerfile)
|
||||
if provider.template in PROVIDER_TEMPLATES:
|
||||
image_default = provider_runtime.image
|
||||
else:
|
||||
image_default = f"bot-bottle-{provider.template}:{slug}"
|
||||
agent_image_ref = image_default
|
||||
agent_provision = agent_provision_plan(
|
||||
template=provider.template,
|
||||
|
||||
Reference in New Issue
Block a user