Method: Cisco::Client#set

Defined in:
lib/cisco_node_utils/client/client.rb

#set(data_format: :cli, context: nil, values: nil, **_kwargs) ⇒ Object

Configure the given state on the device.

Parameters:

  • data_format (defaults to: :cli)

    one of Cisco::DATA_FORMATS. Default is :cli

  • context (String, Array<String>) (defaults to: nil)

    Context for the configuration

  • values (String, Array<String>) (defaults to: nil)

    Actual configuration to set

  • kwargs

    data-format-specific args

Raises:



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/cisco_node_utils/client/client.rb', line 171

def set(data_format: :cli,
        context:     nil,
        values:      nil,
        **_kwargs)
  # subclasses will generally want to call Client.munge_to_array()
  # on context and/or values before calling super()
  fail Cisco::RequestNotSupported unless self.supports?(data_format)
  cache_flush if cache_auto?
  Cisco::Logger.debug("Set state using data format '#{data_format}'")
  Cisco::Logger.debug("  with context:\n    #{context.join("\n    ")}") \
    unless context.nil? || context.empty?
  Cisco::Logger.debug("  to value(s):\n    #{values.join("\n    ")}") \
    unless values.nil? || values.empty?
  # to be implemented by subclasses
end