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

validators: T6739: fix ipaddrcheck argument quoting #4099

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

dmbaturin
Copy link
Member

Change Summary

Properly quote ipaddrcheck arguments in validator scripts to ensure they are handled correctly if they contain whitespace. Right now such arguments are correctly rejected but result in confusing error messages that contain ipaddrcheck's help:

vyos@vyos# set interfaces ethernet eth1 address "a valid IP address, I swear!"

  Error: wrong number of arguments, one argument required!
  Usage: ipaddrcheck <OPTIONS> [STRING]
  Address checking options:
    --is-valid                 Check if STRING is a valid IPv4 or IPv6 address
                                 with or without prefix length
    --is-any-cidr              Check if STRING is a valid IPv4 or IPv6 address
                                 with prefix length

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Component(s) name

Validators.

How to test

Smoketest result

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@dmbaturin dmbaturin requested a review from a team as a code owner September 25, 2024 15:54
Copy link

👍
No issues in PR Title / Commit Title

Copy link

✅ No issues found in unused-imports check.. Please refer the workflow run

@c-po
Copy link
Member

c-po commented Sep 26, 2024

@Mergifyio backport circinus sagitta

@c-po c-po merged commit 9acb964 into vyos:current Sep 26, 2024
14 of 17 checks passed
Copy link
Contributor

mergify bot commented Sep 26, 2024

backport circinus sagitta

✅ Backports have been created

@c-po
Copy link
Member

c-po commented Sep 26, 2024

@dmbaturin smoketests report:

DEBUG - ======================================================================
DEBUG - ERROR: test_cgnat (__main__.TestCGNAT.test_cgnat)
DEBUG - ----------------------------------------------------------------------
DEBUG - Traceback (most recent call last):
DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/test_cgnat.py", line 73, in test_cgnat
DEBUG -     self.cli_set(base_path + ['pool', 'external', external_name, 'range', external_net])
DEBUG -   File "/usr/libexec/vyos/tests/smoke/cli/base_vyostest_shim.py", line 71, in cli_set
DEBUG -     self._session.set(config)
DEBUG -   File "/usr/lib/python3/dist-packages/vyos/configsession.py", line 161, in set
DEBUG -     self.__run_command([SET] + path + value)
DEBUG -   File "/usr/lib/python3/dist-packages/vyos/configsession.py", line 150, in __run_command
DEBUG -     raise ConfigSessionError(output)
DEBUG - vyos.configsession.ConfigSessionError: Error: 192.0.2.1-192.0.2.2 is not a valid IPv4 address range
DEBUG -
DEBUG - Error: 192.0.2.1-192.0.2.2 is not a valid IPv4 host
DEBUG -
DEBUG - Error: 192.0.2.1-192.0.2.2 is not a valid IPv4 prefix

and it was missed here https://github.com/vyos/vyos-1x/actions/runs/11036683938/job/30656416756#step:5:1522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants