Skip to content

Commit

Permalink
Merge pull request #35 from stacywsmith/issue_33
Browse files Browse the repository at this point in the history
Handle new version output for 15.1+ releases on MX (FreeBSD10 based)
  • Loading branch information
vnitinv committed Nov 20, 2015
2 parents f4e3eec + ce7ccca commit 7c04376
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions lib/netconify/facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,18 @@ def version(self):
self.swinfo = rsp # keep this since we may want it later

# extract the version
pkginfo = rsp.xpath(
'.//package-information[name = "junos"]/comment')[0].text
self.facts['version'] = re.findall(r'\[(.*)\]', pkginfo)[0]
# First try the <junos-version> tag present in >= 15.1
swinfo = rsp.xpath('.//junos-version')[0].text
if not swinfo:
# For < 15.1, get version from the "junos" package.
pkginfo = rsp.xpath(
'.//package-information[normalize-space(name)="junos"]/comment'
)[0].text
try:
swinfo = re.findall(r'\[(.*)\]', pkginfo)[0]
except:
swinfo = "0.0I0.0"
self.facts['version'] = swinfo

# extract the host-name
self.facts['hostname'] = rsp.xpath('.//host-name')[0].text
Expand Down
2 changes: 1 addition & 1 deletion lib/netconify/tty.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Terminal(object):
_re_pat_login,
'(?P<passwd>assword:\s*$)',
'(?P<badpasswd>ogin incorrect)',
'(?P<shell>%\s*$)',
'(?P<shell>%|#\s*$)',
'(?P<cli>[^\\-"]>\s*$)'
]

Expand Down

0 comments on commit 7c04376

Please sign in to comment.