Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
David Barroso committed Apr 3, 2015
1 parent 7e21731 commit 5e1102c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
22 changes: 12 additions & 10 deletions napalm/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ def _load_and_test_config(self, filename, config, overwrite):
self.candidate_configuration = self.candidate_configuration.split('\n')

# If you send empty commands the whole thing breaks so we have to remove them
while '' in self.candidate_configuration:
self.candidate_configuration.remove('')
clean_candidate = list()
for line in self.candidate_configuration:
if not line.strip() == '':
clean_candidate.append(line)

test_config = list(self.candidate_configuration)
self.candidate_configuration = list(clean_candidate)
test_config = list(clean_candidate)

if 'end' in test_config:
test_config.remove('end')
Expand All @@ -69,12 +72,8 @@ def _load_and_test_config(self, filename, config, overwrite):
output = self.device.run_commands(test_config)

def load_replace_candidate(self, filename=None, config=None):
try:
self._load_and_test_config(filename=filename, config=config, overwrite=True)
self.config_replace = True
self.device.load_candidate_config(filename=filename, config=config)
except CommandError as e:
raise ReplaceConfigException(e.message)
self.config_replace = True
self.device.load_candidate_config(filename=filename, config=config)

def load_merge_candidate(self, filename=None, config=None):
try:
Expand All @@ -92,7 +91,10 @@ def compare_config(self):
return self.device.run_commands(commands, format='text')[1]['output']

def _commit_replace(self):
self.device.replace_config()
try:
self.device.replace_config()
except ConfigReplaceError as e:
raise ReplaceConfigException(e.message)

def _commit_merge(self):
self.candidate_configuration.insert(0, 'copy startup-config flash:rollback-0')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name="napalm",
version="0.10",
version="0.11",
packages=find_packages(),
author="David Barroso",
author_email="dbarroso@spotify.net",
Expand Down

0 comments on commit 5e1102c

Please sign in to comment.