mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-02-12 13:01:51 +00:00
allow for multiple proxmox hosts in case one fails
This commit is contained in:
parent
423e5ad119
commit
ecd7809749
2 changed files with 12 additions and 9 deletions
|
@ -24,7 +24,7 @@ OIDC_CLIENT_CONFIG = {
|
|||
}
|
||||
|
||||
# Proxmox
|
||||
PROXMOX_HOST = environ.get('PROXSTAR_PROXMOX_HOST', '')
|
||||
PROXMOX_HOSTS = [host.strip() for host in environ.get('PROXSTAR_PROXMOX_HOSTS', '').split(',')]
|
||||
PROXMOX_USER = environ.get('PROXSTAR_PROXMOX_USER', '')
|
||||
PROXMOX_PASS = environ.get('PROXSTAR_PROXMOX_PASS', '')
|
||||
PROXMOX_ISO_STORAGE = environ.get('PROXSTAR_PROXMOX_ISO_STORAGE', 'nfs-iso')
|
||||
|
|
|
@ -5,16 +5,19 @@ from proxstar.ldapdb import *
|
|||
|
||||
|
||||
def connect_proxmox():
|
||||
try:
|
||||
proxmox = ProxmoxAPI(
|
||||
app.config['PROXMOX_HOST'],
|
||||
user=app.config['PROXMOX_USER'],
|
||||
password=app.config['PROXMOX_PASS'],
|
||||
verify_ssl=False)
|
||||
except:
|
||||
for host in app.config['PROXMOX_HOSTS']:
|
||||
try:
|
||||
proxmox = ProxmoxAPI(
|
||||
host,
|
||||
user=app.config['PROXMOX_USER'],
|
||||
password=app.config['PROXMOX_PASS'],
|
||||
verify_ssl=False)
|
||||
version = proxmox.version.get()
|
||||
return proxmox
|
||||
except:
|
||||
pass
|
||||
print("Unable to connect to Proxmox!")
|
||||
raise
|
||||
return proxmox
|
||||
|
||||
|
||||
def create_user(proxmox, user):
|
||||
|
|
Loading…
Reference in a new issue