Permalink
Browse files

Merge pull request #110 from garyd203/issue-104-fix2

Grid registration fixes
  • Loading branch information...
2 parents a733e34 + 320cb5e commit c0ddecfd0cdca0e710b630481213e26484762160 @detro committed Oct 31, 2012
Showing with 10 additions and 6 deletions.
  1. +9 −5 src/hub_register.js
  2. +1 −1 src/main.js
View
@@ -55,7 +55,7 @@ var nodeconf = function(ip, port, hub){
};
module.exports = {
- register: function(port, hub){
+ register: function(ip, port, hub){
var page = require('webpage').create();
port = +port;
if (!hub.match(/\/$/)) {
@@ -65,16 +65,20 @@ module.exports = {
/* Register with selenium grid server */
page.open(hub + 'grid/register', {
operation: 'post',
- data: JSON.stringify(nodeconf(port, hub)),
+ data: JSON.stringify(nodeconf(ip, port, hub)),
headers: {
'Content-Type': 'application/json'
}
}, function(status){
if (status !== 'success') {
- return console.log("Unable to register with grid " + hub + ": " + status);
- } else {
- return console.log(("registered with grid hub: " + hub) + page.content);
+ console.error("Unable to contact grid " + hub + ": " + status);
+ phantom.exit(1);
}
+ if (page.framePlainText !== "ok") {
+ console.error("Problem registering with grid " + hub + ": " + page.content);
+ phantom.exit(1);
+ }
+ console.log("Registered with grid hub: " + hub + " (" + page.framePlainText +")");
});
}
};
View
@@ -77,5 +77,5 @@ if (server.listen(listenOnPort, router.handle)) {
}
} else {
console.error("ERROR: Could not start Ghost Driver");
- phantom.exit();
+ phantom.exit(1);
}

0 comments on commit c0ddecf

Please sign in to comment.