mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
add basic db setup, add vm expirations and cron to handle them, and add fields for sweetalert button classes
This commit is contained in:
parent
6debe3d9fd
commit
9beecf12fa
7 changed files with 186 additions and 8 deletions
19
cron.py
Normal file
19
cron.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from db import *
|
||||
from config import *
|
||||
from starrs import *
|
||||
from proxmox import *
|
||||
|
||||
|
||||
def process_expired_vms():
|
||||
proxmox = connect_proxmox(PROXMOX_HOST, PROXMOX_USER, PROXMOX_PASS)
|
||||
starrs = connect_starrs(STARRS_DB_NAME, STARRS_DB_USER, STARRS_DB_HOST,
|
||||
STARRS_DB_PASS)
|
||||
expired_vms = get_expired_vms()
|
||||
for vmid in expired_vms:
|
||||
vmname = get_vm_config(proxmox, vmid)['name']
|
||||
delete_vm(proxmox, starrs, vmid)
|
||||
delete_starrs(starrs, vmname)
|
||||
delete_vm_expire(vmid)
|
||||
|
||||
|
||||
process_expired_vms()
|
||||
Loading…
Add table
Add a link
Reference in a new issue