resources/switchconfig.rb
##
# Perform a block-by-clock diff of the current and desired configs.
# This allows for user input in which blocks are not in the same order
# as 'show running-config'.
#
# @param [current] <String> The running-config from the switch.
# @param [desired] <String> The proposed config from the user.
# @return [Boolean] whether configurations differ
# rubocop:disable AbcSize
Perform a block-by-clock diff of the current and desired configs.
This allows for user input in which blocks are not in the same order
as 'show running-config'.
Perform a block - by - clock diff of the current and desired configs . This allows for user input in which blocks are not in the same order as ' show running - config ' .
def configs_differ?(current, desired)
  org_swc = Rbeapi::SwitchConfig::SwitchConfig.new(current)
  new_swc = Rbeapi::SwitchConfig::SwitchConfig.new(desired)
  results = org_swc.compare(new_swc)
  !results[0].cmds.empty? || \
    !results[0].children.empty? || \
    !results[1].cmds.empty? || \
    !results[1].children.empty?
end
def configs_differ? ( current , desired ) org_swc = Rbeapi :: SwitchConfig :: SwitchConfig . new ( current ) new_swc = Rbeapi :: SwitchConfig :: SwitchConfig . new ( desired ) results = org_swc . compare ( new_swc ) ! results [ 0 ] . cmds . empty? || ! results [ 0 ] . children . empty? || ! results [ 1 ] . cmds . empty? || ! results [ 1 ] . children . empty? end
Perform a block-by-clock diff of the current and desired configs.
Perform a block - by - clock diff of the current and desired configs .
# Get the current running config in a SwitchConfig object # Get the new running config in a SwitchConfig object # Compare the current and new configs # If results are both empty then nothing needs to change,
whether configurations differ rubocop:disable AbcSize
whether configurations differ rubocop : disable AbcSize
Boolean
current
desired
 The proposed config from the user.
The proposed config from the user .