Skip to content

User scripts#461

Closed
wkz wants to merge 2 commits intomainfrom
user-scripts
Closed

User scripts#461
wkz wants to merge 2 commits intomainfrom
user-scripts

Conversation

@wkz
Copy link
Contributor

@wkz wkz commented May 21, 2024

Description

Add a new service that, when enabled, will execute run-parts on /cfg/user-scripts.d.

This strikes a balance between two conflicting objectives:

  1. There should be no implicit way to schedule arbitrary code execution on the device, i.e. no default run-parts directory.
  2. It is very useful to have a way of scheduling arbitrary code execution on the device, e.g. being able to install a debug script on a production image.

With this feature, we still meet 1️⃣, since the feature has to be explicitly enabled in the startup-config; but we also fulfill 2️⃣, since we can easily enable it when needed.

Other information

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

wkz added 2 commits May 21, 2024 22:02
Add a new service that, when enabled, will execute run-parts on
`/cfg/user-scripts.d`.

This strikes a balance between two conflicting objectives:

1. There should be no implicit way to schedule arbitrary code
   execution on the device, i.e. no default run-parts directory.

2. It is very useful to have a way of scheduling arbitrary code
   execution on the device, e.g. being able to install a debug script
   on a production image.

With this feature, we still meet (1), since the feature has to be
explicitly enabled in the startup-config; but we also fulfill (2),
since we can easily enable it when needed.
Verify that:
- Scripts are executed when the service is enabled
- Scripts are not enabled when the service is disabled
@wkz wkz requested a review from troglobit May 21, 2024 20:07
Copy link
Contributor

@troglobit troglobit left a comment

Choose a reason for hiding this comment

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

Other than my proposed change, I see no problem with this.

I like the warning, it should make it clear to anyone the risks involved with this.

Comment on lines +25 to +26
- Add support for optionally running user scripts from
`/cfg/user-scripts.d`
Copy link
Contributor

Choose a reason for hiding this comment

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

I liked the old name better, /cfg/start.d was short and sweet and also illustrative of when the scripts run (at startup-up).

Propose changing to that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I agree. I was trying to find a common name that would work both for the directory name and the service name.

Should we also change the name of the service in that case? Suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, good question. Maybe just plain start scripts?

Considering the Finit runparts supports SXXfoo and KXXbar style notation (appends start and stop to the script), maybe we want to add support for stop scripts later, i.e., scripts that run at shutdown/reboot?

@wkz
Copy link
Contributor Author

wkz commented May 22, 2024

After AFK discussion, we agree that we prefer to have the actual script content in the config as well.

Further discussions should happen in #463.

@wkz wkz closed this May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants