Skip to content

T8445: T8335: Extend config activation system#5096

Open
jestabro wants to merge 13 commits intovyos:currentfrom
jestabro:extend-activation-system
Open

T8445: T8335: Extend config activation system#5096
jestabro wants to merge 13 commits intovyos:currentfrom
jestabro:extend-activation-system

Conversation

@jestabro
Copy link
Copy Markdown
Contributor

@jestabro jestabro commented Mar 30, 2026

Change summary

The introduction of the config activation system was critical to resolving several issues of the migration system (T6006) but lacked flexibility. Extend to be (1) useful for additional scripts (2) correct for existing script.

Regarding (1), scripts were all or nothing, hence user modifications to config stanzas governed by an activation script would be overwritten on a subsequent boot, leading to (2) workarounds such as #4077, which is incorrect in the case of a raw image build.

After this PR is merged, vyos/vyos-build#1156 will be needed for application to images built with create_raw_image.

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):

Related Task(s)

Related PR(s)

How to test / Smoketest result

This is an extension of internal tools, however, one can see that (1) a fix for T6716 is preserved, yet (2) ethernet offload capabilities are correctly detected for systems booted from qcow2 images (3) T8335 is now correct (detection of previous installations from qcow2 images).

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

@jestabro jestabro self-assigned this Mar 30, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

👍
No issues in PR Title / Commit Title

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Extends the config activation system to support per-script activation state (persistent/once/off) and adds an op-mode interface for viewing and controlling activation scripts, aiming to avoid overwriting user config while still performing needed first-boot adjustments.

Changes:

  • Add an activation-list mechanism (generated at build time) plus runtime utilities to read/update activation state.
  • Update the activation runner to execute only active scripts and support optional pre_condition/post_condition hooks and one-shot deactivation.
  • Add new activation scripts to detect first installed boot and set config path hints; adjust ethernet offload activation behavior accordingly.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/op_mode/activation.py New op-mode command implementation for listing/showing scripts and setting activation state
src/helpers/run-config-activation.py Runner now consults activation state and supports pre/post hooks + once semantics
src/activation-scripts/example.py Example template for activation script structure and optional hooks
src/activation-scripts/20-ethernet-offload.py Adds post-condition to disable after first installed boot; adjusts live-boot gating behavior
src/activation-scripts/01-set-config-path-hint.py New script to set config path hint on first installed boot
src/activation-scripts/00-first-installed-boot.py New script to mark first installed boot and disable itself
scripts/generate-activation-scripts-json.py Build-time generator for default activation-list from activation scripts directory
python/vyos/utils/func.py Adds FalseCallable helper for optional hook defaults
python/vyos/utils/activate.py New shared utilities for activation-list access + first-boot/config-hint helpers
python/vyos/defaults.py Adds activation_list path default
op-mode-definitions/terminal.xml.in Adjusts help text for set node
op-mode-definitions/system-image.xml.in Adjusts help text for set node
op-mode-definitions/system-activation.xml.in New op-mode definitions for show system activation / set system activation
debian/vyos-1x.postinst Initializes activation-list in config dir on install
Makefile Runs activation-list generator as part of make all
.gitignore Ignores generated data/activation-list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jestabro jestabro force-pushed the extend-activation-system branch 2 times, most recently from bddce67 to aac7186 Compare March 30, 2026 20:57
@jestabro
Copy link
Copy Markdown
Contributor Author

jestabro commented Mar 30, 2026

Updates to address the legitimate point caught by copilot: for (1) package update on a live system or (2) system image update, one needs to conservatively update the activation-list. This is handled by an install script in vyos-1x.postinst, respectively, a check on reboot after a system update. There is intended redundancy in code for the two cases, as we do not want a library function in postinst, but do in the activation script runner.

@jestabro
Copy link
Copy Markdown
Contributor Author

Note that all linters pass in local tests; it is unclear as to the source of the listed linter failure.

@jestabro
Copy link
Copy Markdown
Contributor Author

Move to draft to distinguish default settings on image installation vs image upgrade.

@jestabro jestabro marked this pull request as draft March 31, 2026 02:21
@jestabro jestabro force-pushed the extend-activation-system branch from aac7186 to 8ef264a Compare April 6, 2026 14:49
@jestabro
Copy link
Copy Markdown
Contributor Author

jestabro commented Apr 6, 2026

Rebased over current, before adding updates to PR.

jestabro added 10 commits April 6, 2026 15:18
This is useful as default value for a getattr of a function from a
module.
Without establishing consistency for those scripts that include a help
message for 'set', one will still see that of system-image.xml.in:
"Install a new system"
Replace with a general message.
Add script to leave hint of first installed boot (as, say, distinguished
from first live boot, or subsequent); this is useful as pre/post
conditions and self-modification of activation scripts.
This is necessary for images produced from a raw_image build (qcow2),
which no longer make use of the image_installer script.
Use refined activation tools for correct behavior on first installed
boot.
@jestabro jestabro force-pushed the extend-activation-system branch from 717d0d3 to 21f1e42 Compare April 6, 2026 20:18
@jestabro jestabro marked this pull request as ready for review April 6, 2026 20:21
@jestabro jestabro requested a review from sever-sever April 6, 2026 20:21
@jestabro jestabro force-pushed the extend-activation-system branch from 21f1e42 to 81227c0 Compare April 6, 2026 20:31
@jestabro
Copy link
Copy Markdown
Contributor Author

jestabro commented Apr 6, 2026

Build failure above is an artifact of the recent change to workflow; vyos-build branch found, but does not pull correct branch within build-vyos-image, here:
https://github.com/vyos/vyos-build/blob/current/scripts/image-build/build-vyos-image#L111

@jestabro jestabro force-pushed the extend-activation-system branch from 81227c0 to 6c4122f Compare April 6, 2026 21:16
@jestabro
Copy link
Copy Markdown
Contributor Author

jestabro commented Apr 6, 2026

Added temp workaround to draft PR vyos/vyos-build#1156 to correct workflow issue mentioned above.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

CI integration 👍 passed!

Details

CI logs

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

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