net_set_dhcp() missing 1 required positional argument: 'remove_ipv4'

This commit is contained in:
forest 2021-12-10 20:21:07 -05:00
parent 59fd43e164
commit d91600b031
4 changed files with 8 additions and 19 deletions

View File

@ -2,7 +2,7 @@ import re
import sys
import json
import ipaddress
import pprint
#import pprint
from datetime import datetime, timedelta
from flask import Blueprint, current_app, render_template, make_response, session, request, redirect, url_for, flash
from flask_mail import Message
@ -28,8 +28,7 @@ def index():
db_vms_by_id = get_all_vms_from_db()
virt_vms_by_id = get_all_vms_from_hosts(db_vms_by_id)
current_app.logger.info(f"\n*******************1:\n{pprint.pformat(virt_vms_by_id)}\n\n\n\n")
#current_app.logger.info(f"\n*******************1:\n{pprint.pformat(virt_vms_by_id)}\n\n\n\n")
network_display_width_px = float(270)
#operations = get_model().list_all_operations()
@ -76,7 +75,7 @@ def index():
try:
if request.form['desired_state'] == "running":
if 'macs' in virt_vm and len(virt_vm['macs'].keys()) > 0:
current_app.config["HUB_MODEL"].net_set_dhcp(email=session['account'], host_id=virt_vm['host'], network_name=virt_vm['network_name'], macs=list(virt_vm['macs'].keys()), add_ipv4=db_vm['public_ipv4'])
current_app.config["HUB_MODEL"].net_set_dhcp(email=session['account'], host_id=virt_vm['host'], network_name=virt_vm['network_name'], macs=list(virt_vm['macs'].keys()), remove_ipv4=None, add_ipv4=db_vm['public_ipv4'])
current_app.config["HUB_MODEL"].vm_state_command(email=session['account'], id=id, command="start")
elif request.form['desired_state'] == "shut off":
@ -185,16 +184,6 @@ def index():
# Now creating the capsul consistency / running status ui
#
# current_app.logger.info(pprint.pformat(db_vms_by_id))
# current_app.logger.info("\n\n\n\n")
# current_app.logger.info(pprint.pformat(virt_vms_by_id))
# current_app.logger.info("\n\n\n\n")
virt_vm_id_by_ipv4 = dict()
for vm_id, virt_vm in virt_vms_by_id.items():
if 'public_ipv4' in virt_vm and virt_vm['public_ipv4'] != "":

View File

@ -1,5 +1,5 @@
import pprint
#import pprint
from flask import current_app
from capsulflask.db import get_model
@ -46,7 +46,7 @@ def get_all_vms_from_db() -> dict:
# this returns the same shape of object as get_all_vms_from_db except it has 'state' instead of 'desired_state'
def get_all_vms_from_hosts(db_vms_by_id: dict) -> dict:
virt_vms_by_id = current_app.config["HUB_MODEL"].get_all_by_id()
current_app.logger.info(f"\n*******************2:\n{pprint.pformat(virt_vms_by_id)}\n\n\n\n")
#current_app.logger.info(f"\n*******************2:\n{pprint.pformat(virt_vms_by_id)}\n\n\n\n")
db_hosts = get_model().list_hosts_with_networks(None)
for vm_id, virt_vm in virt_vms_by_id.items():

View File

@ -183,7 +183,7 @@ class CapsulFlaskHub(VirtualizationInterface):
host = online_hosts[i]
result = results[i]
try:
current_app.logger.info(f"\n********5:\n{result.body}\n\n\n\n")
#current_app.logger.info(f"\n********5:\n{result.body}\n\n\n\n")
result_body = json.loads(result.body)
for id, vm in result_body['vms'].items():
vm['host'] = host.id

View File

@ -2,7 +2,7 @@ import subprocess
import re
import json
import sys
import pprint
#import pprint
from flask import current_app
from time import sleep
@ -209,7 +209,7 @@ class ShellScriptSpoke(VirtualizationInterface):
else:
current_app.logger.warn(f"get_all_by_id: {status['mac-address']} not in vm_id_by_mac")
current_app.logger.info(f"\n*******************3:\n{pprint.pformat(vms_by_id)}\n\n\n\n")
#current_app.logger.info(f"\n*******************3:\n{pprint.pformat(vms_by_id)}\n\n\n\n")
return vms_by_id