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

T7182: use Config instead of ConfigTreeQuery for get_interface_dict #4354

Merged
merged 2 commits into from
Feb 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/etc/netplug/vyos-netplug-dhcp-client
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@ import sys

from time import sleep

from vyos.configquery import ConfigTreeQuery
from vyos.config import Config
from vyos.configdict import get_interface_dict
from vyos.ifconfig import Interface
from vyos.ifconfig import Section
from vyos.utils.boot import boot_configuration_complete
from vyos.utils.commit import commit_in_progress
from vyos import airbag

airbag.enable()

if len(sys.argv) < 3:
airbag.noteworthy("Must specify both interface and link status!")
airbag.noteworthy('Must specify both interface and link status!')
sys.exit(1)

if not boot_configuration_complete():
airbag.noteworthy("System bootup not yet finished...")
airbag.noteworthy('System bootup not yet finished...')
sys.exit(1)

interface = sys.argv[1]
Expand All @@ -47,8 +48,10 @@ while commit_in_progress():
sleep(1)

in_out = sys.argv[2]
config = ConfigTreeQuery()
config = Config()

interface_path = ['interfaces'] + Section.get_config_path(interface).split()
_, interface_config = get_interface_dict(config, interface_path[:-1], ifname=interface, with_pki=True)
_, interface_config = get_interface_dict(
config, interface_path[:-1], ifname=interface, with_pki=True
)
Interface(interface).update(interface_config)
Loading