Update slapproxy behavior: when instance already exist, only update partition_parameter_kw

parent 4136056d
...@@ -294,25 +294,31 @@ def request_not_shared(): ...@@ -294,25 +294,31 @@ def request_not_shared():
q += ' AND requested_by=?' q += ' AND requested_by=?'
a(partition_id) a(partition_id)
partition = execute_db('partition', q, args, one=True) partition = execute_db('partition', q, args, one=True)
args = []
a = args.append
q = 'UPDATE %s SET slap_state="busy"'
# If partition doesn't exist: create it and insert parameters
if partition is None: if partition is None:
partition = execute_db('partition', partition = execute_db('partition',
'SELECT * FROM %s WHERE slap_state="free"', (), one=True) 'SELECT * FROM %s WHERE slap_state="free"', (), one=True)
if partition is None: if partition is None:
app.logger.warning('No more free computer partition') app.logger.warning('No more free computer partition')
abort(408) abort(408)
args = [] q += ' ,software_release=?'
a = args.append a(software_release)
q = 'UPDATE %s SET software_release=?, slap_state="busy"' if software_type:
a(software_release) q += ' ,software_type=?'
if software_type: a(software_type)
q += ' ,software_type=?' if partition_reference:
a(software_type) q += ' ,partition_reference=?'
if partition_reference: a(partition_reference)
q += ' ,partition_reference=?' if partition_id:
a(partition_reference) q += ' ,requested_by=?'
if partition_id: a(partition_id)
q += ' ,requested_by=?'
a(partition_id) # Else: only update partition_parameter_kw
if instance_xml: if instance_xml:
q += ' ,xml=?' q += ' ,xml=?'
a(instance_xml) a(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