From e02b2376494b4811502e1a407bb2a17a54af07bd Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Thu, 8 Mar 2018 17:55:43 -0500 Subject: [PATCH] Do not try to add an entry if none exist (#37152) (#37213) When commit revisions are disabled, there will be no revision items returned. Add note about setting ANSIBLE_PERSISTENT_COMMAND_TIMEOUT to a higer value to avoid timeouts. (cherry picked from commit 3134ba6bee9e0ede1f388bb6cd6df37053bcefa6) --- changelogs/fragments/edgeos_facts_empty_commit_history.yaml | 2 ++ lib/ansible/modules/network/edgeos/edgeos_config.py | 3 +++ lib/ansible/modules/network/edgeos/edgeos_facts.py | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/edgeos_facts_empty_commit_history.yaml diff --git a/changelogs/fragments/edgeos_facts_empty_commit_history.yaml b/changelogs/fragments/edgeos_facts_empty_commit_history.yaml new file mode 100644 index 00000000000..1c43754c4a0 --- /dev/null +++ b/changelogs/fragments/edgeos_facts_empty_commit_history.yaml @@ -0,0 +1,2 @@ +bugfixes: + - edgeos_facts - fix error when there are no commit revisions (https://github.com/ansible/ansible/issues/37123) diff --git a/lib/ansible/modules/network/edgeos/edgeos_config.py b/lib/ansible/modules/network/edgeos/edgeos_config.py index ae124591f77..6ca11069d6a 100644 --- a/lib/ansible/modules/network/edgeos/edgeos_config.py +++ b/lib/ansible/modules/network/edgeos/edgeos_config.py @@ -27,6 +27,9 @@ description: in the device configuration. notes: - Tested against EdgeOS 1.9.7 + - Setting C(ANSIBLE_PERSISTENT_COMMAND_TIMEOUT) to 30 is recommended since + the save command can take longer than the default of 10 seconds on + some EdgeOS hardware. options: lines: description: diff --git a/lib/ansible/modules/network/edgeos/edgeos_facts.py b/lib/ansible/modules/network/edgeos/edgeos_facts.py index a22b4ac375c..d003854f56d 100644 --- a/lib/ansible/modules/network/edgeos/edgeos_facts.py +++ b/lib/ansible/modules/network/edgeos/edgeos_facts.py @@ -170,7 +170,7 @@ class Config(FactsBase): by=str(match.group(3)).strip(), via=str(match.group(4)).strip(), comment=None) - else: + elif entry: entry['comment'] = line.strip() self.facts['commits'] = entries