Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some diff fixes #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions napalm_ruckus_fastiron/FastIron.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ def __creates_config_block(list_1):
@staticmethod
def __compare_blocks(cb_1, config_blocks_2, cmd, symbol):
temp_list = list()
stat = False
for cb_2 in config_blocks_2: # grabs a single config block
if cmd == cb_2[0]: # checks cmd not found
stat = True
Expand All @@ -510,6 +511,7 @@ def __comparing_list(list_1, list_2, symbol):
for cb_1 in config_blocks_1: # Grabs a single config block
is_found = False

temp_list = list()
if cb_1 not in config_blocks_2: # checks if config block already exisit
cmd = cb_1[0] # grabs first cmd of config block

Expand Down Expand Up @@ -657,8 +659,8 @@ def compare_config(self): # optimize implementatio
else:
return -1 # No configuration was found

diff_1 = FastIronDriver.__comparing_list(rc, stored_conf, "+")
diff_2 = FastIronDriver.__comparing_list(stored_conf, rc, "-")
diff_1 = FastIronDriver.__comparing_list(rc, stored_conf, "-")
diff_2 = FastIronDriver.__comparing_list(stored_conf, rc, "+")

str_diff1 = FastIronDriver.__compare_away(diff_1, diff_2)
str_diff2 = FastIronDriver.__compare_vice(diff_2, diff_1)
Expand All @@ -681,9 +683,9 @@ def commit_config(self):

for sentence in my_temp:

if sentence[0] == '-':
if sentence[0] == '+':
sentence = sentence[1:len(sentence)]
elif sentence[0] == '+':
elif sentence[0] == '-':
sentence = 'no' + sentence[1:len(sentence)]
replace_list.append(sentence)

Expand Down