class PuppetX::Eos::System
The System
class provides management of system level functions
Public Class Methods
Public Instance Methods
Returns the configure domain-list from the running-config. If no domain-list has been created, then an empty array is returned
@return [Array] the list of configured domain names
# File lib/puppet_x/eos/modules/system.rb, line 76 def get_domain_list result = @api.enable('show running-config section ip\sdomain-list', 'text') result.first['output'].scan(/(?<=list\s).*$/) end
Returns the configured domain-name from the running-config
@return [String] the configured domain-name
# File lib/puppet_x/eos/modules/system.rb, line 66 def get_domain_name result = @api.enable('show ip domain-name', 'text') result.first['output'].gsub("\n", '') end
Returns the configured system hostname from the running-config
@return [String] the configured system hostname
# File lib/puppet_x/eos/modules/system.rb, line 57 def get_hostname result = @api.enable('show hostname') result.first['hostname'].gsub("\n", '') end
Returns the list of configured name-servers from the running-config
@return [Array] the list of configured name servers
# File lib/puppet_x/eos/modules/system.rb, line 86 def get_name_servers result = @api.enable('show ip name-server', 'text') result.first['output'].split("\n") end
Configures the list of domain suffixes to search
@param list of domain-name values
@return [Boolean] True if the commands succeed otherwise False
# File lib/puppet_x/eos/modules/system.rb, line 130 def set_domain_list(domains) domains.each do |name| resp = @api.config("ip domain-list #{name}") return false unless resp == [{}] end end
Configures the system domain-name
@param [String] name The name to configure the domain-name to
@return [Boolean] True if the commands succeed otherwise False
# File lib/puppet_x/eos/modules/system.rb, line 107 def set_domain_name(name) @api.config("ip domain-name #{name}") end
Configures the system hostname
@param [String] name The name to configure the hostname to
@return [Boolean] True if the commands succeed otherwise False
# File lib/puppet_x/eos/modules/system.rb, line 97 def set_hostname(name) @api.config("hostname #{name}") == [{}] end
Configures the system name servers
@param [Array] list of name-server values
@return [Boolean] True if the commands succeed otherwise False
# File lib/puppet_x/eos/modules/system.rb, line 117 def set_name_servers(servers) servers.each do |srv| resp = @api.config("ip name-server #{srv}") return false unless resp == [{}] end end