Commit 78d67621 authored by Daniele Venzano's avatar Daniele Venzano

Fix sonarqube errors

parent b45ed47c
......@@ -612,7 +612,7 @@ class ArgumentParser(argparse.ArgumentParser):
value = str(value).lower()
config_file_items[config_file_keys[0]] = value
elif source == _ENV_VAR_SOURCE_KEY:
elif source == _ENV_VAR_SOURCE_KEY or source == _DEFAULTS_SOURCE_KEY:
for key, (action, value) in settings.items():
config_file_keys = self.get_possible_config_keys(action)
if config_file_keys:
......@@ -622,13 +622,6 @@ class ArgumentParser(argparse.ArgumentParser):
elif source.startswith(_CONFIG_FILE_SOURCE_KEY):
for key, (action, value) in settings.items():
config_file_items[key] = value
elif source == _DEFAULTS_SOURCE_KEY:
for key, (action, value) in settings.items():
config_file_keys = self.get_possible_config_keys(action)
if config_file_keys:
value = getattr(parsed_namespace, action.dest, None)
if value is not None:
config_file_items[config_file_keys[0]] = value
return config_file_items
def convert_item_to_command_line_arg(self, action, key, value):
......
......@@ -265,10 +265,7 @@ class SwarmClient:
elif docker_info["State"]["Restarting"]:
info["state"] = "restarting"
info["running"] = True
elif docker_info["State"]["OOMKilled"]:
info["state"] = "killed"
info["running"] = False
elif docker_info["State"]["Dead"]:
elif docker_info["State"]["OOMKilled"] or docker_info["State"]["Dead"]:
info["state"] = "killed"
info["running"] = False
else:
......
......@@ -52,10 +52,6 @@ class SwarmMonitor(threading.Thread):
def _event_cb(self, event: dict) -> bool:
if event['Type'] == 'container':
self._container_event(event)
elif event['Type'] == 'network':
pass
elif event['Type'] == 'image':
pass
else:
log.debug('Unmanaged event type: {}'.format(event['Type']))
log.debug(str(event))
......@@ -75,9 +71,7 @@ class SwarmMonitor(threading.Thread):
service = self.state.service_list(only_one=True, id=service_id)
if service is None:
return
if 'exec' in event['Action']:
pass
elif 'create' in event['Action']:
if 'create' in event['Action']:
service.set_backend_status(service.BACKEND_CREATE_STATUS)
elif 'start' in event['Action']:
service.set_backend_status(service.BACKEND_START_STATUS)
......
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