Commit 431e2f7a authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent af25290c
......@@ -69,6 +69,7 @@ cronRemover.schedule(' */2 * * * *', () => {
});
init()
async function init() {
await initToken()
......@@ -120,12 +121,12 @@ async function sleep(millis) {
async function initToken() {
let d = aruba.getDc()
if (typeof d === "undefined")
await aruba.init()
// remover()
aruba.logData()
}
......
......@@ -12,7 +12,7 @@ let serverId
//test()
async function test() {
ip = '94.177.244.45'
ip = '195.231.67.162'
for (let i = 0; i < AvailDc.length; i++) {
let servers = await getAllServers(AvailDc[i])
servers = servers.Value
......@@ -47,6 +47,8 @@ async function test() {
async function init() {
if (typeof foundDc !=="undefined")
return true
ip = await getIp()
for (let i = 0; i < AvailDc.length; i++) {
let servers = await getAllServers(AvailDc[i])
......@@ -60,7 +62,6 @@ async function init() {
let server = await getDetailsofServer(AvailDc[i], servers[j].ServerId)
server = server.Value
if (ip === server.NetworkAdapters[0].IPAddresses[0].Value) {
masterIp = server.NetworkAdapters[0].IPAddresses[0].Value
networkId = server.NetworkAdapters[0].Id
serverId = server.ServerId
foundDc = AvailDc[i]
......@@ -71,6 +72,8 @@ async function init() {
}
return true
}
......@@ -235,6 +238,7 @@ async function doRequest(url, body) {
resolve(JSON.parse(body))
} catch (e) {
console.log(e)
resolve(true)
// console.log('Problem --->' + options.url)
// console.log(e)
......@@ -299,6 +303,14 @@ function getIp() {
}
function logData()
{
console.log('foundDc ->' + foundDc)
console.log('masterIp ->' + masterIp)
console.log('networkId ->' + networkId)
console.log('serverId ->' + serverId)
}
module.exports =
{
init: init,
......@@ -306,6 +318,7 @@ module.exports =
attachedToServerByIp: attachedToServerByIp,
RemovedByIp: RemovedByIp,
getDc: getDc,
logData:logData,
createFloatingIp: createFloatingIp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment