Item::SimpOptionsDNSServers does not account for existing DNS servers properly
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- ruby
- 领域
- cli, networking
调研方向
从 lib/simp/cli/config/items/data/simp_options_dns_servers.rb 第 33 行附近开始,检查 nmcli 输出如何成为 DNS 服务器默认值。验证以管道分隔的服务器是否被分别解析,重复值或空值是否得到处理,以及生成的默认值是否通过验证;如果相关的现有测试套件可用,请运行它。
由索引模型根据 Issue 内容生成。
描述
One of my test systems I attempted to bootstrap with SIMP 6.6 ran into an issue with the DNS when going through the simp config questionnaire. When it came time to choose the DNS options I ran into some oddities:
cli::network::set_up_nic = true
=== cli::network::dhcp ===
Whether to use DHCP to retrieve your network settings ("dhcp") or to
use static network settings ("static").
----> Recommended value: "static"
cli::network::dhcp: |static| dhcp
cli::network::dhcp = "dhcp"
>> Applying: Configure a network interface... Succeeded
=== cli::network::hostname ===
The Fully Qualified Domain Name (FQDN) of the system.
This *MUST* contain a domain. Simple hostnames are not allowed.
----> OS value: "puppet.localhost.local"
----> Recommended value: "puppet.localhost.local"
cli::network::hostname: |puppet.localhost.local|
cli::network::hostname = "puppet.localhost.local"
>> Applying: Set hostname... Succeeded
Internal error: Default, noninteractive value for simp_options::dns::servers is invalid: '["1.1.1.1 | 1.0.0.1"]'.
/usr/share/simp/ruby/gems/simp-cli-7.0.0/lib/simp/cli/config/items/item.rb:267:in `determine_value_from_default'
/usr/share/simp/ruby/gems/simp-cli-7.0.0/lib/simp/cli/config/items/item.rb:235:in `determine_value'
/usr/share/simp/ruby/gems/simp-cli-7.0.0/lib/simp/cli/config/questionnaire.rb:98:in `process_item'
/usr/share/simp/ruby/gems/simp-cli-7.0.0/lib/simp/cli/config/questionnaire.rb:38:in `process_pass1'
/usr/share/simp/ruby/gems/simp-cli-7.0.0/lib/simp/cli/config/questionnaire.rb:49:in `process_pass1'
/usr/share/simp/ruby/gems/simp-cli-7.0.0/lib/simp/cli/config/questionnaire.rb:49:in `process_pass1'
/usr/share/simp/ruby/gems/simp-cli-7.0.0/lib/simp/cli/config/questionnaire.rb:49:in `process_pass1'
/usr/share/simp/ruby/gems/simp-cli-7.0.0/lib/simp/cli/config/questionnaire.rb:49:in `process_pass1'
/usr/share/simp/ruby/gems/simp-cli-7.0.0/lib/simp/cli/config/questionnaire.rb:49:in `process_pass1'
/usr/share/simp/ruby/gems/simp-cli-7.0.0/lib/simp/cli/config/questionnaire.rb:49:in `process_pass1'
Upon looking into this I found the bug is right here: https://github.com/simp/rubygem-simp-cli/blob/master/lib/simp/cli/config/items/data/simp_options_dns_servers.rb#L33
Turns out that nmcli will return multiple DNS servers with a pipe delimiter. But, good news, this is an easy fix, and we can even simplify the block. We can change line 33 like so:
nameservers = result[:stdout].strip.split("\n").map { |ips| ips.split(/\s*\|\s*/) }.flatten.uniq
One bonus to this approach is that flattening the array will also remove empty values so we don't need the delete_if on the following lines.
- 主要语言
- Ruby
- 星标
- 2
- 派生
- 12
- 平均合并
- 6 天 6 小时
- 30 天内合并 PR
- 3
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
simp/rubygem-simp-cli 的其他 Issue
-
难度 5/5 一周以上 新手友好度 30/100
simp/rubygem-simp-cli#223 ·
-
难度 2/5 1-3 小时 新手友好度 25/100
simp/rubygem-simp-cli#200 ·
-
难度 3/5 1-2 天 新手友好度 45/100
simp/rubygem-simp-cli#194 · 1 条评论 ·
-
community
难度 2/5 1-3 小时 新手友好度 48/100
simp/rubygem-simp-cli#188 · 1 条评论 ·
查看 simp/rubygem-simp-cli 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 82/100
zerocracy/judges-action#2743 ·
维护者通常 8 天内回复
-
Python 3.15 support可能已有人在做 @amnesiaof 今天认领。 未关闭L: python L: python:uv
难度 2/5 1-3 小时 新手友好度 72/100
dependabot/dependabot-core#16524 · 1 条评论 ·
维护者通常 1 天内回复
-
content good first issue
难度 2/5 1-3 小时 新手友好度 66/100
rubyevents/rubyevents#2182 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
TarteelAI/quranic-universal-library#821 · 1 条评论 ·
维护者通常 1 天内回复