Commit 6d03d0aa authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 293fb21e
......@@ -103,6 +103,27 @@ class Hetzner {
}
async removeAllFloatingIps() {
try {
let ips = await this.getAllFloatingIps()
for (let i = 0; i < ips.length; i++) {
await this.delFloatingIp(ips[i].id)
}
} catch (e) {
}
return true
}
async getMasterServerId() {
try {
......
......@@ -48,7 +48,7 @@ async function newFloatingIpsOrder(req, res) {
let order = parseInt(req.params.num)
res.send('Floating Ips from ' + (order === 1 ? 'Nuremberg' : 'Falkenstein') + ' Requested')
let ips = await het.getAllFloatingIps()
if (ips.length === 0)
if (ips.length === 10)
return
let masterid = await het.getMasterServerId()
let floatNum = 10 - ips.length
......
......@@ -15,12 +15,12 @@ const cryptLib = require('@skavinvarnan/cryptlib');
const key = "6*sN_rZxHD4!X$=T";
let Hetzner = require('./Hetzner')
let het
postFloatingIps(['127.0.0.1','127.0.0.2'])
tesT()
async function tesT()
{
await init()
// let masterid=await het.getMasterServerId()
let d=await het.removeFloatingIpByIp('78.47.38.44')
let d=await het.removeAllFloatingIps('78.47.38.44')
console.log(d)
}
......
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