~mattyw/charms/precise/mongodb/mongo_persistence

« back to all changes in this revision

Viewing changes to hooks/hooks.py

  • Committer: Juan L. Negron
  • Date: 2012-11-17 03:36:10 UTC
  • mfrom: (23.1.1 mongodb)
  • Revision ID: juan.negron@canonical.com-20121117033610-62dq0su6fdlfyqm0
Merging new interfaces and shard fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1087
1087
def mongos_relation_changed():
1088
1088
    juju_log("mongos_relation_changed")
1089
1089
    config_data = config_get()
 
1090
    retVal = False
1090
1091
    for member in relation_list():
1091
1092
        hostname = relation_get('hostname', member)
1092
1093
        port = relation_get('port', member)
1110
1111
                mongos_host = "%s:%s" % (
1111
1112
                    unit_get('public-address'),
1112
1113
                    config_get('mongos_port'))
1113
 
                shard_command = "sh.addShard(\"%s:%s\")" % (hostname, port)
1114
 
                retVal = mongo_client(mongos_host, shard_command)
 
1114
                shard_command1 = "sh.addShard(\"%s:%s\")" % (hostname, port)
 
1115
                retVal1 = mongo_client(mongos_host, shard_command1)
 
1116
                replicaset = relation_get('replset', member)
 
1117
                shard_command2 = "sh.addShard(\"%s/%s:%s\")" % \
 
1118
                (replicaset, hostname, port)
 
1119
                retVal2 = mongo_client(mongos_host, shard_command2)
 
1120
                retVal = retVal1 is True and retVal2 is True
1115
1121
        else:
1116
1122
            juju_log("mongos_relation_change: undefined rel_type: %s" %
1117
1123
            rel_type)
1151
1157
    retVal = configsvr_relation_joined()
1152
1158
elif hook_name == "configsvr-relation-changed":
1153
1159
    retVal = configsvr_relation_changed()
 
1160
elif hook_name == "mongos-cfg-relation-joined":
 
1161
    retVal = mongos_relation_joined()
 
1162
elif hook_name == "mongos-cfg-relation-changed":
 
1163
    retVal = mongos_relation_changed()
 
1164
elif hook_name == "mongos-cfg-relation-broken":
 
1165
    retVal = mongos_relation_broken()
1154
1166
elif hook_name == "mongos-relation-joined":
1155
1167
    retVal = mongos_relation_joined()
1156
1168
elif hook_name == "mongos-relation-changed":