mirror of
				https://github.com/ComputerScienceHouse/proxstar.git
				synced 2025-03-09 15:40:09 +00:00 
			
		
		
		
	Merge pull request #135 from ComputerScienceHouse/fix-for-2022
Fixing Proxstar for 2022 deps
This commit is contained in:
		
						commit
						be80216eeb
					
				
					 7 changed files with 32 additions and 22 deletions
				
			
		| 
						 | 
				
			
			@ -21,7 +21,14 @@ disable =
 | 
			
		|||
	wrong-import-position,
 | 
			
		||||
	logging-format-interpolation,
 | 
			
		||||
	bare-except,
 | 
			
		||||
	too-many-public-methods
 | 
			
		||||
	too-many-public-methods,
 | 
			
		||||
	consider-using-with,
 | 
			
		||||
	consider-using-f-string,
 | 
			
		||||
	unspecified-encoding,
 | 
			
		||||
	consider-iterating-dictionary,
 | 
			
		||||
	inconsistent-return-statements,
 | 
			
		||||
	consider-using-dict-items,
 | 
			
		||||
	modified-iterating-dict
 | 
			
		||||
 | 
			
		||||
[REPORTS]
 | 
			
		||||
output-format = text
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -301,7 +301,7 @@ def vm_cpu(vmid, cores):
 | 
			
		|||
        vm = VM(vmid)
 | 
			
		||||
        cur_cores = vm.cpu
 | 
			
		||||
        if cores >= cur_cores:
 | 
			
		||||
            if vm.qmpstatus == 'running' or vm.qmpstatus == 'paused':
 | 
			
		||||
            if vm.qmpstatus in ('running', 'paused'):
 | 
			
		||||
                usage_check = user.check_usage(cores - cur_cores, 0, 0)
 | 
			
		||||
            else:
 | 
			
		||||
                usage_check = user.check_usage(cores, 0, 0)
 | 
			
		||||
| 
						 | 
				
			
			@ -322,7 +322,7 @@ def vm_mem(vmid, mem):
 | 
			
		|||
        vm = VM(vmid)
 | 
			
		||||
        cur_mem = vm.mem // 1024
 | 
			
		||||
        if mem >= cur_mem:
 | 
			
		||||
            if vm.qmpstatus == 'running' or vm.qmpstatus == 'paused':
 | 
			
		||||
            if vm.qmpstatus in ('running', 'paused'):
 | 
			
		||||
                usage_check = user.check_usage(0, mem - cur_mem, 0)
 | 
			
		||||
            else:
 | 
			
		||||
                usage_check = user.check_usage(0, mem, 0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@ def get_expiring_vms(db):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def get_user_usage_limits(db, user):
 | 
			
		||||
    limits = dict()
 | 
			
		||||
    limits = {}
 | 
			
		||||
    if is_rtp(user):
 | 
			
		||||
        limits['cpu'] = 1000
 | 
			
		||||
        limits['mem'] = 1000
 | 
			
		||||
| 
						 | 
				
			
			@ -113,7 +113,7 @@ def get_pool_cache(db):
 | 
			
		|||
    db_pools = db.query(Pool_Cache).all()
 | 
			
		||||
    pools = []
 | 
			
		||||
    for pool in db_pools:
 | 
			
		||||
        pool_dict = dict()
 | 
			
		||||
        pool_dict = {}
 | 
			
		||||
        pool_dict['user'] = pool.pool
 | 
			
		||||
        pool_dict['vms'] = pool.vms
 | 
			
		||||
        pool_dict['num_vms'] = pool.num_vms
 | 
			
		||||
| 
						 | 
				
			
			@ -149,7 +149,7 @@ def add_ignored_pool(db, pool):
 | 
			
		|||
def get_templates(db):
 | 
			
		||||
    templates = []
 | 
			
		||||
    for template in db.query(Template).all():
 | 
			
		||||
        template_dict = dict()
 | 
			
		||||
        template_dict = {}
 | 
			
		||||
        template_dict['id'] = template.id
 | 
			
		||||
        template_dict['name'] = template.name
 | 
			
		||||
        template_dict['disk'] = template.disk
 | 
			
		||||
| 
						 | 
				
			
			@ -158,7 +158,7 @@ def get_templates(db):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def get_template(db, template_id):
 | 
			
		||||
    template_dict = dict()
 | 
			
		||||
    template_dict = {}
 | 
			
		||||
    if db.query(exists().where(Template.id == template_id)).scalar():
 | 
			
		||||
        template = db.query(Template).filter(Template.id == template_id).one()
 | 
			
		||||
        template_dict['id'] = template.id
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
Subproject commit 37b4d13db81e0e80e117c07b86ff98714c7b6b1a
 | 
			
		||||
Subproject commit cdfb33665195eb9a73fb00feb6ebaccd1068cd50
 | 
			
		||||
| 
						 | 
				
			
			@ -50,8 +50,8 @@ class User:
 | 
			
		|||
        for job in jobs:
 | 
			
		||||
            job = q.fetch_job(job)
 | 
			
		||||
            if job and len(job.args) > 2:
 | 
			
		||||
                if job.args[0] == self.name or job.args[2] == self.name:
 | 
			
		||||
                    vm_dict = dict()
 | 
			
		||||
                if self.name in (job.args[0], job.args[2]):
 | 
			
		||||
                    vm_dict = {}
 | 
			
		||||
                    vm_dict['name'] = job.args[1]
 | 
			
		||||
                    vm_dict['status'] = job.meta.get('status', 'no status yet')
 | 
			
		||||
                    vm_dict['pending'] = True
 | 
			
		||||
| 
						 | 
				
			
			@ -67,7 +67,7 @@ class User:
 | 
			
		|||
 | 
			
		||||
    @lazy_property
 | 
			
		||||
    def usage(self):
 | 
			
		||||
        usage = dict()
 | 
			
		||||
        usage = {}
 | 
			
		||||
        usage['cpu'] = 0
 | 
			
		||||
        usage['mem'] = 0
 | 
			
		||||
        usage['disk'] = 0
 | 
			
		||||
| 
						 | 
				
			
			@ -77,7 +77,7 @@ class User:
 | 
			
		|||
        for vm in vms:
 | 
			
		||||
            if 'status' in vm:
 | 
			
		||||
                vm = VM(vm['vmid'])
 | 
			
		||||
                if vm.status == 'running' or vm.status == 'paused':
 | 
			
		||||
                if vm.status in ('running', 'paused'):
 | 
			
		||||
                    usage['cpu'] += int(vm.cpu)
 | 
			
		||||
                    usage['mem'] += int(vm.mem) / 1024
 | 
			
		||||
                for disk in vm.disks:
 | 
			
		||||
| 
						 | 
				
			
			@ -86,7 +86,7 @@ class User:
 | 
			
		|||
 | 
			
		||||
    @lazy_property
 | 
			
		||||
    def usage_percent(self):
 | 
			
		||||
        percents = dict()
 | 
			
		||||
        percents = {}
 | 
			
		||||
        percents['cpu'] = round(self.usage['cpu'] / self.limits['cpu'] * 100)
 | 
			
		||||
        percents['mem'] = round(self.usage['mem'] / self.limits['mem'] * 100)
 | 
			
		||||
        percents['disk'] = round(self.usage['disk'] / self.limits['disk'] * 100)
 | 
			
		||||
| 
						 | 
				
			
			@ -121,7 +121,7 @@ def get_vms_for_rtp(proxmox, database):
 | 
			
		|||
    pools = []
 | 
			
		||||
    for pool in get_pools(proxmox, database):
 | 
			
		||||
        user = User(pool)
 | 
			
		||||
        pool_dict = dict()
 | 
			
		||||
        pool_dict = {}
 | 
			
		||||
        pool_dict['user'] = user.name
 | 
			
		||||
        pool_dict['vms'] = user.vms
 | 
			
		||||
        pool_dict['num_vms'] = len(pool_dict['vms'])
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ def get_vnc_targets():
 | 
			
		|||
    if os.path.exists(app.config['WEBSOCKIFY_TARGET_FILE']):
 | 
			
		||||
        target_file = open(app.config['WEBSOCKIFY_TARGET_FILE'])
 | 
			
		||||
        for line in target_file:
 | 
			
		||||
            target_dict = dict()
 | 
			
		||||
            target_dict = {}
 | 
			
		||||
            values = line.strip().split(':')
 | 
			
		||||
            target_dict['token'] = values[0]
 | 
			
		||||
            target_dict['port'] = values[2]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,13 +1,16 @@
 | 
			
		|||
black~=20.8b1
 | 
			
		||||
csh-ldap~=2.2.0
 | 
			
		||||
flask==1.1.2
 | 
			
		||||
black~=21.9b0
 | 
			
		||||
csh-ldap~=2.3.1
 | 
			
		||||
click~=7.1.2
 | 
			
		||||
ddtrace~=1.1.4
 | 
			
		||||
flask==1.1.4
 | 
			
		||||
jinja2==2.11.3
 | 
			
		||||
flask-pyoidc==1.3.0
 | 
			
		||||
gunicorn==20.0.4
 | 
			
		||||
markupsafe==2.0.1
 | 
			
		||||
paramiko==2.7.2
 | 
			
		||||
proxmoxer==1.1.1
 | 
			
		||||
psutil==5.8.0
 | 
			
		||||
psycopg2-binary==2.8.6
 | 
			
		||||
psycopg2-binary==2.9.3
 | 
			
		||||
python-dateutil==2.8.1
 | 
			
		||||
redis==3.5.3
 | 
			
		||||
requests==2.25.1
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +21,7 @@ sqlalchemy==1.3.22
 | 
			
		|||
sshtunnel==0.2.2
 | 
			
		||||
tenacity==5.0.2
 | 
			
		||||
websockify==0.9.0
 | 
			
		||||
pylint==2.6.0
 | 
			
		||||
pylint-quotes==0.2.1
 | 
			
		||||
pylint==2.13.9
 | 
			
		||||
pylint-quotes==0.2.3
 | 
			
		||||
sentry-sdk[flask]
 | 
			
		||||
sentry-sdk~=0.19.5
 | 
			
		||||
sentry-sdk~=1.5.12
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue