From d28c8fcbfb7d652f769b209ce296415567fa3738 Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Mon, 27 May 2024 16:06:26 +0530 Subject: [PATCH 01/11] Revert edit_config signature updates in #653 (#640) * Revert edit_config signature updates in #653 Signed-off-by: NilashishC * Add changelog Signed-off-by: NilashishC * Revert RMBase changes Signed-off-by: NilashishC --------- Signed-off-by: NilashishC --- changelogs/fragments/bug_653.yaml | 3 +++ .../module_utils/network/common/rm_base/resource_module.py | 4 ++-- plugins/plugin_utils/cliconf_base.py | 3 --- 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/bug_653.yaml diff --git a/changelogs/fragments/bug_653.yaml b/changelogs/fragments/bug_653.yaml new file mode 100644 index 000000000..1fe268b20 --- /dev/null +++ b/changelogs/fragments/bug_653.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - The v6.1.2 release introduced a change in cliconfbase's edit_config() signature which broke many platform cliconfs. This patch would revert that change. diff --git a/plugins/module_utils/network/common/rm_base/resource_module.py b/plugins/module_utils/network/common/rm_base/resource_module.py index 1bbefd515..7fd97c132 100644 --- a/plugins/module_utils/network/common/rm_base/resource_module.py +++ b/plugins/module_utils/network/common/rm_base/resource_module.py @@ -145,9 +145,9 @@ def compare(self, parsers, want=None, have=None): else: self.addcmd(have, parser, True) - def run_commands(self, err_responses=None): + def run_commands(self): """Send commands to the device""" if self.commands and self.state in self.ACTION_STATES: if not self._module.check_mode: - self._connection.edit_config(candidate=self.commands, err_responses=err_responses) + self._connection.edit_config(candidate=self.commands) self.changed = True diff --git a/plugins/plugin_utils/cliconf_base.py b/plugins/plugin_utils/cliconf_base.py index b3c1941df..c48873391 100644 --- a/plugins/plugin_utils/cliconf_base.py +++ b/plugins/plugin_utils/cliconf_base.py @@ -215,7 +215,6 @@ def edit_config( replace=None, diff=False, comment=None, - err_responses=None, ): """Loads the candidate configuration into the network device @@ -235,8 +234,6 @@ def edit_config( the file in this case should be present on the remote host in the mentioned path as a prerequisite. :param comment: Commit comment provided it is supported by remote host. - :param err_responses: A list of error regexes that will be used to evaluate the responses received - from executing the candidate command(s). :return: Returns a json string with contains configuration applied on remote host, the returned response on executing configuration commands and platform relevant data. { From 4334ebc53168086f137d2a5c72ccb5f87be08cf7 Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Thu, 30 May 2024 11:54:57 +0530 Subject: [PATCH 02/11] Prepare for release v6.1.3 (#642) Signed-off-by: NilashishC --- CHANGELOG.rst | 7 +++++++ changelogs/changelog.yaml | 8 ++++++++ changelogs/fragments/bug_653.yaml | 3 --- 3 files changed, 15 insertions(+), 3 deletions(-) delete mode 100644 changelogs/fragments/bug_653.yaml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b1bb37ecd..c89b8f4ce 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,13 @@ Ansible Netcommon Collection Release Notes .. contents:: Topics +v6.1.3 +====== + +Bugfixes +-------- + +- The v6.1.2 release introduced a change in cliconfbase's edit_config() signature which broke many platform cliconfs. This patch release reverts that change. v6.1.2 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index a72e63459..d071d2b3c 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -766,3 +766,11 @@ releases: fragments: - 614-fix-parse_cli_textfsm-doc.yaml release_date: "2024-05-22" + 6.1.3: + changes: + bugfixes: + - The v6.1.2 release introduced a change in cliconfbase's edit_config() signature + which broke many platform cliconfs. This patch release reverts that change. + fragments: + - bug_653.yaml + release_date: "2024-05-29" diff --git a/changelogs/fragments/bug_653.yaml b/changelogs/fragments/bug_653.yaml deleted file mode 100644 index 1fe268b20..000000000 --- a/changelogs/fragments/bug_653.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - The v6.1.2 release introduced a change in cliconfbase's edit_config() signature which broke many platform cliconfs. This patch would revert that change. From 5cf24ae5732e79cb6f6f835313f31f7692aaeece Mon Sep 17 00:00:00 2001 From: Nilashish Chakraborty Date: Thu, 30 May 2024 11:57:41 +0530 Subject: [PATCH 03/11] Update galaxy.yml --- galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galaxy.yml b/galaxy.yml index 4fc846ef4..4414334ad 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -13,4 +13,4 @@ readme: README.md repository: https://github.com/ansible-collections/ansible.netcommon issues: https://github.com/ansible-collections/ansible.netcommon/issues tags: [networking, security, cloud, network_cli, netconf, httpapi, grpc] -version: 6.1.2 +version: 6.1.3 From 78f628e339dca8dcede89f1e309773e28c1447ea Mon Sep 17 00:00:00 2001 From: Jonathan Lung Date: Mon, 10 Jun 2024 06:49:29 -0400 Subject: [PATCH 04/11] Fix routeros net put (#595) * Update changelog to indicate fix * Fix RouterOS net_put * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: jonathan lung Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sagar Paul --- changelogs/fragments/fix-routeros-net_put.yaml | 3 +++ plugins/action/net_put.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/fix-routeros-net_put.yaml diff --git a/changelogs/fragments/fix-routeros-net_put.yaml b/changelogs/fragments/fix-routeros-net_put.yaml new file mode 100644 index 000000000..ace19aed6 --- /dev/null +++ b/changelogs/fragments/fix-routeros-net_put.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Handle sftp error messages for file not present for routerOS. diff --git a/plugins/action/net_put.py b/plugins/action/net_put.py index e3db728bc..9ec7c2610 100644 --- a/plugins/action/net_put.py +++ b/plugins/action/net_put.py @@ -150,7 +150,7 @@ def _handle_existing_file(self, conn, source, dest, proto, timeout): ) except ConnectionError as exc: error = to_text(exc) - if error.endswith("No such file or directory"): + if error.endswith("No such file or directory") or "File doesn't exist" in error: if os.path.exists(tmp_source_file): os.remove(tmp_source_file) return True From 2d3cea0086e12c626df523e2af1e0a7dcaeba7c0 Mon Sep 17 00:00:00 2001 From: Sagar Paul Date: Mon, 10 Jun 2024 16:43:17 +0530 Subject: [PATCH 05/11] Bump min ansible-core version to 2.15.0 (#644) * Bump min ansible-core version to 2.15.0 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update changelogs/fragments/min_215.yaml Co-authored-by: Nilashish Chakraborty * Add libssh specific changes * revert libssh specific changes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Vinay M <63404819+roverflow@users.noreply.github.com> Co-authored-by: Nilashish Chakraborty --- README.md | 2 +- changelogs/fragments/min_215.yaml | 6 ++++++ meta/runtime.yml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/min_215.yaml diff --git a/README.md b/README.md index 16486c3c5..4b23b22dc 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This includes connection plugins, such as ``network_cli``, ``httpapi``, and ``ne ## Ansible version compatibility -This collection has been tested against following Ansible versions: **>=2.14.0**. +This collection has been tested against following Ansible versions: **>=2.15.0**. For collections that support Ansible 2.9, please ensure you update your `network_os` to use the fully qualified collection name (for example, `cisco.ios.ios`). diff --git a/changelogs/fragments/min_215.yaml b/changelogs/fragments/min_215.yaml new file mode 100644 index 000000000..83b5b586e --- /dev/null +++ b/changelogs/fragments/min_215.yaml @@ -0,0 +1,6 @@ +--- +release_summary: > + Starting from this release, the minimum `ansible-core` version this collection requires is `2.15.0`. + The last known version compatible with ansible-core<2.15 is v6.1.3. +major_changes: + - Bumping `requires_ansible` to `>=2.15.0`, since previous ansible-core versions are EoL now. diff --git a/meta/runtime.yml b/meta/runtime.yml index 337da6910..be0d8febb 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: ">=2.14.0" +requires_ansible: ">=2.15.0" plugin_routing: action: grpc_config: From 180bee7f14189de3ab3df74d3990cca693cddfe9 Mon Sep 17 00:00:00 2001 From: Sagar Paul Date: Mon, 10 Jun 2024 16:48:34 +0530 Subject: [PATCH 06/11] Fix libssh get api call (#646) --- changelogs/fragments/libssh_get.yaml | 5 +++++ plugins/connection/libssh.py | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/libssh_get.yaml diff --git a/changelogs/fragments/libssh_get.yaml b/changelogs/fragments/libssh_get.yaml new file mode 100644 index 000000000..6ee507b14 --- /dev/null +++ b/changelogs/fragments/libssh_get.yaml @@ -0,0 +1,5 @@ +--- +bugfixes: + - Fix get api call during scp with libssh. +known_issues: + - libssh - net_put and net_get fail when the destination file intended to be fetched is not present. diff --git a/plugins/connection/libssh.py b/plugins/connection/libssh.py index 50dec0288..4553c5c48 100644 --- a/plugins/connection/libssh.py +++ b/plugins/connection/libssh.py @@ -594,7 +594,10 @@ def fetch_file(self, in_path, out_path, proto="sftp"): elif proto == "scp": scp = self.ssh.scp() try: - scp.get(out_path, in_path) + # this abruptly closes the connection when + # scp.get fails only when the file is not there + # it works fine if the file is actually present + scp.get(in_path, out_path) except LibsshSCPException as exc: raise AnsibleError("Error transferring file from %s: %s" % (out_path, to_text(exc))) else: From 5f2cda7157230d31df9dcd184bd8579d0227abe7 Mon Sep 17 00:00:00 2001 From: Sagar Paul Date: Mon, 10 Jun 2024 17:09:08 +0530 Subject: [PATCH 07/11] Prep release 7.0.0 (#647) --- CHANGELOG.rst | 26 +++++++++++++++++++ changelogs/changelog.yaml | 20 ++++++++++++++ .../fragments/fix-routeros-net_put.yaml | 3 --- changelogs/fragments/libssh_get.yaml | 5 ---- changelogs/fragments/min_215.yaml | 6 ----- 5 files changed, 46 insertions(+), 14 deletions(-) delete mode 100644 changelogs/fragments/fix-routeros-net_put.yaml delete mode 100644 changelogs/fragments/libssh_get.yaml delete mode 100644 changelogs/fragments/min_215.yaml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c89b8f4ce..540f7a1a9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,32 @@ Ansible Netcommon Collection Release Notes .. contents:: Topics + +v7.0.0 +====== + +Release Summary +--------------- + +Starting from this release, the minimum `ansible-core` version this collection requires is `2.15.0`. The last known version compatible with ansible-core<2.15 is v6.1.3. + + +Major Changes +------------- + +- Bumping `requires_ansible` to `>=2.15.0`, since previous ansible-core versions are EoL now. + +Bugfixes +-------- + +- Fix get api call during scp with libssh. +- Handle sftp error messages for file not present for routerOS. + +Known Issues +------------ + +- libssh - net_put and net_get fail when the destination file intended to be fetched is not present. + v6.1.3 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index d071d2b3c..3eeb7240b 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -774,3 +774,23 @@ releases: fragments: - bug_653.yaml release_date: "2024-05-29" + 7.0.0: + changes: + bugfixes: + - Fix get api call during scp with libssh. + - Handle sftp error messages for file not present for routerOS. + known_issues: + - libssh - net_put and net_get fail when the destination file intended to be + fetched is not present. + major_changes: + - Bumping `requires_ansible` to `>=2.15.0`, since previous ansible-core versions + are EoL now. + release_summary: + "Starting from this release, the minimum `ansible-core` version + this collection requires is `2.15.0`. The last known version compatible with + ansible-core<2.15 is v6.1.3." + fragments: + - fix-routeros-net_put.yaml + - libssh_get.yaml + - min_215.yaml + release_date: "2024-06-10" diff --git a/changelogs/fragments/fix-routeros-net_put.yaml b/changelogs/fragments/fix-routeros-net_put.yaml deleted file mode 100644 index ace19aed6..000000000 --- a/changelogs/fragments/fix-routeros-net_put.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bugfixes: - - Handle sftp error messages for file not present for routerOS. diff --git a/changelogs/fragments/libssh_get.yaml b/changelogs/fragments/libssh_get.yaml deleted file mode 100644 index 6ee507b14..000000000 --- a/changelogs/fragments/libssh_get.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -bugfixes: - - Fix get api call during scp with libssh. -known_issues: - - libssh - net_put and net_get fail when the destination file intended to be fetched is not present. diff --git a/changelogs/fragments/min_215.yaml b/changelogs/fragments/min_215.yaml deleted file mode 100644 index 83b5b586e..000000000 --- a/changelogs/fragments/min_215.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -release_summary: > - Starting from this release, the minimum `ansible-core` version this collection requires is `2.15.0`. - The last known version compatible with ansible-core<2.15 is v6.1.3. -major_changes: - - Bumping `requires_ansible` to `>=2.15.0`, since previous ansible-core versions are EoL now. From 792f063b9e2d812b6301b5d2f9f045bf237c9409 Mon Sep 17 00:00:00 2001 From: Sagar Paul Date: Mon, 10 Jun 2024 18:50:15 +0530 Subject: [PATCH 08/11] Update galaxy.yml (#648) --- galaxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/galaxy.yml b/galaxy.yml index 4414334ad..a6f853d73 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -13,4 +13,4 @@ readme: README.md repository: https://github.com/ansible-collections/ansible.netcommon issues: https://github.com/ansible-collections/ansible.netcommon/issues tags: [networking, security, cloud, network_cli, netconf, httpapi, grpc] -version: 6.1.3 +version: 7.0.0 From c89c1661bcd7791b9ca0b7a972832d5a4e735e23 Mon Sep 17 00:00:00 2001 From: Sagar Paul Date: Mon, 10 Jun 2024 21:05:07 +0530 Subject: [PATCH 09/11] update precommit ref (#649) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 291c14265..44d93b1d1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,8 +14,8 @@ repos: - id: no-commit-to-branch - id: trailing-whitespace - - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v4.0.0-alpha.8" + - repo: https://github.com/pycontribs/mirrors-prettier + rev: "v3.3.1" hooks: - id: prettier additional_dependencies: From 4348f9fb96f157568af90086a04f15490495dfcf Mon Sep 17 00:00:00 2001 From: Sagar Paul Date: Tue, 11 Jun 2024 14:58:40 +0530 Subject: [PATCH 10/11] Update tox-ansible.ini (#650) --- tox-ansible.ini | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tox-ansible.ini b/tox-ansible.ini index fe560ad9d..f1c7fce60 100644 --- a/tox-ansible.ini +++ b/tox-ansible.ini @@ -1,9 +1,2 @@ [ansible] -skip = - py3.7 - py3.8 - 2.9 - 2.10 - 2.11 - 2.12 - 2.13 +skip = "" From 3c8603d211aa3b7b40ac24465f86643145318184 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 14:04:31 +0530 Subject: [PATCH 11/11] [pre-commit.ci] pre-commit autoupdate (#651) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pycontribs/mirrors-prettier: v3.3.1 → v3.3.2](https://github.com/pycontribs/mirrors-prettier/compare/v3.3.1...v3.3.2) - [github.com/pycqa/flake8: 7.0.0 → 7.1.0](https://github.com/pycqa/flake8/compare/7.0.0...7.1.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 44d93b1d1..9f008c873 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/pycontribs/mirrors-prettier - rev: "v3.3.1" + rev: "v3.3.2" hooks: - id: prettier additional_dependencies: @@ -34,6 +34,6 @@ repos: - id: black - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + rev: 7.1.0 hooks: - id: flake8