Skip to content

Commit

Permalink
Merge branch 'main' into remove_netaddr
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruchip16 authored Jul 3, 2024
2 parents f692648 + 3c8603d commit 2710c89
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.2"
hooks:
- id: prettier
additional_dependencies:
Expand All @@ -34,6 +34,6 @@ repos:
- id: black

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
rev: 7.1.0
hooks:
- id: flake8
33 changes: 33 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,39 @@ 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
======

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
======

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This includes connection plugins, such as ``network_cli``, ``httpapi``, and ``ne
<!--start requires_ansible-->
## 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`).
Expand Down
28 changes: 28 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -766,3 +766,31 @@ 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"
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"
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: 7.0.0
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
requires_ansible: ">=2.14.0"
requires_ansible: ">=2.15.0"
plugin_routing:
action:
grpc_config:
Expand Down
2 changes: 1 addition & 1 deletion plugins/action/net_put.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion plugins/connection/libssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions plugins/plugin_utils/cliconf_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ def edit_config(
replace=None,
diff=False,
comment=None,
err_responses=None,
):
"""Loads the candidate configuration into the network device
Expand All @@ -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.
{
Expand Down
9 changes: 1 addition & 8 deletions tox-ansible.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
[ansible]
skip =
py3.7
py3.8
2.9
2.10
2.11
2.12
2.13
skip = ""

0 comments on commit 2710c89

Please sign in to comment.