Fix conditions for volumes 34/117534/3
authorEdyta Krukowska <edyta.krukowska@nokia.com>
Fri, 5 Feb 2021 08:01:44 +0000 (09:01 +0100)
committerEdyta Krukowska <edyta.krukowska@nokia.com>
Fri, 5 Feb 2021 08:16:32 +0000 (09:16 +0100)
Issue-ID: DCAEGEN2-2546
Signed-off-by: Edyta Krukowska <edyta.krukowska@nokia.com>
Change-Id: I62bb6a9bc6ed2efefafa491331ad1c5c477a924b

k8s/k8sclient/k8sclient.py
k8s/tests/test_k8sclient_deploy.py

index 3122e63..c1f378f 100644 (file)
@@ -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,
index 486029e..55daf3b 100644 (file)
@@ -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.