summaryrefslogtreecommitdiff
path: root/pycadf/resource.py
diff options
context:
space:
mode:
authorGordon Chung <chungg@ca.ibm.com>2013-09-05 14:31:23 -0400
committerGordon Chung <chungg@ca.ibm.com>2013-09-05 14:44:49 -0400
commit20e65dda8232bd30dc585d2184ed307474b4bcb6 (patch)
treed05e2791c552b2ab6ef8270dcbe8fdd6acf9f106 /pycadf/resource.py
parent2604405eb5d7f1acc3a4a130262fba1d14f5ac4e (diff)
downloadpycadf-20e65dda8232bd30dc585d2184ed307474b4bcb6.tar.gz
ensure unique id and timestamp defaults0.1.7
ceilometer CADF_EVENT.id and CADF_EVENT.eventTime always default to the same id and timestamp. fix other bad default values in __init__() Change-Id: Icd90e96264725ee274893bbd25f4b25cdb830598 Fixes: Bug #1221379
Diffstat (limited to 'pycadf/resource.py')
-rw-r--r--pycadf/resource.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/pycadf/resource.py b/pycadf/resource.py
index 9c447e6..879899e 100644
--- a/pycadf/resource.py
+++ b/pycadf/resource.py
@@ -80,13 +80,12 @@ class Resource(cadftype.CADFAbstractType):
geolocationId = cadftype.ValidatorDescriptor(
RESOURCE_KEYNAME_GEOID, lambda x: identifier.is_valid(x))
- def __init__(self, id=identifier.generate_uuid(),
- typeURI=cadftaxonomy.UNKNOWN, name=None, ref=None,
- domain=None, credential=None, host=None,
+ def __init__(self, id=None, typeURI=cadftaxonomy.UNKNOWN, name=None,
+ ref=None, domain=None, credential=None, host=None,
geolocation=None, geolocationId=None):
# Resource.id
- setattr(self, RESOURCE_KEYNAME_ID, id)
+ setattr(self, RESOURCE_KEYNAME_ID, id or identifier.generate_uuid())
# Resource.typeURI
setattr(self, RESOURCE_KEYNAME_TYPEURI, typeURI)