Class: Rbeapi::Api::System
Overview
The System class configures the node system services such as hostname and domain name
Instance Attribute Summary
Attributes inherited from Entity
Instance Method Summary collapse
-
#get ⇒ Hash
Returns the system settings.
- #parse_hostname(config) ⇒ Object
-
#set_hostname(opts = {}) ⇒ Boolean
Configures the system hostname value in the running-config.
Methods inherited from Entity
#command_builder, #configure, #configure_interface, #get_block, #initialize, instance
Constructor Details
This class inherits a constructor from Rbeapi::Api::Entity
Instance Method Details
#get ⇒ Hash
Returns the system settings
54 55 56 57 58 |
# File 'lib/rbeapi/api/system.rb', line 54 def get response = {} response.merge!(parse_hostname(config)) response end |
#parse_hostname(config) ⇒ Object
60 61 62 63 |
# File 'lib/rbeapi/api/system.rb', line 60 def parse_hostname(config) mdata = /(?<=^hostname\s)(.+)$/.match(config) { hostname: mdata.nil? ? '' : mdata[1] } end |
#set_hostname(opts = {}) ⇒ Boolean
Configures the system hostname value in the running-config
75 76 77 78 |
# File 'lib/rbeapi/api/system.rb', line 75 def set_hostname(opts = {}) cmd = command_builder('hostname', opts) configure(cmd) end |