Class: Simp::Cli::Config::Item::Gateway
- Inherits:
-
Simp::Cli::Config::Item
- Object
- Simp::Cli::Config::Item
- Simp::Cli::Config::Item::Gateway
- Defined in:
- lib/simp/cli/config/item/gateway.rb
Instance Attribute Summary
Attributes inherited from Simp::Cli::Config::Item
#allow_user_apply, #config_items, #description, #die_on_apply_fail, #fact, #fail_on_missing_answer, #key, #next_items_tree, #silent, #skip_apply, #skip_query, #skip_yaml, #value
Instance Method Summary collapse
-
#initialize ⇒ Gateway
constructor
A new instance of Gateway.
-
#os_value ⇒ Object
FIXME: make this a custom Fact?.
-
#recommended_value ⇒ Object
Always recommend the default Gateway TODO IDEA: recommend the primary nic’s gateway?.
- #validate(x) ⇒ Object
Methods inherited from Simp::Cli::Config::Item
#apply, #default_value, #highline_question_type, #next_items, #not_valid_message, #print_banner, #print_summary, #puppet_value, #query, #query_ask, #query_extras, #query_status, #safe_apply, #say_blue, #say_green, #say_red, #say_yellow, #to_yaml_s
Constructor Details
#initialize ⇒ Gateway
Returns a new instance of Gateway.
8 9 10 11 12 13 |
# File 'lib/simp/cli/config/item/gateway.rb', line 8 def initialize super @key = 'gateway' @description = 'The default gateway.' @__warning = false end |
Instance Method Details
#os_value ⇒ Object
FIXME: make this a custom Fact?
17 18 19 20 |
# File 'lib/simp/cli/config/item/gateway.rb', line 17 def os_value `ip route show` =~ /default\s*via\s*(.*)\s*dev/ (($1 && $1.strip) || nil) end |
#recommended_value ⇒ Object
Always recommend the default Gateway TODO IDEA: recommend the primary nic’s gateway?
25 |
# File 'lib/simp/cli/config/item/gateway.rb', line 25 def recommended_value; os_value; end |
#validate(x) ⇒ Object
28 29 30 |
# File 'lib/simp/cli/config/item/gateway.rb', line 28 def validate( x ) Simp::Cli::Config::Utils.validate_ip x end |