From 04661ce3401569acd1d95135f25b979d96373faa Mon Sep 17 00:00:00 2001 From: MacRimi Date: Sun, 22 Mar 2026 14:53:34 +0100 Subject: [PATCH] Update flask_server.py --- AppImage/scripts/flask_server.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/AppImage/scripts/flask_server.py b/AppImage/scripts/flask_server.py index cb34ebcc..6c753a04 100644 --- a/AppImage/scripts/flask_server.py +++ b/AppImage/scripts/flask_server.py @@ -7656,15 +7656,15 @@ def api_vm_control(vmid): data = request.get_json() action = data.get('action') # start, stop, shutdown, reboot - if action not in ['start', 'stop', 'shutdown', 'reboot']: - return jsonify({'error': 'Invalid action'}), 400 - - # Get VM type and node - resources = get_cached_pvesh_cluster_resources_vm() - - if resources: - vm_info = None - for resource in resources: + if action not in ['start', 'stop', 'shutdown', 'reboot']: + return jsonify({'error': 'Invalid action'}), 400 + + # Get VM type and node + resources = get_cached_pvesh_cluster_resources_vm() + + if resources: + vm_info = None + for resource in resources: if resource.get('vmid') == vmid: vm_info = resource break @@ -7695,8 +7695,6 @@ def api_vm_control(vmid): else: return jsonify({'error': 'Failed to get VM details'}), 500 except Exception as e: - # print(f"Error controlling VM: {e}") - pass return jsonify({'error': str(e)}), 500 @app.route('/api/vms//config', methods=['PUT'])