mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
we can use the http api now, stop using ssh
This commit is contained in:
parent
d9b4af0c96
commit
783e13b9cd
3 changed files with 7 additions and 8 deletions
|
@ -45,7 +45,8 @@ def connect_proxmox_ssh():
|
|||
|
||||
def get_node_least_mem(proxmox):
|
||||
nodes = proxmox.nodes.get()
|
||||
sorted_nodes = sorted(nodes, key=lambda x: x['mem'])
|
||||
sorted_nodes = sorted(
|
||||
nodes, key=lambda x: ('mem' not in x, x.get('mem', None)))
|
||||
return sorted_nodes[0]['node']
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<link rel="stylesheet" href="https://themeswitcher.csh.rit.edu/api/get" media="screen">
|
||||
<link rel="stylesheet" href="/static/css/styles.css">
|
||||
<link rel="stylesheet" href="/static/css/circle.css">
|
||||
<link rel="manifest" href="/static/manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
{% block nav %}
|
||||
|
|
|
@ -7,8 +7,7 @@ from tenacity import retry, stop_after_attempt, wait_fixed
|
|||
|
||||
from proxstar import db, starrs
|
||||
from proxstar.db import delete_vm_expire, get_vm_expire
|
||||
from proxstar.proxmox import (connect_proxmox, connect_proxmox_ssh,
|
||||
get_free_vmid, get_node_least_mem, get_vm_node)
|
||||
from proxstar.proxmox import connect_proxmox, get_free_vmid, get_node_least_mem, get_vm_node
|
||||
from proxstar.starrs import get_ip_for_mac
|
||||
from proxstar.util import lazy_property
|
||||
|
||||
|
@ -236,18 +235,18 @@ class VM(object):
|
|||
|
||||
@retry(wait=wait_fixed(2), stop=stop_after_attempt(5))
|
||||
def set_ci_user(self, user):
|
||||
proxmox = connect_proxmox_ssh()
|
||||
proxmox = connect_proxmox()
|
||||
proxmox.nodes(self.node).qemu(self.id).config.put(ciuser=user)
|
||||
|
||||
@retry(wait=wait_fixed(2), stop=stop_after_attempt(5))
|
||||
def set_ci_ssh_key(self, ssh_key):
|
||||
proxmox = connect_proxmox_ssh()
|
||||
proxmox = connect_proxmox()
|
||||
escaped_key = urllib.parse.quote(ssh_key, safe='')
|
||||
proxmox.nodes(self.node).qemu(self.id).config.put(sshkey=escaped_key)
|
||||
proxmox.nodes(self.node).qemu(self.id).config.put(sshkeys=escaped_key)
|
||||
|
||||
@retry(wait=wait_fixed(2), stop=stop_after_attempt(5))
|
||||
def set_ci_network(self):
|
||||
proxmox = connect_proxmox_ssh()
|
||||
proxmox = connect_proxmox()
|
||||
proxmox.nodes(self.node).qemu(self.id).config.put(ipconfig0='ip=dhcp')
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue