From e539028c2f9d062e7684abda5dd32affd92e9f08 Mon Sep 17 00:00:00 2001 From: lucaelin Date: Mon, 23 Feb 2026 13:25:35 +0100 Subject: add commit-confirm options to vyos_config (#229) * added vyos_config confirm options * fix: update commit comment to match main * fix: documentation example for automatic confirm * fix: add tests for commit confirm and confirm_timeout options * fix: add config_confirm changelog fragment * fix: lint missing diff parameter for edit_config * fix: add commit confirm integration test --------- Co-authored-by: omnom62 <75066712+omnom62@users.noreply.github.com> --- plugins/cliconf/vyos.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'plugins/cliconf') diff --git a/plugins/cliconf/vyos.py b/plugins/cliconf/vyos.py index c35ff1ec..17fcdf24 100644 --- a/plugins/cliconf/vyos.py +++ b/plugins/cliconf/vyos.py @@ -122,7 +122,9 @@ class Cliconf(CliconfBase): out = self.send_command(command) return out - def edit_config(self, candidate=None, commit=True, replace=None, comment=None): + def edit_config( + self, candidate=None, commit=True, replace=None, diff=False, comment=None, confirm=None + ): resp = {} operations = self.get_device_operations() self.check_edit_config_capability(operations, candidate, commit, replace, comment) @@ -143,7 +145,7 @@ class Cliconf(CliconfBase): if diff_config: if commit: try: - self.commit(comment) + self.commit(comment, confirm) except AnsibleConnectionFailure as e: msg = "commit failed: %s" % e.message self.discard_changes() @@ -191,12 +193,19 @@ class Cliconf(CliconfBase): check_all=check_all, ) - def commit(self, comment=None): - if comment: - command = 'commit comment "{0}"'.format(comment) + def commit(self, comment=None, confirm=None): + if confirm: + if comment: + command = 'commit-confirm {0} comment "{1}"'.format(confirm, comment) + else: + command = 'commit-confirm {0}'.format(confirm) + self.send_command(command, "Proceed?", "\n") else: - command = "commit" - self.send_command(command) + if comment: + command = 'commit comment "{0}"'.format(comment) + else: + command = "commit" + self.send_command(command) def discard_changes(self): self.send_command("exit discard") -- cgit v1.2.3