Using new style `super` calles

This commit is contained in:
Shay Nehmad 2020-01-21 15:27:41 +02:00
parent 2286571a72
commit ab330219d5
4 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,7 @@
import logging import logging
from common.cloud.aws.aws_instance import AwsInstance from common.cloud.aws.aws_instance import AwsInstance
from common.data.system_info_collectors_names import AWS_COLLECTOR
from infection_monkey.system_info.system_info_collector import SystemInfoCollector from infection_monkey.system_info.system_info_collector import SystemInfoCollector
@ -12,7 +13,7 @@ class AwsCollector(SystemInfoCollector):
Extract info from AWS machines. Extract info from AWS machines.
""" """
def __init__(self): def __init__(self):
super(AwsCollector, self).__init__(name="AwsCollector") super().__init__(name=AWS_COLLECTOR)
def collect(self) -> dict: def collect(self) -> dict:
logger.info("Collecting AWS info") logger.info("Collecting AWS info")

View File

@ -1,5 +1,6 @@
from common.cloud.all_instances import get_all_cloud_instances from common.cloud.all_instances import get_all_cloud_instances
from common.cloud.environment_names import ON_PREMISE from common.cloud.environment_names import ON_PREMISE
from common.data.system_info_collectors_names import ENVIRONMENT_COLLECTOR
from infection_monkey.system_info.system_info_collector import SystemInfoCollector from infection_monkey.system_info.system_info_collector import SystemInfoCollector
@ -13,7 +14,7 @@ def get_monkey_environment() -> str:
class EnvironmentCollector(SystemInfoCollector): class EnvironmentCollector(SystemInfoCollector):
def __init__(self): def __init__(self):
super(EnvironmentCollector, self).__init__(name="EnvironmentCollector") super().__init__(name=ENVIRONMENT_COLLECTOR)
def collect(self) -> dict: def collect(self) -> dict:
return {"environment": get_monkey_environment()} return {"environment": get_monkey_environment()}

View File

@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
class HostnameCollector(SystemInfoCollector): class HostnameCollector(SystemInfoCollector):
def __init__(self): def __init__(self):
super(HostnameCollector, self).__init__(name=HOSTNAME_COLLECTOR) super().__init__(name=HOSTNAME_COLLECTOR)
def collect(self) -> dict: def collect(self) -> dict:
return {"hostname": socket.getfqdn()} return {"hostname": socket.getfqdn()}

View File

@ -16,7 +16,7 @@ except NameError:
class ProcessListCollector(SystemInfoCollector): class ProcessListCollector(SystemInfoCollector):
def __init__(self): def __init__(self):
super(ProcessListCollector, self).__init__(name=PROCESS_LIST_COLLECTOR) super().__init__(name=PROCESS_LIST_COLLECTOR)
def collect(self) -> dict: def collect(self) -> dict:
""" """