Validate our UUIDs and fix some formatting inconsistencies

This commit is contained in:
2018-06-06 12:28:15 -04:00
parent 2c09ee2a17
commit eeeb54c23d
2 changed files with 95 additions and 18 deletions

15
pvcf.py
View File

@ -26,6 +26,17 @@ import lxml
import click
import operator
#
# Validate a UUID
#
def validateUUID(dom_uuid):
try:
uuid.UUID(dom_uuid, version=4)
return True
except ValueError:
return False
#
# Connect and disconnect from Zookeeper
#
@ -178,7 +189,7 @@ def searchClusterByUUID(zk, uuid):
name = name_list[index]
except ValueError:
# We didn't find anything
return None, None
return None
return name
@ -192,7 +203,7 @@ def searchClusterByName(zk, name):
uuid = uuid_list[index]
except ValueError:
# We didn't find anything
return None, None
return None
return uuid