diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 291c14265..9f008c873 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.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 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b1bb37ecd..540f7a1a9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 ====== 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/changelog.yaml b/changelogs/changelog.yaml index a72e63459..3eeb7240b 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -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" diff --git a/galaxy.yml b/galaxy.yml index 4fc846ef4..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.2 +version: 7.0.0 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: 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 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: 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. { 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 = ""