aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-09-04 03:11:54 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-09-04 03:11:54 +0200
commit78f2a9dc142341ba361420c63200a60c6d58da81 (patch)
treec4112fa2a0d894ea166a966185d5c8a2a101a63b
parent0014ff57d8e54faf0067e1f82340ed78bfc53a5c (diff)
downloadbugzilla-triage-78f2a9dc142341ba361420c63200a60c6d58da81.tar.gz
Add some comments on very ugly function libbz.loginToAllBugzillas.
-rw-r--r--lib/libbugzilla.js17
-rw-r--r--update.rdf2
2 files changed, 12 insertions, 7 deletions
diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js
index d03cd3c..f7ae37b 100644
--- a/lib/libbugzilla.js
+++ b/lib/libbugzilla.js
@@ -294,16 +294,19 @@ exports.createUpstreamBug = function createUpstreamBug(urlStr, subjectStr, comme
};
function loginToAllBugzillas(callback) {
- var callbacksCounter = 0, bugzilla = "";
+ var loginCallsCounter = 0, bugzilla = "";
if ("enabledPackages" in config.gJSONData.configData) {
+ // For all bugzillas we are interested in ...
for (bugzillaHost in config.gJSONData.configData.enabledPackages) {
passUtils.search({
url: "https://" + bugzillaHost,
realm: BTSPassRealm,
+ // ... and for which we have credentials on file ...
onComplete: function onComplete(credentials) {
+ // (we can have more than one set of credentials per bugzilla;
+ // well, theoretically)
credentials.forEach(function(credential) {
- debug("credential = " + credential.toSource());
- // function makeJSONRPCCall(url, method, params, callback)
+ // ... login!
makeJSONRPCCall(credential.url + "/jsonrpc.cgi",
"User.login", {
login: credential.username,
@@ -311,13 +314,15 @@ function loginToAllBugzillas(callback) {
remember: false
}, function(logResult) {
debug("Logging as " + credential.username + " to " + credential.url);
- callbacksCounter--;
- if (callbacksCounter <= 0) {
+ loginCallsCounter--;
+ // When we complete all logins, execute the callback
+ if (loginCallsCounter <= 0) {
debug("All logins done!");
callback();
}
});
- callbacksCounter++;
+ // Increment call counter
+ loginCallsCounter++;
});
},
onError: function onError() {
diff --git a/update.rdf b/update.rdf
index 59d7c88..c81f272 100644
--- a/update.rdf
+++ b/update.rdf
@@ -127,7 +127,7 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
</em:targetApplication>
</Description>
</li>
- <li>
+ <li>
<Description>
<em:version>1.4.5</em:version>
<em:targetApplication>