Skip to content

Commit a1c4554

Browse files
authored
Merge pull request #127 from napalm-automation/develop
Release 0.9.1 to fix pip10 issue
2 parents 6f2ec6c + caa6cc5 commit a1c4554

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

CHANGELOG.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
develop
22
=====
33

4+
- Add support for saving `candidate_file` during the config install
5+
46
0.9.0
57
=====
68

napalm_ansible/modules/napalm_install_config.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@
109109
retrieved if not set.
110110
default: None
111111
required: False
112+
candidate_file:
113+
description:
114+
- File to store backup of candidate config from device. This is the
115+
config we are intending to install, before we roll back to the
116+
running_config.
117+
default: None
118+
required: False
112119
'''
113120

114121
EXAMPLES = '''
@@ -193,7 +200,8 @@ def main():
193200
replace_config=dict(type='bool', required=False, default=False),
194201
diff_file=dict(type='str', required=False, default=None),
195202
get_diffs=dict(type='bool', required=False, default=True),
196-
archive_file=dict(type='str', required=False, default=None)
203+
archive_file=dict(type='str', required=False, default=None),
204+
candidate_file=dict(type='str', required=False, default=None)
197205
),
198206
supports_check_mode=True
199207
)
@@ -231,6 +239,7 @@ def main():
231239
diff_file = module.params['diff_file']
232240
get_diffs = module.params['get_diffs']
233241
archive_file = module.params['archive_file']
242+
candidate_file = module.params['candidate_file']
234243

235244
argument_check = {'hostname': hostname, 'username': username, 'dev_os': dev_os}
236245
for key, val in argument_check.items():
@@ -291,6 +300,13 @@ def main():
291300
except Exception as e:
292301
module.fail_json(msg="cannot diff config: " + str(e))
293302

303+
try:
304+
if candidate_file is not None:
305+
running_config = device.get_config(retrieve="candidate")["candidate"]
306+
save_to_file(running_config, candidate_file)
307+
except Exception, e:
308+
module.fail_json(msg="cannot retrieve running config:" + str(e))
309+
294310
try:
295311
if module.check_mode or not commit_changes:
296312
device.discard_config()

setup.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
"""setup.py file."""
2-
import uuid
3-
42
from setuptools import setup, find_packages
5-
from pip.req import parse_requirements
6-
7-
8-
install_reqs = parse_requirements('requirements.txt', session=uuid.uuid1())
9-
reqs = [str(ir.req) for ir in install_reqs]
103

4+
with open("requirements.txt", "r") as fs:
5+
reqs = [r for r in fs.read().splitlines() if (len(r) > 0 and not r.startswith("#"))]
116

127
setup(
138
name="napalm-ansible",
14-
version='0.9.0',
9+
version='0.9.1',
1510
packages=find_packages(exclude=("test*", "library")),
1611
author="David Barroso, Kirk Byers, Mircea Ulinic",
1712

0 commit comments

Comments
 (0)