Skip to content

Commit d579c74

Browse files
authored
Add new argument err_responses to edit_config in CliconfBase (ansible-collections#635)
* Add new argument 'err_responses' to edit_config in CliconfBase Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com> * use kwargs Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com> --------- Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
1 parent 30cfdb3 commit d579c74

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

plugins/module_utils/network/common/rm_base/resource_module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ def compare(self, parsers, want=None, have=None):
145145
else:
146146
self.addcmd(have, parser, True)
147147

148-
def run_commands(self):
148+
def run_commands(self, err_responses=None):
149149
"""Send commands to the device"""
150150
if self.commands and self.state in self.ACTION_STATES:
151151
if not self._module.check_mode:
152-
self._connection.edit_config(self.commands)
152+
self._connection.edit_config(candidate=self.commands, err_responses=err_responses)
153153
self.changed = True

plugins/plugin_utils/cliconf_base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ def edit_config(
215215
replace=None,
216216
diff=False,
217217
comment=None,
218+
err_responses=None,
218219
):
219220
"""Loads the candidate configuration into the network device
220221
@@ -230,10 +231,12 @@ def edit_config(
230231
configuration should be pushed in the running configuration or discarded.
231232
232233
:param replace: If the value is True/False it indicates if running configuration should be completely
233-
replace by candidate configuration. If can also take configuration file path as value,
234+
replace by candidate configuration. It can also take configuration file path as value,
234235
the file in this case should be present on the remote host in the mentioned path as a
235236
prerequisite.
236-
:param comment: Commit comment provided it is supported by remote host
237+
:param comment: Commit comment provided it is supported by remote host.
238+
:param err_responses: A list of error regexes that will be used to evaluate the responses received
239+
from executing the candidate command(s).
237240
:return: Returns a json string with contains configuration applied on remote host, the returned
238241
response on executing configuration commands and platform relevant data.
239242
{

0 commit comments

Comments
 (0)