diff options
-rw-r--r-- | lib/libbugzilla.js | 17 | ||||
-rw-r--r-- | update.rdf | 2 |
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() { @@ -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> |