Skip to content

Commit

Permalink
GH-465 Fix getClientVersion.
Browse files Browse the repository at this point in the history
getClientVersion now returns a version format as expected from cleos version client.

If fullVersion is enabled, cleos full version will be returned which includes commit version.
  • Loading branch information
oschwaldp-oci committed Jul 13, 2022
1 parent f04f8ba commit 098fe05
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/Cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,16 +603,23 @@ def doNodesHaveBlockNum(nodes, targetBlockNum, blockType, printCount):
return ret

@staticmethod
def getClientVersion(verbose=False):
def getClientVersion(fullVersion=False):
"""Returns client version (string)"""
p = re.compile(r'^v?(.+)\n$')
try:
cmd="%s version client" % (Utils.EosClientPath)
if verbose: Utils.Print("cmd: %s" % (cmd))
if fullVersion: cmd="%s version full" % (Utils.EosClientPath)
if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
response=Utils.checkOutput(cmd.split())
assert(response)
assert(isinstance(response, str))
if verbose: Utils.Print("response: <%s>" % (response))
verStr=response.strip()
if Utils.Debug: Utils.Print("response: <%s>" % (response))
m=p.match(response)
if m is None:
Utils.Print("ERROR: client version regex mismatch")
return None

verStr=m.group(1)
return verStr
except subprocess.CalledProcessError as ex:
msg=ex.output.decode("utf-8")
Expand Down

0 comments on commit 098fe05

Please sign in to comment.