First approximation of an 'apply' command, using cli_inband() for now

This commit is contained in:
Pim van Pelt
2025-11-10 01:59:28 +01:00
parent afe5dc0597
commit 35e3dc14b7
4 changed files with 42 additions and 124 deletions

View File

@@ -29,6 +29,7 @@ except ModuleNotFoundError:
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from vppcfg.config import Validator
from vppcfg._version import __version__
from vppcfg.vpp.applier import Applier
from vppcfg.vpp.planner import Planner
from vppcfg.vpp.dumper import Dumper
@@ -301,6 +302,13 @@ def main():
if args.command == "plan":
sys.exit(0)
if args.command == "apply":
applier = Applier(cfg, planner.get_commands())
if not applier.apply():
logging.error("Applying configuration failed")
sys.exit(-50)
logging.info("Apply succeeded")
sys.exit(0)