diff --git a/daemon/core/api/grpc/client.py b/daemon/core/api/grpc/client.py index 1d25b4ca3..bb45d4a5b 100644 --- a/daemon/core/api/grpc/client.py +++ b/daemon/core/api/grpc/client.py @@ -1073,9 +1073,7 @@ def create_service( recreate: bool = False, ) -> bool: request = CreateServiceRequest( - service=service.to_proto(), - templates=templates, - recreate=recreate, + service=service.to_proto(), templates=templates, recreate=recreate ) response = self.stub.CreateService(request) return response.result diff --git a/daemon/core/api/grpc/grpcutils.py b/daemon/core/api/grpc/grpcutils.py index 14eb2fe96..5dc03aca2 100644 --- a/daemon/core/api/grpc/grpcutils.py +++ b/daemon/core/api/grpc/grpcutils.py @@ -348,8 +348,7 @@ def get_node_proto( if not service.custom_templates and not service.custom_config: continue service_configs[service.name] = services_pb2.ServiceConfig( - templates=service.custom_templates, - config=service.custom_config, + templates=service.custom_templates, config=service.custom_config ) return core_pb2.Node( id=node.id, diff --git a/daemon/core/api/grpc/server.py b/daemon/core/api/grpc/server.py index 60f183c89..b69681a94 100644 --- a/daemon/core/api/grpc/server.py +++ b/daemon/core/api/grpc/server.py @@ -230,10 +230,7 @@ def GetConfig( ) services.append(service_proto) emane_models = [x.name for x in EmaneModelManager.models.values()] - return core_pb2.GetConfigResponse( - services=services, - emane_models=emane_models, - ) + return core_pb2.GetConfigResponse(services=services, emane_models=emane_models) def StartSession( self, request: core_pb2.StartSessionRequest, context: ServicerContext @@ -1305,9 +1302,7 @@ def GetWirelessConfig( return GetWirelessConfigResponse(config=config_options) def EmaneEvents( - self, - request_iterator: Iterable[EmaneEventsRequest], - context: ServicerContext, + self, request_iterator: Iterable[EmaneEventsRequest], context: ServicerContext ) -> EmaneEventsResponse: for request in request_iterator: session = self.get_session(request.session_id, context) @@ -1396,10 +1391,7 @@ def EmaneEvents( session, node, antenna.iface_id, context ) session.emane.event_manager.publish_antenna_profile( - nem_id, - antenna.profile, - antenna.azimuth, - antenna.elevation, + nem_id, antenna.profile, antenna.azimuth, antenna.elevation ) elif request.HasField("fading"): fading = request.fading @@ -1416,9 +1408,7 @@ def EmaneEvents( return EmaneEventsResponse() def CreateService( - self, - request: CreateServiceRequest, - context: ServicerContext, + self, request: CreateServiceRequest, context: ServicerContext ) -> CreateServiceResponse: service = request.service class_name = f"{service.name.capitalize()}Class" diff --git a/daemon/core/api/grpc/wrappers.py b/daemon/core/api/grpc/wrappers.py index 9627fa679..88bb50dd6 100644 --- a/daemon/core/api/grpc/wrappers.py +++ b/daemon/core/api/grpc/wrappers.py @@ -854,10 +854,7 @@ class CoreConfig: @classmethod def from_proto(cls, proto: core_pb2.GetConfigResponse) -> "CoreConfig": services = [Service.from_proto(x) for x in proto.services] - return CoreConfig( - services=services, - emane_models=list(proto.emane_models), - ) + return CoreConfig(services=services, emane_models=list(proto.emane_models)) @dataclass diff --git a/daemon/core/emane/eventmanager.py b/daemon/core/emane/eventmanager.py index 606fa011e..877a30474 100644 --- a/daemon/core/emane/eventmanager.py +++ b/daemon/core/emane/eventmanager.py @@ -107,12 +107,7 @@ def shutdown(self) -> None: self.nem_service.clear() def create_service( - self, - nem_id: int, - device: str, - group: str, - port: int, - should_start: bool, + self, nem_id: int, device: str, group: str, port: int, should_start: bool ) -> None: # initialize emane event services service = self.services.get(device) @@ -159,13 +154,7 @@ def publish_location( ) args = {k: v for k, v in args.items() if v is not None} event = LocationEvent() - event.append( - nem_id, - latitude=lat, - longitude=lon, - altitude=alt, - **args, - ) + event.append(nem_id, latitude=lat, longitude=lon, altitude=alt, **args) self._publish_event(nem_id, event, 0) def publish_locations( @@ -226,11 +215,7 @@ def publish_pathloss( self._publish_event(nem2_id, event) def publish_antenna_profile( - self, - nem_id: int, - profile: int, - azimuth: float, - elevation: float, + self, nem_id: int, profile: int, azimuth: float, elevation: float ) -> None: event = AntennaProfileEvent() event.append(nem_id, profile=profile, azimuth=azimuth, elevation=elevation) diff --git a/daemon/core/emulator/controlnets.py b/daemon/core/emulator/controlnets.py index 450324a76..e85f0415a 100644 --- a/daemon/core/emulator/controlnets.py +++ b/daemon/core/emulator/controlnets.py @@ -131,9 +131,7 @@ def add_net(self, _id: int, conf_required: bool = True) -> Optional[CtrlNet]: :return: control net node """ logger.info( - "checking to add control net(%s) conf_required(%s)", - _id, - conf_required, + "checking to add control net(%s) conf_required(%s)", _id, conf_required ) # check for valid id if not (0 <= _id <= 3): diff --git a/daemon/core/emulator/hooks.py b/daemon/core/emulator/hooks.py index ea0cc0b89..2b4c10db9 100644 --- a/daemon/core/emulator/hooks.py +++ b/daemon/core/emulator/hooks.py @@ -27,11 +27,7 @@ def _run_callback(state: EventTypes, hook: Callable[[EventTypes], None]) -> None def _run_script( - state: EventTypes, - directory: Path, - file_name: str, - data: str, - env: dict[str, str], + state: EventTypes, directory: Path, file_name: str, data: str, env: dict[str, str] ) -> None: """ Run a script hook. diff --git a/daemon/core/emulator/session.py b/daemon/core/emulator/session.py index 54a17198f..82b497fc5 100644 --- a/daemon/core/emulator/session.py +++ b/daemon/core/emulator/session.py @@ -1057,9 +1057,7 @@ def boot_node(self, node: CoreNode) -> None: :return: nothing """ logger.info( - "booting node(%s): services(%s)", - node.name, - ", ".join(node.services.keys()), + "booting node(%s): services(%s)", node.name, ", ".join(node.services.keys()) ) self.control_net_manager.setup_ifaces(node) with self.nodes_lock: diff --git a/daemon/core/gui/coreclient.py b/daemon/core/gui/coreclient.py index 2924bd643..232a880f1 100644 --- a/daemon/core/gui/coreclient.py +++ b/daemon/core/gui/coreclient.py @@ -52,11 +52,7 @@ GUI_SOURCE: str = "gui" CPU_USAGE_DELAY: int = 3 -MOBILITY_ACTIONS: dict[int, str] = { - 7: "PLAY", - 8: "STOP", - 9: "PAUSE", -} +MOBILITY_ACTIONS: dict[int, str] = {7: "PLAY", 8: "STOP", 9: "PAUSE"} def to_dict(config: dict[str, ConfigOption]) -> dict[str, str]: @@ -176,17 +172,11 @@ def handle_events(self, event: Event) -> None: if session_event.event <= SessionState.SHUTDOWN.value: self.session.state = SessionState(session_event.event) logger.info( - "session(%s) state(%s)", - event.session_id, - self.session.state, + "session(%s) state(%s)", event.session_id, self.session.state ) elif session_event.event in MOBILITY_ACTIONS: action = MOBILITY_ACTIONS[session_event.event] - logger.info( - "session(%s) mobility action(%s)", - event.session_id, - action, - ) + logger.info("session(%s) mobility action(%s)", event.session_id, action) node_id = session_event.node_id dialog = self.mobility_players.get(node_id) if dialog: diff --git a/daemon/core/gui/dialogs/nodeconfig.py b/daemon/core/gui/dialogs/nodeconfig.py index fd801d869..ab8d3c415 100644 --- a/daemon/core/gui/dialogs/nodeconfig.py +++ b/daemon/core/gui/dialogs/nodeconfig.py @@ -511,10 +511,7 @@ def click_compose(self) -> None: parent=self, initialdir=str(Path.home()), title="Select Compose File", - filetypes=( - ("yaml", "*.yml *.yaml ..."), - ("All Files", "*"), - ), + filetypes=(("yaml", "*.yml *.yaml ..."), ("All Files", "*")), ) if file_path: self.compose_file.set(file_path) diff --git a/daemon/core/gui/dialogs/nodeservice.py b/daemon/core/gui/dialogs/nodeservice.py index 04fed934e..3b5132eb3 100644 --- a/daemon/core/gui/dialogs/nodeservice.py +++ b/daemon/core/gui/dialogs/nodeservice.py @@ -121,9 +121,7 @@ def click_configure(self) -> None: self.draw_current_services() else: messagebox.showinfo( - "Service Configuration", - "Select a service to configure", - parent=self, + "Service Configuration", "Select a service to configure", parent=self ) def draw_current_services(self) -> None: diff --git a/daemon/core/gui/graph/edges.py b/daemon/core/gui/graph/edges.py index e72302161..935c01593 100644 --- a/daemon/core/gui/graph/edges.py +++ b/daemon/core/gui/graph/edges.py @@ -56,7 +56,7 @@ def node_label_positions( src_x: int, src_y: int, dst_x: int, dst_y: int ) -> tuple[tuple[float, float], tuple[float, float]]: v_x, v_y = dst_x - src_x, dst_y - src_y - v_len = math.sqrt(v_x**2 + v_y**2) + v_len = math.sqrt(v_x ** 2 + v_y ** 2) if v_len == 0: u_x, u_y = 0.0, 0.0 else: @@ -147,7 +147,7 @@ def _get_arcpoint( perp_m = -1 / m b = mp_y - (perp_m * mp_x) # get arc x and y - offset = math.sqrt(self.arc**2 / (1 + (1 / m**2))) + offset = math.sqrt(self.arc ** 2 / (1 + (1 / m ** 2))) arc_x = mp_x if self.arc >= 0: arc_x += offset diff --git a/daemon/core/gui/interface.py b/daemon/core/gui/interface.py index b275d98b3..eb063ef44 100644 --- a/daemon/core/gui/interface.py +++ b/daemon/core/gui/interface.py @@ -31,11 +31,7 @@ def get_index(iface: Interface) -> Optional[int]: class Subnets: def __init__( - self, - ip4: IPNetwork, - ip4_mask: int, - ip6: IPNetwork, - ip6_mask: int, + self, ip4: IPNetwork, ip4_mask: int, ip6: IPNetwork, ip6_mask: int ) -> None: self.ip4 = ip4 self.ip4_mask = ip4_mask diff --git a/daemon/core/gui/nodeutils.py b/daemon/core/gui/nodeutils.py index c1592fe5e..837b332bf 100644 --- a/daemon/core/gui/nodeutils.py +++ b/daemon/core/gui/nodeutils.py @@ -16,11 +16,7 @@ NODES: list["NodeDraw"] = [] NETWORK_NODES: list["NodeDraw"] = [] NODE_ICONS = {} -CONTAINER_NODES: set[NodeType] = { - NodeType.DEFAULT, - NodeType.DOCKER, - NodeType.PODMAN, -} +CONTAINER_NODES: set[NodeType] = {NodeType.DEFAULT, NodeType.DOCKER, NodeType.PODMAN} IMAGE_NODES: set[NodeType] = {NodeType.DOCKER, NodeType.PODMAN} WIRELESS_NODES: set[NodeType] = { NodeType.WIRELESS_LAN, diff --git a/daemon/core/location/mobility.py b/daemon/core/location/mobility.py index e5b56cd5b..5621c315c 100644 --- a/daemon/core/location/mobility.py +++ b/daemon/core/location/mobility.py @@ -160,10 +160,7 @@ def sendevent(self, model: "WayPointMobility") -> None: end_time = int(model.endtime) data = f"start={start_time} end={end_time}" self.session.broadcast_event( - event_type, - node_id=model.id, - name=f"mobility:{model.name}", - data=data, + event_type, node_id=model.id, name=f"mobility:{model.name}", data=data ) @@ -420,10 +417,7 @@ def create_link_data( iface2=iface2.get_data(), network_id=self.wlan.id, options=LinkOptions( - bandwidth=self.bw, - delay=self.delay, - loss=self.loss, - jitter=self.jitter, + bandwidth=self.bw, delay=self.delay, loss=self.loss, jitter=self.jitter ), color=color, ) diff --git a/daemon/core/nodes/base.py b/daemon/core/nodes/base.py index 1a2fa468b..cf7ed967d 100644 --- a/daemon/core/nodes/base.py +++ b/daemon/core/nodes/base.py @@ -593,10 +593,7 @@ def __init__( if not services: services = self.session.service_manager.defaults.get(self.model, []) logger.info( - "setting node(%s) model(%s) services: %s", - self.name, - self.model, - services, + "setting node(%s) model(%s) services: %s", self.name, self.model, services ) for name in services: service_class = self.session.service_manager.get_service(name) diff --git a/daemon/core/nodes/docker.py b/daemon/core/nodes/docker.py index 7c17973cf..829c13636 100644 --- a/daemon/core/nodes/docker.py +++ b/daemon/core/nodes/docker.py @@ -230,8 +230,7 @@ def startup(self) -> None: compose_path = self.directory / "docker-compose.yml" self.host_cmd(f'printf "{rendered}" >> {compose_path}', shell=True) self.host_cmd( - f"{DOCKER_COMPOSE} up -d {self.compose_name}", - cwd=self.directory, + f"{DOCKER_COMPOSE} up -d {self.compose_name}", cwd=self.directory ) else: # setup commands for creating bind/volume mounts diff --git a/daemon/core/scripts/daemon.py b/daemon/core/scripts/daemon.py index f54a77bd0..7534176d2 100755 --- a/daemon/core/scripts/daemon.py +++ b/daemon/core/scripts/daemon.py @@ -134,19 +134,13 @@ def main(): help="CORE logging configuration file", ) parser.add_argument( - "--grpc-port", - dest="grpcport", - help="override grpc port to listen on", + "--grpc-port", dest="grpcport", help="override grpc port to listen on" ) parser.add_argument( - "--grpc-address", - dest="grpcaddress", - help="override grpc address to listen on", + "--grpc-address", dest="grpcaddress", help="override grpc address to listen on" ) parser.add_argument( - "--ovs", - action="store_true", - help="enable experimental ovs mode", + "--ovs", action="store_true", help="enable experimental ovs mode" ) args = parser.parse_args() # convert ovs to internal format diff --git a/daemon/core/services/defaults/frrservices/services.py b/daemon/core/services/defaults/frrservices/services.py index 3bde4139a..df1c12892 100644 --- a/daemon/core/services/defaults/frrservices/services.py +++ b/daemon/core/services/defaults/frrservices/services.py @@ -91,7 +91,7 @@ class FRRZebra(CoreService): executables: list[str] = ["zebra"] startup: list[str] = ["bash frrboot.sh zebra"] validate: list[str] = ["pidof zebra"] - shutdown: list[str] = ["killall zebra"] + shutdown: list[str] = ["pkill -f zebra"] def data(self) -> dict[str, Any]: frr_conf = self.files[0] @@ -162,7 +162,7 @@ class FRROspfv2(FrrService, CoreService): """ name: str = "FRROSPFv2" - shutdown: list[str] = ["killall ospfd"] + shutdown: list[str] = ["pkill -f ospfd"] validate: list[str] = ["pidof ospfd"] ipv4_routing: bool = True @@ -214,7 +214,7 @@ class FRROspfv3(FrrService, CoreService): """ name: str = "FRROSPFv3" - shutdown: list[str] = ["killall ospf6d"] + shutdown: list[str] = ["pkill -f ospf6d"] validate: list[str] = ["pidof ospf6d"] ipv4_routing: bool = True ipv6_routing: bool = True @@ -251,7 +251,7 @@ class FRRBgp(FrrService, CoreService): """ name: str = "FRRBGP" - shutdown: list[str] = ["killall bgpd"] + shutdown: list[str] = ["pkill -f bgpd"] validate: list[str] = ["pidof bgpd"] custom_needed: bool = True ipv4_routing: bool = True @@ -281,7 +281,7 @@ class FRRRip(FrrService, CoreService): """ name: str = "FRRRIP" - shutdown: list[str] = ["killall ripd"] + shutdown: list[str] = ["pkill -f ripd"] validate: list[str] = ["pidof ripd"] ipv4_routing: bool = True @@ -306,7 +306,7 @@ class FRRRipng(FrrService, CoreService): """ name: str = "FRRRIPNG" - shutdown: list[str] = ["killall ripngd"] + shutdown: list[str] = ["pkill -f ripngd"] validate: list[str] = ["pidof ripngd"] ipv6_routing: bool = True @@ -332,7 +332,7 @@ class FRRBabel(FrrService, CoreService): """ name: str = "FRRBabel" - shutdown: list[str] = ["killall babeld"] + shutdown: list[str] = ["pkill -f babeld"] validate: list[str] = ["pidof babeld"] ipv6_routing: bool = True @@ -372,7 +372,7 @@ class FRRpimd(FrrService, CoreService): """ name: str = "FRRpimd" - shutdown: list[str] = ["killall pimd"] + shutdown: list[str] = ["pkill -f pimd"] validate: list[str] = ["pidof pimd"] ipv4_routing: bool = True diff --git a/daemon/core/services/defaults/nrlservices/services.py b/daemon/core/services/defaults/nrlservices/services.py index 7ccce0e44..f7f6cc53c 100644 --- a/daemon/core/services/defaults/nrlservices/services.py +++ b/daemon/core/services/defaults/nrlservices/services.py @@ -30,7 +30,7 @@ class NrlNhdp(CoreService): executables: list[str] = ["nrlnhdp"] startup: list[str] = ["bash nrlnhdp.sh"] validate: list[str] = ["pidof nrlnhdp"] - shutdown: list[str] = ["killall nrlnhdp"] + shutdown: list[str] = ["pkill -f nrlnhdp"] def data(self) -> dict[str, Any]: has_smf = "SMF" in self.node.services @@ -44,10 +44,10 @@ class NrlSmf(CoreService): name: str = "SMF" group: str = GROUP files: list[str] = ["startsmf.sh"] - executables: list[str] = ["nrlsmf", "killall"] + executables: list[str] = ["nrlsmf"] startup: list[str] = ["bash startsmf.sh"] validate: list[str] = ["pidof nrlsmf"] - shutdown: list[str] = ["killall nrlsmf"] + shutdown: list[str] = ["pkill -f nrlsmf"] def data(self) -> dict[str, Any]: has_nhdp = "NHDP" in self.node.services @@ -72,7 +72,7 @@ class NrlOlsr(CoreService): executables: list[str] = ["nrlolsrd"] startup: list[str] = ["bash nrlolsrd.sh"] validate: list[str] = ["pidof nrlolsrd"] - shutdown: list[str] = ["killall nrlolsrd"] + shutdown: list[str] = ["pkill -f nrlolsrd"] def data(self) -> dict[str, Any]: has_smf = "SMF" in self.node.services @@ -91,7 +91,7 @@ class NrlOlsrv2(CoreService): executables: list[str] = ["nrlolsrv2"] startup: list[str] = ["bash nrlolsrv2.sh"] validate: list[str] = ["pidof nrlolsrv2"] - shutdown: list[str] = ["killall nrlolsrv2"] + shutdown: list[str] = ["pkill -f nrlolsrv2"] def data(self) -> dict[str, Any]: has_smf = "SMF" in self.node.services @@ -109,7 +109,7 @@ class OlsrOrg(CoreService): executables: list[str] = ["olsrd"] startup: list[str] = ["bash olsrd.sh"] validate: list[str] = ["pidof olsrd"] - shutdown: list[str] = ["killall olsrd"] + shutdown: list[str] = ["pkill -f olsrd"] def data(self) -> dict[str, Any]: has_smf = "SMF" in self.node.services @@ -126,4 +126,4 @@ class MgenActor(CoreService): executables: list[str] = ["mgen"] startup: list[str] = ["bash start_mgen_actor.sh"] validate: list[str] = ["pidof mgen"] - shutdown: list[str] = ["killall mgen"] + shutdown: list[str] = ["pkill -f mgen"] diff --git a/daemon/core/services/defaults/quaggaservices/services.py b/daemon/core/services/defaults/quaggaservices/services.py index f7a037405..f18a0830c 100644 --- a/daemon/core/services/defaults/quaggaservices/services.py +++ b/daemon/core/services/defaults/quaggaservices/services.py @@ -92,7 +92,7 @@ class Zebra(CoreService): executables: list[str] = ["zebra"] startup: list[str] = ["bash quaggaboot.sh zebra"] validate: list[str] = ["pidof zebra"] - shutdown: list[str] = ["killall zebra"] + shutdown: list[str] = ["pkill -f zebra"] def data(self) -> dict[str, Any]: quagga_bin_search = self.node.session.options.get( @@ -170,7 +170,7 @@ class Ospfv2(QuaggaService, CoreService): name: str = "OSPFv2" validate: list[str] = ["pidof ospfd"] - shutdown: list[str] = ["killall ospfd"] + shutdown: list[str] = ["pkill -f ospfd"] ipv4_routing: bool = True def quagga_iface_config(self, iface: CoreInterface) -> str: @@ -220,7 +220,7 @@ class Ospfv3(QuaggaService, CoreService): """ name: str = "OSPFv3" - shutdown: list[str] = ["killall ospf6d"] + shutdown: list[str] = ["pkill -f ospf6d"] validate: list[str] = ["pidof ospf6d"] ipv4_routing: bool = True ipv6_routing: bool = True @@ -286,7 +286,7 @@ class Bgp(QuaggaService, CoreService): """ name: str = "BGP" - shutdown: list[str] = ["killall bgpd"] + shutdown: list[str] = ["pkill -f bgpd"] validate: list[str] = ["pidof bgpd"] ipv4_routing: bool = True ipv6_routing: bool = True @@ -315,7 +315,7 @@ class Rip(QuaggaService, CoreService): """ name: str = "RIP" - shutdown: list[str] = ["killall ripd"] + shutdown: list[str] = ["pkill -f ripd"] validate: list[str] = ["pidof ripd"] ipv4_routing: bool = True @@ -340,7 +340,7 @@ class Ripng(QuaggaService, CoreService): """ name: str = "RIPNG" - shutdown: list[str] = ["killall ripngd"] + shutdown: list[str] = ["pkill -f ripngd"] validate: list[str] = ["pidof ripngd"] ipv6_routing: bool = True @@ -366,7 +366,7 @@ class Babel(QuaggaService, CoreService): """ name: str = "Babel" - shutdown: list[str] = ["killall babeld"] + shutdown: list[str] = ["pkill -f babeld"] validate: list[str] = ["pidof babeld"] ipv6_routing: bool = True @@ -406,7 +406,7 @@ class Xpimd(QuaggaService, CoreService): """ name: str = "Xpimd" - shutdown: list[str] = ["killall xpimd"] + shutdown: list[str] = ["pkill -f xpimd"] validate: list[str] = ["pidof xpimd"] ipv4_routing: bool = True diff --git a/daemon/core/services/defaults/securityservices/services.py b/daemon/core/services/defaults/securityservices/services.py index 8b675e5b6..3bb886aea 100644 --- a/daemon/core/services/defaults/securityservices/services.py +++ b/daemon/core/services/defaults/securityservices/services.py @@ -11,10 +11,10 @@ class VpnClient(CoreService): name: str = "VPNClient" group: str = GROUP_NAME files: list[str] = ["vpnclient.sh"] - executables: list[str] = ["openvpn", "ip", "killall"] + executables: list[str] = ["openvpn", "ip"] startup: list[str] = ["bash vpnclient.sh"] validate: list[str] = ["pidof openvpn"] - shutdown: list[str] = ["killall openvpn"] + shutdown: list[str] = ["pkill -f openvpn"] default_configs: list[Configuration] = [ ConfigString( id="keydir", label="Key Dir", default=f"{constants.CORE_CONF_DIR}/keys" @@ -28,10 +28,10 @@ class VpnServer(CoreService): name: str = "VPNServer" group: str = GROUP_NAME files: list[str] = ["vpnserver.sh"] - executables: list[str] = ["openvpn", "ip", "killall"] + executables: list[str] = ["openvpn", "ip"] startup: list[str] = ["bash vpnserver.sh"] validate: list[str] = ["pidof openvpn"] - shutdown: list[str] = ["killall openvpn"] + shutdown: list[str] = ["pkill -f openvpn"] default_configs: list[Configuration] = [ ConfigString( id="keydir", label="Key Dir", default=f"{constants.CORE_CONF_DIR}/keys" @@ -54,10 +54,10 @@ class IPsec(CoreService): name: str = "IPsec" group: str = GROUP_NAME files: list[str] = ["ipsec.sh"] - executables: list[str] = ["racoon", "ip", "setkey", "killall"] + executables: list[str] = ["racoon", "ip", "setkey"] startup: list[str] = ["bash ipsec.sh"] validate: list[str] = ["pidof racoon"] - shutdown: list[str] = ["killall racoon"] + shutdown: list[str] = ["pkill -f racoon"] class Firewall(CoreService): diff --git a/daemon/core/services/defaults/utilservices/services.py b/daemon/core/services/defaults/utilservices/services.py index 4ecfbb301..ba61880de 100644 --- a/daemon/core/services/defaults/utilservices/services.py +++ b/daemon/core/services/defaults/utilservices/services.py @@ -85,7 +85,7 @@ class SshService(CoreService): files: list[str] = ["startsshd.sh", "/etc/ssh/sshd_config"] executables: list[str] = ["sshd"] startup: list[str] = ["bash startsshd.sh"] - shutdown: list[str] = ["killall sshd"] + shutdown: list[str] = ["pkill -f sshd"] def data(self) -> dict[str, Any]: return dict( @@ -103,7 +103,7 @@ class DhcpService(CoreService): executables: list[str] = ["dhcpd"] startup: list[str] = ["touch /var/lib/dhcp/dhcpd.leases", "dhcpd"] validate: list[str] = ["pidof dhcpd"] - shutdown: list[str] = ["killall dhcpd"] + shutdown: list[str] = ["pkill -f dhcpd"] def data(self) -> dict[str, Any]: subnets = [] @@ -126,7 +126,7 @@ class DhcpClientService(CoreService): executables: list[str] = ["dhclient"] startup: list[str] = ["bash startdhcpclient.sh"] validate: list[str] = ["pidof dhclient"] - shutdown: list[str] = ["killall dhclient"] + shutdown: list[str] = ["pkill -f dhclient"] def data(self) -> dict[str, Any]: ifnames = [] @@ -143,7 +143,7 @@ class FtpService(CoreService): executables: list[str] = ["vsftpd"] startup: list[str] = ["vsftpd ./vsftpd.conf"] validate: list[str] = ["pidof vsftpd"] - shutdown: list[str] = ["killall vsftpd"] + shutdown: list[str] = ["pkill -f vsftpd"] class PcapService(CoreService): diff --git a/daemon/core/xml/emanexml.py b/daemon/core/xml/emanexml.py index da3eb47dc..b416d5d36 100644 --- a/daemon/core/xml/emanexml.py +++ b/daemon/core/xml/emanexml.py @@ -65,10 +65,7 @@ def create_node_file( f'' ) xml_data = etree.tostring( - xml_element, - pretty_print=True, - encoding="unicode", - doctype=doctype, + xml_element, pretty_print=True, encoding="unicode", doctype=doctype ) if isinstance(node, CoreNode): file_path = Path(file_name) diff --git a/daemon/tests/test_grpc.py b/daemon/tests/test_grpc.py index 40a2751ef..db6667b78 100644 --- a/daemon/tests/test_grpc.py +++ b/daemon/tests/test_grpc.py @@ -96,9 +96,7 @@ def test_start_session(self, grpc_server: CoreGrpcServer, definition): service_name = DefaultRouteService.name file_name = DefaultRouteService.files[0] file_data = "hello world" - service_data = ServiceData( - templates={file_name: file_data}, - ) + service_data = ServiceData(templates={file_name: file_data}) node1.service_configs[service_name] = service_data # setup session option