Skip to content

Commit

Permalink
Merge pull request #22 from QualiSystems/7.0_refactoring
Browse files Browse the repository at this point in the history
Fixed commit error_map
  • Loading branch information
Yaroslav Nikonorov committed Aug 30, 2016
2 parents 47a2161 + 5197527 commit d53d440
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cloudshell/networking/juniper/cli/juniper_cli_service.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from copy import copy

from cloudshell.cli.service.cli_exceptions import CommandExecutionException
from cloudshell.cli.service.cli_service import CliService
from cloudshell.configuration.cloudshell_cli_binding_keys import SESSION
Expand All @@ -7,7 +9,6 @@


class JuniperCliService(CliService):

@inject.params(logger=LOGGER, session=SESSION)
def send_config_command(self, command, expected_str=None, expected_map=None, error_map=None, logger=None,
session=None, **optional_args):
Expand All @@ -27,7 +28,7 @@ def send_config_command(self, command, expected_str=None, expected_map=None, err
logger, session, **optional_args)
except CommandExecutionException:
self.rollback()
raise
raise

@inject.params(logger=LOGGER, session=SESSION)
def commit(self, expected_map=None, logger=None, session=None):
Expand All @@ -39,8 +40,11 @@ def commit(self, expected_map=None, logger=None, session=None):
:return:
"""
logger.debug('Commit called')
error_map = copy(self._error_map)
error_map[r'[Ee]rror|ERROR'] = 'Commit error, see logs for more details'
try:
self._send_command(commit_rollback.COMMIT.get_command(), expected_map=expected_map, session=session)
self._send_command(commit_rollback.COMMIT.get_command(), expected_map=expected_map, error_map=error_map,
session=session)
except CommandExecutionException:
self.rollback()
raise
Expand Down

0 comments on commit d53d440

Please sign in to comment.