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

VyOS v1.4+ chronyd conf support #357

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

VyOS v1.4+ chronyd conf support #357

wants to merge 4 commits into from

Conversation

omnom62
Copy link
Contributor

@omnom62 omnom62 commented Nov 13, 2024

Change Summary

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)
  • Other (please describe):

Related Task(s)

Related PR(s)

Proposed changes

How to test

Checklist:

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

$""",
re.VERBOSE,
),
"setval": "system ntp allow-clients address {{allow_clients}}",
"setval": "path ntp allow-clients address {{allow_clients}}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these path references need to be {{path}}? I wouldn’t expect the variable substitution to work without it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still working on more elegant way of abstraction version discrepancies, so I appreciate there might be a better way. Meantime, this is a placeholder, so I can then replace path by either 'system' or 'service' in the resultant self.commands list - keep looking though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I figured, was just wondering if you wanted to use the replacement tool that was already being used to replace the path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have missed in myriad of lines of code - can you point me to any existing solutions you, guys, already have? thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am to speculate and preempt here, and the replacement tool is something that I coded, then {{path}}? is getval part and required for changed status checks, otherwise, if only the replacement is left, then it will always be changed = true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these path references need to be {{path}}? I wouldn’t expect the variable substitution to work without it.

No, it did not work for me - that said, I am still checking if the solution can be down purely in the parser code

Copy link
Contributor

@gaige gaige Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, it’s not a mechanism that will pull directly from the current namespace, you would need to insert the path into the dictionary that is being rendered, which might be tricky to find the right place. There may not be a suitable way to inject the data into the underlying render code.

If not, I’d recommend that you consider something a bit more distinct, maybe “%%path%%” as the token you’re trying to replace in order to ensure that the code doesn’t replace a portion of an argument (such as a hostname) and create an unexpected result if an NTP host is named “tick.empath.com” for example. That would become “tick.emsystem.com” or “tick.enservice.com” using the current code.

So

"setval": "path ntp allow-clients address {{allow_clients}}",

Would become:

"setval": "%%path%% ntp allow-clients address {{allow_clients}}",

And make the corresponding change in the replace operation you added.

@gaige
Copy link
Contributor

gaige commented Nov 13, 2024

I’ve not touched any of the “new-style” parser modules, so interested to see how this works. I put a comment in about the path variable in the template, but otherwise looks good.

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

Successfully merging this pull request may close these issues.

2 participants