Skip to content

Commit

Permalink
Revert "[syslog] Adjust runningconfiguration syslog command (#2939)" (#…
Browse files Browse the repository at this point in the history
…2947)

This reverts commit d3266a4.
  • Loading branch information
StormLiangMS authored Aug 18, 2023
1 parent c9f38f8 commit a5ff8f2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 103 deletions.
2 changes: 1 addition & 1 deletion show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@ def syslog(verbose):
header = ["Syslog Servers"]
body = []

re_syslog = re.compile(r'^action\(type=\"omfwd\" Target=\"{1}(.+?)\"{1}.*\)')
re_syslog = re.compile(r'^\*\.\* action\(.*target=\"{1}(.+?)\"{1}.*\)')

try:
with open("/etc/rsyslog.conf") as syslog_file:
Expand Down
26 changes: 1 addition & 25 deletions tests/show_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from unittest import mock
from click.testing import CliRunner
from utilities_common import constants
from unittest.mock import call, MagicMock, patch, mock_open
from unittest.mock import call, MagicMock, patch

EXPECTED_BASE_COMMAND = 'sudo '
EXPECTED_BASE_COMMAND_LIST = ['sudo']
Expand Down Expand Up @@ -988,27 +988,3 @@ def test_show_ztp(self, mock_run_command):
def teardown(self):
print('TEAR DOWN')


class TestShowRunningconfiguration(object):
@classmethod
def setup_class(cls):
print('SETUP')
os.environ['UTILITIES_UNIT_TESTING'] = '1'

@patch('show.main.run_command')
@patch('builtins.open', mock_open(
read_data=open('tests/syslog_input/rsyslog.conf').read()))
def test_rc_syslog(self, mock_rc):
runner = CliRunner()

result = runner.invoke(
show.cli.commands['runningconfiguration'].commands['syslog'])
print(result.exit_code)
print(result.output)

assert result.exit_code == 0
assert '[1.1.1.1]' in result.output

@classmethod
def teardown_class(cls):
print('TEARDOWN')
77 changes: 0 additions & 77 deletions tests/syslog_input/rsyslog.conf

This file was deleted.

0 comments on commit a5ff8f2

Please sign in to comment.