From 6c4eb7fc7b54919ed139fbbb3bd096f72f54e8c6 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Mon, 9 Dec 2019 11:12:12 -0500 Subject: [PATCH] Use distutils to convert text to bools --- client-provisioner/pvc-provisioner.py | 42 ++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/client-provisioner/pvc-provisioner.py b/client-provisioner/pvc-provisioner.py index 74b59dae..32ded21c 100755 --- a/client-provisioner/pvc-provisioner.py +++ b/client-provisioner/pvc-provisioner.py @@ -25,6 +25,7 @@ import json import yaml import os import uu +import distutils.util import gevent.pywsgi @@ -284,13 +285,13 @@ def api_template_system_root(): return flask.jsonify({"message": "A vram integer value in Megabytes must be specified."}), 400 # Get serial configuration - if 'serial' in flask.request.values and flask.request.values['serial']: + if 'serial' in flask.request.values and bool(distutils.util.strtobool(flask.request.values['serial'])): serial = True else: serial = False # Get VNC configuration - if 'vnc' in flask.request.values and flask.request.values['vnc']: + if 'vnc' in flask.request.values and bool(distutils.util.strtobool(flask.request.values['vnc'])): vnc = True if 'vnc_bind' in flask.request.values: @@ -301,6 +302,7 @@ def api_template_system_root(): vnc = False vnc_bind = None + # Get metadata if 'node_limit' in flask.request.values: node_limit = flask.request.values['node_limit'] else: @@ -311,7 +313,7 @@ def api_template_system_root(): else: node_selector = None - if 'start_with_node' in flask.request.values and flask.request.values['start_with_node']: + if 'start_with_node' in flask.request.values and bool(distutils.util.strtobool(flask.request.values['start_with_node'])): start_with_node = True else: start_with_node = False @@ -348,6 +350,18 @@ def api_template_system_element(template): * type: IP Address (or '0.0.0.0' wildcard) * optional: true * requires: vnc=True + ?node_limit: CSV list of node(s) to limit VM operation to + * type: CSV of valid PVC nodes + * optional: true + * requires: N/A + ?node_selector: Selector to use for node migrations after initial provisioning + * type: Valid PVC node selector + * optional: true + * requires: N/A + ?start_with_node: Whether to start limited node with the parent node + * default: false + * type: boolean + * optional: true DELETE: Remove system template