Minor fix in Keystone charm config 51/10751/4
authorDavid Garcia <david.garcia@canonical.com>
Wed, 5 May 2021 14:51:40 +0000 (16:51 +0200)
committerDavid Garcia <david.garcia@canonical.com>
Wed, 5 May 2021 17:03:45 +0000 (19:03 +0200)
Fix the default value for the config ldap_user_enabled_default in the
Keystone charm, used by the charmed installation of OSM

Change-Id: I0272c1c7218d999e6d1ad7755883961ace997a81
Signed-off-by: David Garcia <david.garcia@canonical.com>
installers/charm/keystone/config.yaml
installers/charm/keystone/src/charm.py

index 2a54a3d..2758d1c 100644 (file)
@@ -191,7 +191,7 @@ options:
       enablement. However, some schemas might use an integer value in an
       attribute. In this situation, set user_enabled_default to the integer
       value that represents a user being enabled.
-    default: true
+    default: "true"
   ldap_user_enabled_invert:
     type: boolean
     description: |
index a8c69fe..5d8d317 100755 (executable)
@@ -118,7 +118,7 @@ class ConfigLdapModel(ModelValidator):
     ldap_user_filter: Optional[str]
     ldap_user_enabled_attribute: Optional[str]
     ldap_user_enabled_mask: Optional[int]
-    ldap_user_enabled_default: Optional[bool]
+    ldap_user_enabled_default: Optional[str]
     ldap_user_enabled_invert: Optional[bool]
     ldap_group_objectclass: Optional[str]
     ldap_group_tree_dn: Optional[str]
@@ -126,6 +126,13 @@ class ConfigLdapModel(ModelValidator):
     ldap_tls_cacert_base64: Optional[str]
     ldap_tls_req_cert: Optional[str]
 
+    @validator
+    def validate_ldap_user_enabled_default(cls, v):
+        if v:
+            if v not in ["true", "false"]:
+                raise ValueError('must be equal to "true" or "false"')
+        return v
+
 
 class KeystoneCharm(CharmedOsmBase):
     def __init__(self, *args) -> NoReturn: