Class: Rbeapi::Api::Managementdefaults
- Defined in:
- lib/rbeapi/api/managementdefaults.rb
Overview
The Managementdefaults class provides a configuration instance for configuring management defaults of the node.
Constant Summary collapse
- DEFAULT_SECRET_HASH =
'md5'.freeze
Instance Attribute Summary
Attributes inherited from Entity
Instance Method Summary collapse
-
#get ⇒ nil, Hash<Symbol, Object] returns the nodes current running configuration as a Hash. If management defaults are not configured on the node this method will return nil.
get scans the current nodes configuration and returns the values as a Hash describing the current state.
-
#set_secret_hash(opts = {}) ⇒ Boolean
set_secret_hash configures the management defaults secret hash value in the current nodes running configuration.
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 ⇒ nil, Hash<Symbol, Object] returns the nodes current running configuration as a Hash. If management defaults are not configured on the node this method will return nil.
get scans the current nodes configuration and returns the values as a Hash describing the current state.
58 59 60 61 62 63 |
# File 'lib/rbeapi/api/managementdefaults.rb', line 58 def get config = get_block('management defaults') settings = {} settings.merge!(parse_secret_hash(config)) end |
#set_secret_hash(opts = {}) ⇒ Boolean
set_secret_hash configures the management defaults secret hash value in the current nodes running configuration. If the default keyword is provided, the configuration is defaulted using the default keyword.
===Commands
management defaults
secret hash
109 110 111 112 113 114 115 116 |
# File 'lib/rbeapi/api/managementdefaults.rb', line 109 def set_secret_hash(opts = {}) unless ['md5', 'sha512', nil].include?(opts[:value]) raise ArgumentError, 'secret hash must be md5 or sha512' end cmd = command_builder("secret hash #{opts[:value]}") cmds = ['management defaults', cmd] configure(cmds) end |