Ubuntu Pastebin

Paste from ubuntu at Mon, 3 Aug 2015 13:08:30 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
=== modified file 'hooks/charmhelpers/contrib/peerstorage/__init__.py'
--- hooks/charmhelpers/contrib/peerstorage/__init__.py	2015-06-04 08:45:11 +0000
+++ hooks/charmhelpers/contrib/peerstorage/__init__.py	2015-08-03 13:03:58 +0000
@@ -59,7 +59,7 @@
 """
 
 
-def leader_get(attribute=None):
+def leader_get(attribute=None, rid=None):
     """Wrapper to ensure that settings are migrated from the peer relation.
 
     This is to support upgrading an environment that does not support
@@ -94,7 +94,10 @@
         # If attribute not present in leader db, check if this unit has set
         # the attribute in the peer relation
         if not leader_settings:
-            peer_setting = relation_get(attribute=attribute, unit=local_unit())
+            print("Calling relation_get with no rid")
+            print(locals())
+            peer_setting = _relation_get(attribute=attribute, unit=local_unit(),
+                                         rid=rid)
             if peer_setting:
                 leader_set(settings={attribute: peer_setting})
                 leader_settings = peer_setting
@@ -103,7 +106,7 @@
             settings_migrated = True
             migrated.add(attribute)
     else:
-        r_settings = relation_get(unit=local_unit())
+        r_settings = relation_get(unit=local_unit(), rid=rid)
         if r_settings:
             for key in set(r_settings.keys()).difference(migrated):
                 # Leader setting wins
@@ -151,7 +154,7 @@
     """
     try:
         if rid in relation_ids('cluster'):
-            return leader_get(attribute)
+            return leader_get(attribute, rid)
         else:
             raise NotImplementedError
     except NotImplementedError:
Download as text