Commit 9870e43c authored by Marco Mariani's avatar Marco Mariani

alllow requests to software_type

parent 45f2991d
...@@ -286,8 +286,7 @@ def softwareInstanceRename(): ...@@ -286,8 +286,7 @@ def softwareInstanceRename():
def request_not_shared(): def request_not_shared():
software_release = request.form['software_release'].encode() software_release = request.form['software_release'].encode()
# some supported parameters # some supported parameters
software_type = request.form.get('software_type', 'RootSoftwareInstance' software_type = request.form.get('software_type').encode()
).encode()
partition_reference = request.form.get('partition_reference', '').encode() partition_reference = request.form.get('partition_reference', '').encode()
partition_id = request.form.get('computer_partition_id', '').encode() partition_id = request.form.get('computer_partition_id', '').encode()
partition_parameter_kw = request.form.get('partition_parameter_xml', None) partition_parameter_kw = request.form.get('partition_parameter_xml', None)
...@@ -296,14 +295,20 @@ def request_not_shared(): ...@@ -296,14 +295,20 @@ def request_not_shared():
partition_parameter_kw.encode()) partition_parameter_kw.encode())
else: else:
partition_parameter_kw = {} partition_parameter_kw = {}
instance_xml = dict2xml(partition_parameter_kw) instance_xml = dict2xml(partition_parameter_kw)
args = [] args = []
a = args.append a = args.append
q = 'SELECT * FROM %s WHERE partition_reference=?' q = 'SELECT * FROM %s WHERE partition_reference=?'
a(partition_reference) a(partition_reference)
if partition_id:
q += ' AND requested_by=?' #
a(partition_id) # XXX the following filter breaks renaming asked by the bully script
#
# if partition_id:
# q += ' AND requested_by=?'
# a(partition_id)
partition = execute_db('partition', q, args, one=True) partition = execute_db('partition', q, args, one=True)
args = [] args = []
...@@ -319,15 +324,21 @@ def request_not_shared(): ...@@ -319,15 +324,21 @@ def request_not_shared():
abort(408) abort(408)
q += ' ,software_release=?' q += ' ,software_release=?'
a(software_release) a(software_release)
if software_type:
q += ' ,software_type=?'
a(software_type)
if partition_reference: if partition_reference:
q += ' ,partition_reference=?' q += ' ,partition_reference=?'
a(partition_reference) a(partition_reference)
if partition_id: if partition_id:
q += ' ,requested_by=?' q += ' ,requested_by=?'
a(partition_id) a(partition_id)
if not software_type:
software_type = 'RootSoftwareInstance'
#
# XXX change software_type when requested
#
if software_type:
q += ' ,software_type=?'
a(software_type)
# Else: only update partition_parameter_kw # Else: only update partition_parameter_kw
if instance_xml: if instance_xml:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment