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

filter doesn't play nice with some commands #177

Closed
oyvindhagberg opened this issue Nov 28, 2023 · 0 comments · Fixed by #178
Closed

filter doesn't play nice with some commands #177

oyvindhagberg opened this issue Nov 28, 2023 · 0 comments · Fixed by #178
Assignees
Labels
bug Something isn't working

Comments

@oyvindhagberg
Copy link
Contributor

mreg> permission network_add 123.123.123.0/27 some-group-name '^[a-z0-9\-]+(\.(aa|bbb|ccc|sikkerhet))?\.uio\.no$'
Traceback (most recent call last):
  File "/usr/bin/mreg-cli", line 33, in <module>
    sys.exit(load_entry_point('mreg-cli==0.0.0', 'console_scripts', 'mreg-cli')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mreg_cli/main.py", line 185, in main
    cmd = output.from_command(line)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mreg_cli/outputmanager.py", line 48, in from_command
    self._command, self._filter_re, self._negate = self.get_filter(command)
                                                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mreg_cli/outputmanager.py", line 102, in get_filter
    filter_re = re.compile(filter_str)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/__init__.py", line 227, in compile
    return _compile(pattern, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/re/_parser.py", line 987, in parse
    raise source.error("unbalanced parenthesis")
re.error: unbalanced parenthesis at position 21
@oyvindhagberg oyvindhagberg added the bug Something isn't working label Nov 28, 2023
@terjekv terjekv self-assigned this Nov 28, 2023
terjekv added a commit to terjekv/mreg-cli that referenced this issue Nov 28, 2023
  - If a string is quoted, don't treat | as a filter command.
  - Handles and matches both " and '.

Fixes unioslo#177
oyvindhagberg pushed a commit that referenced this issue Nov 29, 2023
* Avoid applying filtering inside of quoted strings.

  - If a string is quoted, don't treat | as a filter command.
  - Handles and matches both " and '.

Fixes #177
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants