Validate our UUIDs and fix some formatting inconsistencies
This commit is contained in:
15
pvcf.py
15
pvcf.py
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user