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

T7042: drop use of inspect module in favor of ast for source analysis #4300

Merged
merged 1 commit into from
Jan 11, 2025

Conversation

jestabro
Copy link
Contributor

@jestabro jestabro commented Jan 11, 2025

Change summary

Rewrite the configd script compatibility test using the ast module instead of the inspect module. This avoids importing config mode scripts as modules, with requisite dependencies, in the build environment.

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):
    Remove unnecessary restriction on build environment.

Related Task(s)

Related PR(s)

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

This avoids importing the config mode script as a module, with requisite
dependencies, which may be inconvenient.
Copy link

github-actions bot commented Jan 11, 2025

👍
No issues in PR Title / Commit Title

Copy link

CI integration 👍 passed!

Details

CI logs

  • CLI Smoketests (no interfaces) 👍 passed
  • CLI Smoketests (interfaces only) 👍 passed
  • Config tests 👍 passed
  • RAID1 tests 👍 passed
  • TPM tests 👍 passed

@sever-sever
Copy link
Member

Tried this PR, should it fix this?

======================================================================
FAIL: test_signatures (test_configd_inspect.TestConfigdInspect.test_signatures)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vyos/work/tmp/vyos-1x-vpp-edition/vyos-1x/src/tests/test_configd_inspect.py", line 119, in test_signatures
    self.assertEqual(sig_lens[f], 1, f"'{s}': '{f}' incorrect signature")
AssertionError: 2 != 1 : 'vpp_interfaces_bonding.py': 'get_config' incorrect signature

Still fails

@jestabro
Copy link
Contributor Author

It should not fix that: it is correctly catching an incompatibility in the vpp* scripts (I tested the PR on the vpp* scripts; this was evidence that the PR was correct). The incompatibilty is that when configd calls the standard functions, it will only call with a single argument to get_config.

@jestabro jestabro merged commit 8a83a97 into vyos:current Jan 11, 2025
19 checks passed
@jestabro jestabro deleted the configd-inspect-by-ast branch January 12, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants