Fix handling of grid node id

This commit is contained in:
Tomasz Wojtuń
2016-08-03 10:58:59 +02:00
parent 068c4e5d0a
commit 4ae1b28ff5

View File

@@ -51,10 +51,14 @@ async function postRequest (data, addr, port) {
jsonObject.configuration.url = `http://${addr}:${port}/wd/hub`;
jsonObject.configuration.host = addr;
jsonObject.configuration.port = port;
// re-serialize the configuration with the auto populated data
data = JSON.stringify(jsonObject);
}
// if the node config does not have id automatically add it
if (!jsonObject.configuration.id) {
jsonObject.configuration.id = `http://${jsonObject.configuration.host}:${jsonObject.configuration.port}`;
}
// re-serialize the configuration with the auto populated data
data = JSON.stringify(jsonObject);
// prepare the header
let post_headers = {
@@ -97,7 +101,7 @@ async function postRequest (data, addr, port) {
async function isAlreadyRegistered (jsonObject) {
//check if node is already registered
let id = `http://${jsonObject.configuration.host}:${jsonObject.configuration.port}`;
let id = jsonObject.configuration.id;
try {
let response = await request({
uri: `http://${jsonObject.configuration.hubHost}:${jsonObject.configuration.hubPort}/grid/api/proxy?id=${id}`,