6
24
Fork
You've already forked ifstate
13

parser: add !flatten yaml tag #200

Open
lillian wants to merge 1 commit from lillian/ifstate:feat/yaml-flatten into main
pull from: lillian/ifstate:feat/yaml-flatten
merge into: routerkit:main
routerkit:main
routerkit:move-paths-into-module
routerkit:feature-libifstate-rs
routerkit:ifstate-2.4
routerkit:pages
routerkit:ifstate-2.1
routerkit:ifstate-2.3
routerkit:ifstate-2.0
routerkit:ifstate-2.2
routerkit:ifstate-1.x
Contributor
Copy link

This can be used to import part of a list, for instance anycast IP addresses in the lo interface:

# /etc/ifstate/ifstate.yamlinterfaces:lo:addresses:!flatten- 127.0.0.1/32- '::1/128'- !include /etc/ifstate/anycast-ips.yaml# /etc/ifstate/anycast-ips.yaml- 192.0.2.0/24- 198.51.100.0/24- 203.0.113.0/24- '2001:db8::/32'
This can be used to import part of a list, for instance anycast IP addresses in the `lo` interface: ```yaml # /etc/ifstate/ifstate.yaml interfaces: lo: addresses: !flatten - 127.0.0.1/32 - '::1/128' - !include /etc/ifstate/anycast-ips.yaml # /etc/ifstate/anycast-ips.yaml - 192.0.2.0/24 - 198.51.100.0/24 - 203.0.113.0/24 - '2001:db8::/32' ```
parser: add !flatten yaml tag
Some checks failed
pull request build test / build (pull_request) Has been cancelled
60f9ba173a
lillian force-pushed feat/yaml-flatten from 60f9ba173a
Some checks failed
pull request build test / build (pull_request) Has been cancelled
to 108847b46e
Some checks failed
pull request build test / build (pull_request) Failing after 1m7s
pull request pages test / mike (pull_request) Failing after 1m36s
pre-commit / pre-commit (pull_request) Successful in 1m54s
pytest / python (pull_request) Successful in 1m29s
2026年06月29日 23:57:50 +02:00
Compare
Owner
Copy link

Thanks for the PR, there is some upcoming work on the config parsing and we need to check if tagging can be implemented in the same way. So I need to delay this PR until this has been settled.

Thanks for the PR, there is some upcoming work on the config parsing and we need to check if tagging can be implemented in the same way. So I need to delay this PR until this has been settled.
Member
Copy link

Unfortunately the code doesn't work.

As we've just recently added pytest integration, those are the kinds of things we can catch earlier by providing unit tests. I've added a test in ctheune/ifstate@8fe44831bf

Unfortunately the code doesn't work. As we've just recently added pytest integration, those are the kinds of things we can catch earlier by providing unit tests. I've added a test in https://codeberg.org/ctheune/ifstate/commit/8fe44831bfaafaa5d11c2516e784ed13034a4299
lillian force-pushed feat/yaml-flatten from 108847b46e
Some checks failed
pull request build test / build (pull_request) Failing after 1m7s
pull request pages test / mike (pull_request) Failing after 1m36s
pre-commit / pre-commit (pull_request) Successful in 1m54s
pytest / python (pull_request) Successful in 1m29s
to d80faf750b
Some checks are pending
pull request build test / build (pull_request) Blocked by required conditions
pre-commit / pre-commit (pull_request) Blocked by required conditions
pytest / python (pull_request) Blocked by required conditions
2026年07月05日 03:43:00 +02:00
Compare
Author
Contributor
Copy link

derp, bad copy-paste... just pushed a fixed patch.

derp, bad copy-paste... just pushed a fixed patch.
Member
Copy link

I suggest you also pick the changes from my branch that introduce test coverage. I don't want to hijack your PR and your credit!

I suggest you also pick the changes from my branch that introduce test coverage. I don't want to hijack your PR and your credit!
Some checks are pending
pull request build test / build (pull_request) Blocked by required conditions
pre-commit / pre-commit (pull_request) Blocked by required conditions
pytest / python (pull_request) Blocked by required conditions
This pull request can be merged automatically.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feat/yaml-flatten:lillian-feat/yaml-flatten
git switch lillian-feat/yaml-flatten
Sign in to join this conversation.
No reviewers
Labels
Clear labels
bug
Something isn't working
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
more info
Further details are required, the problem may not yet be reproducible, yet
question
Further information is requested
TBD
To be discussed
wontfix
This will not be worked on
AI slop
Burning out
bug
Something is not working
contribution welcome
Contributions are very welcome, get started here
duplicate
This issue or pull request already exists
enhancement
New feature
good first issue
Interested in contributing? Get started here.
help wanted
Need some help
invalid
Something is wrong
question
More information is needed
upstream
Related to an upstream repository, already reported there
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
routerkit/ifstate!200
Reference in a new issue
routerkit/ifstate
No description provided.
Delete branch "lillian/ifstate:feat/yaml-flatten"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?