simplify grid by removing the region

This commit is contained in:
deflax 2018-04-02 15:30:42 +03:00
parent 05ce0fc4bc
commit 73f1856c56
2 changed files with 4 additions and 30 deletions

View file

@ -20,21 +20,12 @@ novnc_url = https://panel.example.com/novnc/vnc_lite.html
ssl_cert = /etc/letsencrypt/live/api.example.com/fullchain.pem
ssl_key = /etc/letsencrypt/live/api.example.com/privkey.pem
[Region]
regionid = 0
fullname = Region#1
ipv4_min = 87.120.110.40
ipv4_max = 87.120.110.240
[fighter]
type = proxmox
ipv4 = 2.3.4.5
password = dslfsdfds
regionid = Region
[warrior]
type = proxmox
ipv4 = 1.2.3.4
password = sadlaksda
regionid = Region

View file

@ -20,30 +20,13 @@ def auth(slave_name):
adminuser = ioconfig.parser.get('general', 'adminuser')
slaveip = ioconfig.parser.get(str(slave_name), 'ipv4')
slavepass = ioconfig.parser.get(str(slave_name), 'password')
slavetype = ioconfig.parser.get(str(slave_name), 'type')
if slavetype == 'proxmox':
proxobject = ProxmoxAPI(slaveip, user=adminuser, password=slavepass, verify_ssl=False)
return proxobject
def create(json):
""" create an unit. returns JSON with data """
try:
region_name = json['region']
region_id = ioconfig.parser.get(region_name, 'regionid')
region_fullname = ioconfig.parser.get(region_name, 'fullname')
except:
ioconfig.logger.error('grid> region not found')
return None
try:
region_name = json['region'] #just for the record. slaves are equal in the grid, as long as they are quieried
slave_name = json['slave']
except Exception as e:
ioconfig.logger.warning('grid> slave not predefined. I will query for a capable one.')
#slave_name = str(grid.query_happiness(region_id, weight))
#slave_name = 'warrior'
slave_name = 'lexx'
ioconfig.logger.info('{}> slave selected'.format(slave_name))
proxobject = auth(slave_name)
real_slave_name = proxobject.cluster.status.get()[0]['name']