Skip to content

Add --search-domains flag to dns options command#655

Open
joshuaboniface wants to merge 2 commits into
home-assistant:masterfrom
joshuaboniface:custom-dns-search
Open

Add --search-domains flag to dns options command#655
joshuaboniface wants to merge 2 commits into
home-assistant:masterfrom
joshuaboniface:custom-dns-search

Conversation

@joshuaboniface

@joshuaboniface joshuaboniface commented May 29, 2026

Copy link
Copy Markdown

Expose the supervisor's search_domains DNS option (home-assistant/supervisor#6893) via the CLI, mirroring the existing --servers flag. Accepts multiple values via repeated use of the flag.

ha dns options --search-domains example.com --search-domains corp.example.com

Peer of home-assistant/supervisor#6893 and requires that PR first.

Summary by CodeRabbit

  • New Features
    • The ha dns options command now supports the --search-domains flag to configure DNS search domains.
    • Command examples and help text have been updated to show usage of the new flag.

Expose the supervisor's search_domains DNS option via the CLI,
mirroring the existing --servers flag. Accepts multiple values via
repeated use of the flag.

  ha dns options --search-domains example.com --search-domains corp.example.com
@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 53ac4fba-cd57-4614-b844-bf6efec7cd02

📥 Commits

Reviewing files that changed from the base of the PR and between 7614e62 and 765abfe.

📒 Files selected for processing (1)
  • cmd/dns_options.go

📝 Walkthrough

Walkthrough

Adds a --search-domains StringArray flag to ha dns options; updates the command example, reads and debug-logs the flag in Run(), conditionally includes its values as search_domains in the backend request, and registers the flag in init() with file completions disabled.

Changes

Search domains flag addition

Layer / File(s) Summary
Search domains flag definition and integration
cmd/dns_options.go
The --search-domains flag is documented in the command example, defined as a StringArray flag in init() with no-file completions registered, and integrated into Run() to read flag values and conditionally populate the backend request payload under search_domains when the flag was explicitly changed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a new --search-domains flag to the dns options command, which aligns with the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/dns_options.go`:
- Around line 39-44: The code is calling log.WithField(...).Debug(...) but only
imports log/slog so replace the non-existent log usage with slog structured
logging: after obtaining searchDomains (from cmd.Flags().GetStringArray) remove
log.WithField and instead call slog.Debug or slog.Info with attributes (e.g.,
slog.Debug("search-domains", slog.Any("search-domains", searchDomains))) and
keep the conditional that sets options["search_domains"]; ensure you use
slog.Any or slog.Strings for the attribute and do not introduce a new "log"
identifier.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f4946470-d1ab-46ee-aa07-13b1c8c7169a

📥 Commits

Reviewing files that changed from the base of the PR and between cc1b43c and 7614e62.

📒 Files selected for processing (1)
  • cmd/dns_options.go

Comment thread cmd/dns_options.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant