mirror of
				https://github.com/ComputerScienceHouse/proxstar.git
				synced 2025-03-09 15:40:09 +00:00 
			
		
		
		
	stop creating users since console access works now
This commit is contained in:
		
							parent
							
								
									ece3cea8a5
								
							
						
					
					
						commit
						08821b0b75
					
				
					 1 changed files with 4 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -21,20 +21,13 @@ def connect_proxmox():
 | 
			
		|||
                raise
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def create_user(proxmox, user):
 | 
			
		||||
    if not is_rtp(user):
 | 
			
		||||
        proxmox.pools.post(poolid=user, comment='Managed by Proxstar')
 | 
			
		||||
        users = proxmox.access.users.get()
 | 
			
		||||
        username = "{}@csh.rit.edu".format(user)
 | 
			
		||||
        proxmox.access.users.post(userid=username)
 | 
			
		||||
        proxmox.access.acl.put(
 | 
			
		||||
            path="/pool/{}".format(user), roles='PVEVMConsole', users=username)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_vms_for_user(proxmox, db, user):
 | 
			
		||||
    pools = get_pools(proxmox, db)
 | 
			
		||||
    if user not in pools:
 | 
			
		||||
        create_user(proxmox, user)
 | 
			
		||||
        if is_user(user) and not is_rtp(user):
 | 
			
		||||
                proxmox.pools.post(poolid=user, comment='Managed by Proxstar')
 | 
			
		||||
        else:
 | 
			
		||||
            return []
 | 
			
		||||
    vms = proxmox.pools(user).get()['members']
 | 
			
		||||
    for vm in vms:
 | 
			
		||||
        if 'name' not in vm:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue