diff options
author | Edyta Krukowska <edyta.krukowska@nokia.com> | 2021-02-05 09:01:44 +0100 |
---|---|---|
committer | Edyta Krukowska <edyta.krukowska@nokia.com> | 2021-02-05 09:16:32 +0100 |
commit | 372ce44f89672ed0f38618e171a8b673090100e2 (patch) | |
tree | 305fba7119107883b222c83b783a1019c0f8e56a /k8s | |
parent | 8527090d2034a4ff2a54adc5f99b934652cc3bfe (diff) |
Fix conditions for volumes
Issue-ID: DCAEGEN2-2546
Signed-off-by: Edyta Krukowska <edyta.krukowska@nokia.com>
Change-Id: I62bb6a9bc6ed2efefafa491331ad1c5c477a924b
Diffstat (limited to 'k8s')
-rw-r--r-- | k8s/k8sclient/k8sclient.py | 4 | ||||
-rw-r--r-- | k8s/tests/test_k8sclient_deploy.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/k8s/k8sclient/k8sclient.py b/k8s/k8sclient/k8sclient.py index 3122e63..c1f378f 100644 --- a/k8s/k8sclient/k8sclient.py +++ b/k8s/k8sclient/k8sclient.py @@ -298,10 +298,10 @@ def _parse_volumes(volume_list): vname = str(uuid.uuid4()) vcontainer = v['container']['bind'] vro = (v['container'].get('mode') == 'ro') - if 'host' in v: + if ('host' in v) and ('path' in v['host']): vhost = v['host']['path'] volumes.append(client.V1Volume(name=vname, host_path=client.V1HostPathVolumeSource(path=vhost))) - if 'config_volume' in v: + if ('config_volume' in v) and ('name' in v['config_volume']): vconfig_volume = v['config_volume']['name'] volumes.append(client.V1Volume(name=vname, config_map=client.V1ConfigMapVolumeSource(default_mode="0644", name=vconfig_volume, diff --git a/k8s/tests/test_k8sclient_deploy.py b/k8s/tests/test_k8sclient_deploy.py index 486029e..55daf3b 100644 --- a/k8s/tests/test_k8sclient_deploy.py +++ b/k8s/tests/test_k8sclient_deploy.py @@ -2,7 +2,7 @@ # org.onap.dcae # ================================================================================ # Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved. -# Copyright (c) 2020 Nokia. All rights reserved. +# Copyright (c) 2020-2021 Nokia. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. |