Skip to content

baremetal: add docker_insecure_registries for metalbox to deploy play…#2265

Merged
berendt merged 1 commit intomainfrom
inronic-inseucre
May 6, 2026
Merged

baremetal: add docker_insecure_registries for metalbox to deploy play…#2265
berendt merged 1 commit intomainfrom
inronic-inseucre

Conversation

@berendt
Copy link
Copy Markdown
Member

@berendt berendt commented May 6, 2026

…book

Sets docker_insecure_registries to [metalbox:5001] alongside the existing metalbox.osism.xyz hosts entry so deployed nodes can pull from the metalbox registry over HTTP.

AI-assisted: Claude Code

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • You’re unconditionally overwriting play['vars']['docker_insecure_registries'] in three places; if other registries might already be defined, consider appending/merging instead of replacing the list.
  • The same docker_insecure_registries = ['metalbox:5001'] block is duplicated in three branches; consider extracting a small helper or consolidating the common logic to reduce repetition and keep future changes in one place.
  • You’re adding metalbox:5001 while the hosts entry uses metalbox.osism.xyz; double-check that Docker will actually resolve metalbox in this context or consider aligning the hostname with the one configured in hosts_additional_entries.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- You’re unconditionally overwriting `play['vars']['docker_insecure_registries']` in three places; if other registries might already be defined, consider appending/merging instead of replacing the list.
- The same `docker_insecure_registries = ['metalbox:5001']` block is duplicated in three branches; consider extracting a small helper or consolidating the common logic to reduce repetition and keep future changes in one place.
- You’re adding `metalbox:5001` while the hosts entry uses `metalbox.osism.xyz`; double-check that Docker will actually resolve `metalbox` in this context or consider aligning the hostname with the one configured in `hosts_additional_entries`.

## Individual Comments

### Comment 1
<location path="osism/commands/baremetal.py" line_range="305-307" />
<code_context>
                             play["vars"]["hosts_additional_entries"] = {
                                 "metalbox.osism.xyz": metalbox_ip
                             }
+                            play["vars"]["docker_insecure_registries"] = [
+                                "metalbox:5001"
+                            ]
                     if (
                         "netplan_parameters" in node.extra
</code_context>
<issue_to_address>
**issue (bug_risk):** Avoid overwriting any existing `docker_insecure_registries` that might already be present.

If `play["vars"]` may already define `docker_insecure_registries` (from other logic or config), this will overwrite it. Instead, merge with any existing list and only add `"metalbox:5001"` if it isn’t already present.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread osism/commands/baremetal.py Outdated
Comment on lines +305 to +307
play["vars"]["docker_insecure_registries"] = [
"metalbox:5001"
]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Avoid overwriting any existing docker_insecure_registries that might already be present.

If play["vars"] may already define docker_insecure_registries (from other logic or config), this will overwrite it. Instead, merge with any existing list and only add "metalbox:5001" if it isn’t already present.

…book

Sets docker_insecure_registries to [metalbox:5001] alongside the
existing metalbox.osism.xyz hosts entry so deployed nodes can pull
from the metalbox registry over HTTP.

Extracts the metalbox vars setup into a small _apply_metalbox_vars
helper so the three call sites in BaremetalDeploy and BaremetalDump
share one implementation.

AI-assisted: Claude Code

Signed-off-by: Christian Berendt <berendt@osism.tech>
@berendt berendt force-pushed the inronic-inseucre branch from 6bf20c2 to 1c68a60 Compare May 6, 2026 12:19
@berendt berendt merged commit c6a0262 into main May 6, 2026
2 of 3 checks passed
@berendt berendt deleted the inronic-inseucre branch May 6, 2026 19:10
@github-project-automation github-project-automation Bot moved this from Ready to Done in Human Board May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants