Don't automatically request a new instance when updating proxy.

Some features like saving parameters don't need it.
parent cdd82184
...@@ -95,7 +95,7 @@ def saveSession(config, account): ...@@ -95,7 +95,7 @@ def saveSession(config, account):
pass pass
return str(e) return str(e)
def updateProxy(config): def updateProxy(config, request=True):
""" """
Configure Slapos Node computer and partitions. Configure Slapos Node computer and partitions.
Send current Software Release to Slapproxy for compilation and deployment. Send current Software Release to Slapproxy for compilation and deployment.
...@@ -145,9 +145,15 @@ def updateProxy(config): ...@@ -145,9 +145,15 @@ def updateProxy(config):
if type(xml_result) != type('') and xml_result.has_key('instance'): if type(xml_result) != type('') and xml_result.has_key('instance'):
partition_parameter_kw = xml_result['instance'] partition_parameter_kw = xml_result['instance']
computer.updateConfiguration(xml_marshaller.dumps(slap_config)) computer.updateConfiguration(xml_marshaller.dumps(slap_config))
sr_request = slap.registerOpenOrder().request(profile, partition_reference=getSoftwareReleaseName(config), if request:
partition_parameter_kw=partition_parameter_kw, software_type=None, slap.registerOpenOrder().request(
filter_kw=None, state=None, shared=False) profile,
partition_reference=getSoftwareReleaseName(config),
partition_parameter_kw=partition_parameter_kw,
software_type=None,
filter_kw=None,
state=None,
shared=False)
return True return True
def readPid(file): def readPid(file):
...@@ -183,6 +189,10 @@ def updateInstanceParameter(config, software_type=None): ...@@ -183,6 +189,10 @@ def updateInstanceParameter(config, software_type=None):
config['software_profile'])) config['software_profile']))
except: except:
raise Exception("Software Release profile not found") raise Exception("Software Release profile not found")
if not updateProxy(config, request=False):
return False
#get instance parameter #get instance parameter
param_path = os.path.join(config['etc_dir'], ".parameter.xml") param_path = os.path.join(config['etc_dir'], ".parameter.xml")
xml_result = readParameters(param_path) xml_result = readParameters(param_path)
...@@ -259,7 +269,7 @@ def runSoftwareWithLock(config): ...@@ -259,7 +269,7 @@ def runSoftwareWithLock(config):
removeProxyDb(config) removeProxyDb(config)
startProxy(config) startProxy(config)
logfile = open(config['software_log'], 'w') logfile = open(config['software_log'], 'w')
if not updateProxy(config): if not updateProxy(config, request=False):
return False return False
# Accelerate compilation by setting make -jX # Accelerate compilation by setting make -jX
environment = os.environ.copy() environment = os.environ.copy()
......
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