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

fix(migration): handle truncated wan #1073

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

fix(migration): handle truncated wan #1073

wants to merge 2 commits into from

Conversation

gsanchietti
Copy link
Member

Avoid the following error when there is a conflict of names:

Traceback (most recent call last):
  File "/usr/share/ns-migration/20wan", line 89, in <module>
    mwan.store_policy(u, f'{pname[0:6]}_only', [i])
  File "/usr/lib/python3.11/site-packages/nethsec/mwan/__init__.py", line 257, in store_policy
nethsec.utils.ValidationError: ('name', 'unique', 'timene_only')
Before the commit, if a network was truncated to 15 chars, the new short name
was used inside the `network` config database but not inside the
`firewall` database: the firewall zone was pointing to a non existing
network,

Example:

- original name of the interface was 'timenet_ftth_12345'

- value saved inside the network db:

    config interface 'timenet_ftth_1'
        option proto 'static'

- value saved inside 'firewall' db:

    config zone 'ns_wan'
        option name 'wan'
        option output 'ACCEPT'
        option input 'DROP'
        option forward 'REJECT'
        list network 'timenet_ftth_12345'
@gsanchietti gsanchietti requested a review from Tbaile February 11, 2025 13:17
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.

1 participant