Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ipv6 address as dns when setting static ipv4 #285

Merged
merged 2 commits into from
Oct 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/gems/pending/appliance_console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ module ApplianceConsole
new_ip = ask_for_ipv4("IP Address", ip)
new_mask = ask_for_ipv4("Netmask", mask)
new_gw = ask_for_ipv4("Gateway", gw)
new_dns1 = ask_for_ipv4("Primary DNS", dns1)
new_dns2 = ask_for_ipv4_or_none("Secondary DNS (Enter 'none' for no value)")
new_dns1 = ask_for_ip("Primary DNS", dns1)
new_dns2 = ask_for_ip_or_none("Secondary DNS (Enter 'none' for no value)")

new_search_order = ask_for_many("domain", "Domain search order", order)

Expand Down
4 changes: 4 additions & 0 deletions lib/gems/pending/appliance_console/prompts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def ask_for_ip(prompt, default, validate = IP_REGEXP, error_text = "a valid IP A
just_ask(prompt, default, validate, error_text, &block)
end

def ask_for_ip_or_none(prompt, default = nil)
ask_for_ip(prompt, default, Regexp.union(NONE_REGEXP, IP_REGEXP)).gsub(NONE_REGEXP, "")
end

def ask_for_ipv4(prompt, default)
ask_for_ip(prompt, default, IPV4_REGEXP)
end
Expand Down