Skip to content

Commit

Permalink
Bugfix opx version string (#46)
Browse files Browse the repository at this point in the history
* Update OPX version regex to handle some versions of OPX that do not
enclose the version in quotes.
  • Loading branch information
bobbywatson3 authored Apr 6, 2018
1 parent 674414e commit 3f7990b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pylib/aeon/opx/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def gather_facts(self):

good, got = self.api.execute([
'hostname',
"""grep -oP '^OS_VERSION="\K.*\d' /etc/OPX-release-version""",
"""grep -oP '^PLATFORM="\K.*\w' /etc/OPX-release-version"""
"""grep -oP '^OS_VERSION=[\"]?\K.*\d' /etc/OPX-release-version""",
"""grep -oP '^PLATFORM=[\"]?\K.*\w' /etc/OPX-release-version"""
])

facts['fqdn'] = got[0]['stdout'].strip()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def requirements(filename):

setup(
name="aeon-venos",
version="0.9.17",
version="0.9.18",
author="Jeremy Schulman",
url='https://github.com/Apstra/aeon-venos',
author_email="jeremy@apstra.com",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_opx.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def mock_execute(args, **kwargs):
results = []
for arg in args:
# os_version
if arg == """grep -oP '^OS_VERSION="\K.*\d' /etc/OPX-release-version""":
if arg == """grep -oP '^OS_VERSION=[\"]?\K.*\d' /etc/OPX-release-version""":
results.append({'stdout': grep_version_out})
# platform
if arg == """grep -oP '^PLATFORM="\K.*\w' /etc/OPX-release-version""":
if arg == """grep -oP '^PLATFORM=[\"]?\K.*\w' /etc/OPX-release-version""":
results.append({'stdout': grep_platform_out})
# hostname
elif arg == 'hostname':
Expand Down

0 comments on commit 3f7990b

Please sign in to comment.