Commit 411cc48a authored by Jérome Perrin's avatar Jérome Perrin

testnode: clean up trailing spaces

parent 97af85f9
...@@ -116,7 +116,7 @@ class SlapOSControler(object): ...@@ -116,7 +116,7 @@ class SlapOSControler(object):
reference : instance title reference : instance title
software_url : software path/url software_url : software path/url
software_type : scalability software_type : scalability
software_configuration : dict { "_" : "{'toto' : 'titi'}" } software_configuration : dict { "_" : "{'toto' : 'titi'}" }
Ex : Ex :
my_controler._request('Instance16h34Ben', my_controler._request('Instance16h34Ben',
...@@ -170,22 +170,22 @@ class SlapOSControler(object): ...@@ -170,22 +170,22 @@ class SlapOSControler(object):
self.instance_config[reference]['software_configuration'], self.instance_config[reference]['software_configuration'],
self.instance_config[reference]['computer_guid'], self.instance_config[reference]['computer_guid'],
state=state state=state
) )
def destroyInstance(self, reference): def destroyInstance(self, reference):
logger.debug('SlapOSControler : delete instance') logger.debug('SlapOSControler : delete instance')
try: try:
self._requestSpecificState(reference, 'destroyed') self._requestSpecificState(reference, 'destroyed')
except Exception: except Exception:
raise ValueError("Can't delete instance %r (instance not created?)" % reference) raise ValueError("Can't delete instance %r (instance not created?)" % reference)
def stopInstance(self, reference): def stopInstance(self, reference):
logger.debug('SlapOSControler : stop instance') logger.debug('SlapOSControler : stop instance')
try: try:
self._requestSpecificState(reference, 'stopped') self._requestSpecificState(reference, 'stopped')
except Exception: except Exception:
raise ValueError("Can't stop instance %r (instance not created?)" % reference) raise ValueError("Can't stop instance %r (instance not created?)" % reference)
def startInstance(self, reference): def startInstance(self, reference):
logger.debug('SlapOSControler : start instance') logger.debug('SlapOSControler : start instance')
try: try:
...@@ -242,7 +242,7 @@ class SlapOSControler(object): ...@@ -242,7 +242,7 @@ class SlapOSControler(object):
slapproxy_log_fp = open(slapproxy_log, 'w') slapproxy_log_fp = open(slapproxy_log, 'w')
kwargs['stdout'] = slapproxy_log_fp kwargs['stdout'] = slapproxy_log_fp
kwargs['stderr'] = slapproxy_log_fp kwargs['stderr'] = slapproxy_log_fp
proxy = subprocess.Popen([config['slapos_binary'], proxy = subprocess.Popen([config['slapos_binary'],
'proxy', 'start', '--cfg' , self.slapos_config], **kwargs) 'proxy', 'start', '--cfg' , self.slapos_config], **kwargs)
process_manager.process_pid_set.add(proxy.pid) process_manager.process_pid_set.add(proxy.pid)
...@@ -338,7 +338,7 @@ class SlapOSControler(object): ...@@ -338,7 +338,7 @@ class SlapOSControler(object):
# so be tolerant and run it a few times before giving up # so be tolerant and run it a few times before giving up
for _ in range(MAX_SR_RETRIES): for _ in range(MAX_SR_RETRIES):
status_dict = self.spawn(config['slapos_binary'], status_dict = self.spawn(config['slapos_binary'],
'node', 'software', '--all', 'node', 'software', '--all',
'--pidfile', os.path.join(self.software_root, 'slapos-node.pid'), '--pidfile', os.path.join(self.software_root, 'slapos-node.pid'),
'--cfg', self.slapos_config, raise_error_if_fail=False, '--cfg', self.slapos_config, raise_error_if_fail=False,
log_prefix='slapgrid_sr', get_output=False) log_prefix='slapgrid_sr', get_output=False)
...@@ -361,11 +361,11 @@ class SlapOSControler(object): ...@@ -361,11 +361,11 @@ class SlapOSControler(object):
logger.exception("SlapOSControler.runComputerPartition") logger.exception("SlapOSControler.runComputerPartition")
raise ValueError("Unable to registerOpenOrder") raise ValueError("Unable to registerOpenOrder")
# try to run for all partitions as one partition may in theory request another one # try to run for all partitions as one partition may in theory request another one
# this not always is required but currently no way to know how "tree" of partitions # this not always is required but currently no way to know how "tree" of partitions
# may "expand" # may "expand"
for _ in range(max_quantity): for _ in range(max_quantity):
status_dict = self.spawn(config['slapos_binary'], 'node', 'instance', status_dict = self.spawn(config['slapos_binary'], 'node', 'instance',
'--pidfile', os.path.join(self.instance_root, 'slapos-node.pid'), '--pidfile', os.path.join(self.instance_root, 'slapos-node.pid'),
'--cfg', self.slapos_config, raise_error_if_fail=False, '--cfg', self.slapos_config, raise_error_if_fail=False,
log_prefix='slapgrid_cp', get_output=False) log_prefix='slapgrid_cp', get_output=False)
...@@ -377,4 +377,4 @@ class SlapOSControler(object): ...@@ -377,4 +377,4 @@ class SlapOSControler(object):
# codes, but depending on slapos versions, we have inconsistent status # codes, but depending on slapos versions, we have inconsistent status
if status_dict['status_code'] in (1,2): if status_dict['status_code'] in (1,2):
status_dict['status_code'] = 0 status_dict['status_code'] = 0
return status_dict return status_dict
\ No newline at end of file
...@@ -81,7 +81,7 @@ class SlapOSMasterCommunicator(object): ...@@ -81,7 +81,7 @@ class SlapOSMasterCommunicator(object):
except AttributeError as e: except AttributeError as e:
logger.warning('Error on get software release: %s ', e.message) logger.warning('Error on get software release: %s ', e.message)
self.url = url self.url = url
######################################################### #########################################################
# Wrapper functions to support network retries # Wrapper functions to support network retries
...@@ -98,7 +98,7 @@ class SlapOSMasterCommunicator(object): ...@@ -98,7 +98,7 @@ class SlapOSMasterCommunicator(object):
@retryOnNetworkFailure @retryOnNetworkFailure
def _request(self, state, instance_title=None, request_kw=None, shared=False, software_type="RootSoftwareInstance"): def _request(self, state, instance_title=None, request_kw=None, shared=False, software_type="RootSoftwareInstance"):
if instance_title is not None: if instance_title is not None:
self.name = instance_title self.name = instance_title
if request_kw is not None: if request_kw is not None:
if isinstance(request_kw, bytes): if isinstance(request_kw, bytes):
self.request_kw = json.loads(request_kw.decode('utf-8')) self.request_kw = json.loads(request_kw.decode('utf-8'))
...@@ -386,7 +386,7 @@ class SlapOSTester(SlapOSMasterCommunicator): ...@@ -386,7 +386,7 @@ class SlapOSTester(SlapOSMasterCommunicator):
logger.info("balancer ipv6 url not generated yet for instance: " + instance["title"]) logger.info("balancer ipv6 url not generated yet for instance: " + instance["title"])
pass pass
# get generated by Nexedi's CDN frontend address # get generated by Nexedi's CDN frontend address
if "frontend-" in instance["title"]: if "frontend-" in instance["title"]:
try: try:
frontend = [instance["title"].replace("frontend-", ""), frontend = [instance["title"].replace("frontend-", ""),
...@@ -504,7 +504,7 @@ class SoftwareReleaseTester(SlapOSTester): ...@@ -504,7 +504,7 @@ class SoftwareReleaseTester(SlapOSTester):
for prop in entry: for prop in entry:
if prop != "information": if prop != "information":
message += "%s = %s\n" % (prop, json.dumps(entry[prop], indent=2)) message += "%s = %s\n" % (prop, json.dumps(entry[prop], indent=2))
message += "=== connection_dict === \n%s\n" % ( message += "=== connection_dict === \n%s\n" % (
json.dumps(entry["information"]["connection_dict"], indent=2)) json.dumps(entry["information"]["connection_dict"], indent=2))
message += "\n" message += "\n"
...@@ -513,7 +513,7 @@ class SoftwareReleaseTester(SlapOSTester): ...@@ -513,7 +513,7 @@ class SoftwareReleaseTester(SlapOSTester):
message += "\n" message += "\n"
message += "="*79 message += "="*79
message += "\n\n\n" message += "\n\n\n"
return summary + message return summary + message
@retryOnNetworkFailure @retryOnNetworkFailure
......
...@@ -209,4 +209,4 @@ class UnitTestRunner(object): ...@@ -209,4 +209,4 @@ class UnitTestRunner(object):
Used by the method testnode.constructProfile() to know Used by the method testnode.constructProfile() to know
if the software.cfg have to use relative path or not. if the software.cfg have to use relative path or not.
""" """
return False return False
\ No newline at end of file
...@@ -90,7 +90,7 @@ class Updater(object): ...@@ -90,7 +90,7 @@ class Updater(object):
cwd = kw.pop("cwd", None) cwd = kw.pop("cwd", None)
if cwd is None: if cwd is None:
cwd = self.getRepositoryPath() cwd = self.getRepositoryPath()
return self.process_manager.spawn(*args, return self.process_manager.spawn(*args,
log_prefix='git', log_prefix='git',
cwd=cwd, cwd=cwd,
**kw) **kw)
......
...@@ -75,7 +75,7 @@ class TestNode(object): ...@@ -75,7 +75,7 @@ class TestNode(object):
rmtree(fpath) rmtree(fpath)
else: else:
os.remove(fpath) os.remove(fpath)
def getNodeTestSuite(self, reference): def getNodeTestSuite(self, reference):
try: try:
node_test_suite = self.node_test_suite_dict[reference] node_test_suite = self.node_test_suite_dict[reference]
...@@ -436,4 +436,4 @@ shared = true ...@@ -436,4 +436,4 @@ shared = true
# Exceptions are swallowed during cleanup phase # Exceptions are swallowed during cleanup phase
logger.info("GENERAL EXCEPTION, QUITING") logger.info("GENERAL EXCEPTION, QUITING")
self.cleanUp() self.cleanUp()
logger.info("GENERAL EXCEPTION, QUITING, cleanup finished") logger.info("GENERAL EXCEPTION, QUITING, cleanup finished")
\ No newline at end of file
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