Add default software type in libslap

parent 16765399
...@@ -42,6 +42,8 @@ import zope.interface ...@@ -42,6 +42,8 @@ import zope.interface
Simple, easy to (un)marshall classes for slap client/server communication Simple, easy to (un)marshall classes for slap client/server communication
""" """
DEFAULT_SOFTWARE_TYPE = 'default'
# httplib.HTTPSConnection with key verification # httplib.HTTPSConnection with key verification
class HTTPSConnectionCA(httplib.HTTPSConnection): class HTTPSConnectionCA(httplib.HTTPSConnection):
"""Patched version of HTTPSConnection which verifies server certificate""" """Patched version of HTTPSConnection which verifies server certificate"""
...@@ -181,6 +183,9 @@ class OpenOrder(SlapDocument): ...@@ -181,6 +183,9 @@ class OpenOrder(SlapDocument):
} }
if software_type is not None: if software_type is not None:
request_dict['software_type'] = software_type request_dict['software_type'] = software_type
else:
# Let's enforce a default software type
request_dict['software_type'] = DEFAULT_SOFTWARE_TYPE
try: try:
self._connection_helper.POST('/requestComputerPartition', request_dict) self._connection_helper.POST('/requestComputerPartition', request_dict)
except ResourceNotReady: except ResourceNotReady:
...@@ -359,6 +364,10 @@ class ComputerPartition(SlapDocument): ...@@ -359,6 +364,10 @@ class ComputerPartition(SlapDocument):
raise ValueError("Unexpected type of filter_kw '%s'" % \ raise ValueError("Unexpected type of filter_kw '%s'" % \
filter_kw) filter_kw)
# Let enforce a default software type
if software_type is None:
software_type = DEFAULT_SOFTWARE_TYPE
request_dict = { 'computer_id': self._computer_id, request_dict = { 'computer_id': self._computer_id,
'computer_partition_id': self._partition_id, 'computer_partition_id': self._partition_id,
'software_release': software_release, 'software_release': software_release,
......
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