diff --git a/changelogs/CHANGELOG.rst b/changelogs/CHANGELOG.rst index 7a7f44e..f2e7a2b 100644 --- a/changelogs/CHANGELOG.rst +++ b/changelogs/CHANGELOG.rst @@ -4,6 +4,15 @@ Ansible Network Collection for Dell EMC OS6 Release Notes .. contents:: Topics +v1.0.4 +====== + +Bugfixes +--------------- + +- Fix issue in using list of strings for `commands` argument for `os6_command` module +- Fix issue in using "os6_facts" module for non-legacy n-series platofrms + v1.0.3 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 5c0ebdc..eacac42 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -76,4 +76,12 @@ releases: fragments: - 1.0.3.yaml release_date: '2020-10-09' + 1.0.4: + changes: + bugfixes: + - Fix issue in using list of strings for `commands` argument for `os6_command` module + - Fix issue in using "os6_facts" module for non-legacy n-series platofrms + fragments: + - 1.0.4.yaml + release_date: "2020-11-17" diff --git a/galaxy.yml b/galaxy.yml index 8cbfd7f..eeeb0b4 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,6 +1,6 @@ namespace: dellemc name: os6 -version: 1.0.3 +version: 1.0.4 readme: README.md authors: - Komal Patil diff --git a/plugins/modules/os6_command.py b/plugins/modules/os6_command.py index dd7947a..31ebc52 100644 --- a/plugins/modules/os6_command.py +++ b/plugins/modules/os6_command.py @@ -35,7 +35,7 @@ module is not returned until the condition is satisfied or the number of retries has expired. type: list - elements: dict + elements: str required: true wait_for: description: @@ -165,7 +165,7 @@ def main(): """ argument_spec = dict( # { command: , prompt: , response: } - commands=dict(type='list', elements='dict', required=True), + commands=dict(type='list', elements='str', required=True), wait_for=dict(type='list', elements='str'), match=dict(default='all', choices=['all', 'any']), diff --git a/plugins/modules/os6_facts.py b/plugins/modules/os6_facts.py index 78f3c49..d2fafc9 100644 --- a/plugins/modules/os6_facts.py +++ b/plugins/modules/os6_facts.py @@ -165,7 +165,7 @@ def parse_hostname(self, data): return match.group(1) def parse_model(self, data): - match = re.search(r'System Model ID(.+)\s([A-Z0-9]*)\n', data, re.M) + match = re.search(r'System Model ID(.+)\s([-A-Z0-9]*)\n', data, re.M) if match: return match.group(2) @@ -286,13 +286,13 @@ def parse_neighbors(self, neighbors): if intf not in facts: facts[intf] = list() fact = dict() - fact['port'] = self.parse_lldp_port(en.split()[3]) - if (len(en.split()) > 4): - fact['host'] = self.parse_lldp_host(en.split()[4]) - else: - fact['host'] = "Null" + if len(en.split()) > 2: + fact['port'] = self.parse_lldp_port(en.split()[3]) + if (len(en.split()) > 4): + fact['host'] = self.parse_lldp_host(en.split()[4]) + else: + fact['host'] = "Null" facts[intf].append(fact) - return facts def parse_interfaces(self, data): @@ -300,7 +300,7 @@ def parse_interfaces(self, data): for line in data.split('\n'): if len(line) == 0: continue - match = re.match(r'Interface Name(.+)\s([A-Za-z0-9/]*)', line) + match = re.match(r'Interface Name(.+)\s([A-Za-z0-9/]*)', line, re.IGNORECASE) if match: key = match.group(2) parsed[key] = line @@ -309,18 +309,20 @@ def parse_interfaces(self, data): return parsed def parse_description(self, key, desc): - desc, desc_next = desc.split('--------- --------------- ------ ------- ---- ------ ----- -- -------------------') + desc = re.split(r'[-+\s](?:-+\s)[-+\s].*', desc, maxsplit=1) + desc_next = desc[1] if desc_next.find('Oob') > 0: desc_val, desc_info = desc_next.split('Oob') elif desc_next.find('Port') > 0: desc_val, desc_info = desc_next.split('Port') - for en in desc_val.splitlines(): - if key in en: - match = re.search(r'^(\S+)\s+(\S+)', en) - if match.group(2) in ['Full', 'N/A']: - return "Null" - else: - return match.group(2) + if desc_val: + for en in desc_val.splitlines(): + if key in en: + match = re.search(r'^(\S+)\s+(\S+)', en) + if match.group(2) in ['Full', 'N/A']: + return "Null" + else: + return match.group(2) def parse_macaddress(self, data): match = re.search(r'Burned In MAC Address(.+)\s([A-Z0-9.]*)\n', data)