Fix bug 1542 to allow juju to add Azure AKS 40/10940/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Fri, 28 May 2021 12:10:59 +0000 (14:10 +0200)
committergarciadav <david.garcia@canonical.com>
Wed, 2 Jun 2021 11:47:42 +0000 (13:47 +0200)
Storage classes in Azure might have no metadata annotations. This
change takes into account that situation.

Change-Id: I4f7151d2481b41fd8434e0d95ea5d1a156b68309
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
(cherry picked from commit e77a91e534731b45c8f9648fc99e3f2d25313fa7)

n2vc/kubectl.py

index bc8c392..d67f4db 100644 (file)
@@ -96,7 +96,7 @@ class Kubectl:
             if not selected_sc:
                 # Select the first storage class in case there is no a default-class
                 selected_sc = sc.metadata.name
-            annotations = sc.metadata.annotations
+            annotations = sc.metadata.annotations or {}
             if any(
                 k in annotations and annotations[k] == v
                 for k, v in default_sc_annotations.items()