metadata.resourceVersion: Invalid value
Fixed error: metadata.resourceVersion: Invalid value: \"\": must be specified for an update when annotating Change-Id: I0e9ad64eae5a8ee42778c0fa50a3a3345ff25115 Closes-Bug: 1722142
This commit is contained in:
parent
c4b897262b
commit
05a25af13f
|
@ -94,12 +94,10 @@ class K8sClient(object):
|
|||
if self.token:
|
||||
header.update({'Authorization': 'Bearer %s' % self.token})
|
||||
while itertools.count(1):
|
||||
data = jsonutils.dumps({
|
||||
"metadata": {
|
||||
"annotations": annotations,
|
||||
"resourceVersion": resource_version,
|
||||
}
|
||||
}, sort_keys=True)
|
||||
metadata = {"annotations": annotations}
|
||||
if resource_version:
|
||||
metadata['resourceVersion'] = resource_version
|
||||
data = jsonutils.dumps({"metadata": metadata}, sort_keys=True)
|
||||
response = requests.patch(url, data=data,
|
||||
headers=header, cert=self.cert,
|
||||
verify=self.verify_server)
|
||||
|
@ -121,6 +119,11 @@ class K8sClient(object):
|
|||
LOG.debug("Annotations for %(path)s already present: "
|
||||
"%(names)s", {'path': path,
|
||||
'names': retrieved_annotations})
|
||||
|
||||
LOG.error("Exception response, headers: %(headers)s, "
|
||||
"content: %(content)s, text: %(text)s"
|
||||
% {'headers': response.headers,
|
||||
'content': response.content, 'text': response.text})
|
||||
raise exc.K8sClientException(response.text)
|
||||
|
||||
def watch(self, path):
|
||||
|
|
Loading…
Reference in New Issue