Browse Source

[fix] credentials() handles all conversations

changes/27/509927/1
Alvaro Uría 3 years ago
parent
commit
557b0e5cd2
1 changed files with 12 additions and 8 deletions
  1. 12
    8
      requires.py

+ 12
- 8
requires.py View File

@@ -44,14 +44,18 @@ class KeystoneRequires(RelationBase):
44 44
         """
45 45
         Returns a dict of keystone admin credentials
46 46
         """
47
-        conv = self.conversation()
48
-        return {
49
-            'service_hostname': conv.get_remote('service_hostname'),
50
-            'service_port': conv.get_remote('service_port'),
51
-            'service_username': conv.get_remote('service_username'),
52
-            'service_password': conv.get_remote('service_password'),
53
-            'service_tenant_name': conv.get_remote('service_tenant_name')
54
-        }
47
+        convs = self.conversations()
48
+        if len(convs) > 0:
49
+            conv = convs[0]
50
+            return {
51
+                'service_hostname': conv.get_remote('service_hostname'),
52
+                'service_port': conv.get_remote('service_port'),
53
+                'service_username': conv.get_remote('service_username'),
54
+                'service_password': conv.get_remote('service_password'),
55
+                'service_tenant_name': conv.get_remote('service_tenant_name')
56
+            }
57
+        else:
58
+            return {}
55 59
 
56 60
     def auth_data_complete(self):
57 61
         data = self.credentials()

Loading…
Cancel
Save