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

parent 4136056d
...@@ -294,15 +294,19 @@ def request_not_shared(): ...@@ -294,15 +294,19 @@ 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
q = 'UPDATE %s SET software_release=?, slap_state="busy"'
a(software_release) a(software_release)
if software_type: if software_type:
q += ' ,software_type=?' q += ' ,software_type=?'
...@@ -313,6 +317,8 @@ def request_not_shared(): ...@@ -313,6 +317,8 @@ def request_not_shared():
if partition_id: if partition_id:
q += ' ,requested_by=?' q += ' ,requested_by=?'
a(partition_id) 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