Skip to content

Commit

Permalink
Add support Ansible2.10+ (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcgill298 authored Nov 19, 2020
1 parent 3bd7d68 commit 4239464
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.9.3]
### Fixed
- [#262] Account for Ansible Versions beyond 2.9

## [0.9.2]
### Fixed
- [#256] Made setup.py work with python2.7 again
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ pip install terminal

## Common Issues

#### Gather Facts
### Ansible 2.10

In order to use this with Ansible 2.10 and greater, the `packaging` python library must be installed.

### Gather Facts

Starting in Ansible 2.1 there is a name space conflict when gathering facts. The below message will indicate the issues:

Expand Down Expand Up @@ -141,7 +145,7 @@ rm ./ntc-templates/setup.py
```
See https://github.com/ansible/ansible/issues/20702 and https://github.com/ansible/ansible/pull/20717 for further details.

#### This module requires TextFSM
### This module requires TextFSM

Most often seen in virtual enviroments as per ansible's interpretation of which python binary you are using is not as expected. You can tell that you have reached this issue if you correctly have textfsm installed, but receive the following warning:

Expand Down
7 changes: 6 additions & 1 deletion library/ntc_config_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@


from ansible import __version__ as ansible_version
if float(ansible_version[:3]) < 2.4:
try:
from packaging import version
HAS_PACKAGING=True
except ImportError:
HAS_PACKAGING=False
if (HAS_PACKAGING and version.parse(ansible_version) < version.parse("2.4")) or (not HAS_PACKAGING and float(ansible_version[:3]) < 2.4):
raise ImportError("Ansible versions < 2.4 are not supported")


Expand Down
8 changes: 7 additions & 1 deletion library/ntc_show_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,14 @@
import os.path
import socket

try:
from packaging import version
HAS_PACKAGING = True
except ImportError:
HAS_PACKAGING = False
from ansible import __version__ as ansible_version
if float(ansible_version[:3]) < 2.4:

if (HAS_PACKAGING and version.parse(ansible_version) < version.parse("2.4")) or (not HAS_PACKAGING and float(ansible_version[:3]) < 2.4):
raise ImportError("Ansible versions < 2.4 are not supported")

HAS_NTC_TEMPLATES = True
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@
setup(
name='ntc-ansible',
packages=find_packages(),
version='0.9.2',
version='0.9.3',
description='Dependencies for NTC Ansible modules',
long_description=README,
long_description_content_type="text/markdown",
author='Jason Edelman',
author_email='[email protected]',
url='https://github.com/networktocode/ntc-ansible',
download_url='https://github.com/networktocode/ntc-ansible/tarball/0.1.0',
download_url='https://github.com/networktocode/ntc-ansible/tarball/0.9.3',
install_requires=[
'pynxos',
'pyntc',
'netmiko'
'netmiko',
'packaging',
],
)

0 comments on commit 4239464

Please sign in to comment.