simplify grid by removing the region
This commit is contained in:
parent
05ce0fc4bc
commit
73f1856c56
2 changed files with 4 additions and 30 deletions
|
@ -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
|
||||
|
|
25
plugin.py
25
plugin.py
|
@ -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
|
||||
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:
|
||||
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))
|
||||
region_name = json['region'] #just for the record. slaves are equal in the grid, as long as they are quieried
|
||||
slave_name = json['slave']
|
||||
proxobject = auth(slave_name)
|
||||
real_slave_name = proxobject.cluster.status.get()[0]['name']
|
||||
|
||||
|
|
Loading…
Reference in a new issue