From dd083e0e9bad9f751adbee326299ddfefb87cc1b Mon Sep 17 00:00:00 2001 From: Joao Mario Lago Date: Thu, 3 Oct 2024 03:56:23 -0300 Subject: [PATCH] core: autopilot-manager: Move Ardu to Auto diverse * Move diverse general (Not specific like settings) uses of ArduPilot to AutoPilot --- core/services/ardupilot_manager/api/app.py | 6 +++--- .../ardupilot_manager/api/v2/routers/index.py | 2 +- .../ardupilot_manager/autopilot_manager.py | 6 +++--- core/services/ardupilot_manager/exceptions.py | 14 +++++++------- core/services/ardupilot_manager/main.py | 4 ++-- core/services/ardupilot_manager/setup.py | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/services/ardupilot_manager/api/app.py b/core/services/ardupilot_manager/api/app.py index 2c4e461c61..3983def965 100644 --- a/core/services/ardupilot_manager/api/app.py +++ b/core/services/ardupilot_manager/api/app.py @@ -11,8 +11,8 @@ from api.v2.routers import index_router_v2 application = FastAPI( - title="ArduPilot Manager API", - description="ArduPilot Manager is responsible for managing ArduPilot devices connected to BlueOS.", + title="AutoPilot Manager API", + description="AutoPilot Manager is responsible for managing AutoPilot devices connected to BlueOS.", default_response_class=PrettyJSONResponse, debug=True, # TODO - Add debug after based on args ) @@ -33,7 +33,7 @@ async def root() -> HTMLResponse: html_content = """ - ArduPilot Manager + AutoPilot Manager """ diff --git a/core/services/ardupilot_manager/api/v2/routers/index.py b/core/services/ardupilot_manager/api/v2/routers/index.py index 2d06df023f..a8a1a06f24 100644 --- a/core/services/ardupilot_manager/api/v2/routers/index.py +++ b/core/services/ardupilot_manager/api/v2/routers/index.py @@ -14,7 +14,7 @@ async def root_v2() -> HTMLResponse: html_content = """ - ArduPilot Manager + AutoPilot Manager """ diff --git a/core/services/ardupilot_manager/autopilot_manager.py b/core/services/ardupilot_manager/autopilot_manager.py index 42a2ac0fa7..3bfeb691d4 100644 --- a/core/services/ardupilot_manager/autopilot_manager.py +++ b/core/services/ardupilot_manager/autopilot_manager.py @@ -13,7 +13,7 @@ from loguru import logger from exceptions import ( - ArdupilotProcessKillFail, + AutoPilotProcessKillFail, NoDefaultFirmwareAvailable, NoPreferredBoardSet, ) @@ -476,7 +476,7 @@ async def terminate_ardupilot_subprocess(self) -> None: return logger.debug("Waiting for process to die...") await asyncio.sleep(0.5) - raise ArdupilotProcessKillFail("Could not terminate Ardupilot subprocess.") + raise AutoPilotProcessKillFail("Could not terminate Ardupilot subprocess.") logger.warning("Ardupilot subprocess already not running.") async def prune_ardupilot_processes(self) -> None: @@ -497,7 +497,7 @@ async def prune_ardupilot_processes(self) -> None: try: subprocess.run(["pkill", "-9", process.pid], check=True) except Exception as error: - raise ArdupilotProcessKillFail(f"Failed to kill {process.name()}::{process.pid}.") from error + raise AutoPilotProcessKillFail(f"Failed to kill {process.name()}::{process.pid}.") from error async def kill_ardupilot(self) -> None: self.should_be_running = False diff --git a/core/services/ardupilot_manager/exceptions.py b/core/services/ardupilot_manager/exceptions.py index 3dfdbb8267..957976ef62 100644 --- a/core/services/ardupilot_manager/exceptions.py +++ b/core/services/ardupilot_manager/exceptions.py @@ -1,5 +1,5 @@ """ -Ardupilot-manager exception classes. +AutoPilot-manager exception classes. """ @@ -12,11 +12,11 @@ class NoVersionAvailable(ValueError): class InvalidManifest(ValueError): - """Ardupilot manifest file cannot be validated.""" + """AutoPilot manifest file cannot be validated.""" class ManifestUnavailable(RuntimeError): - """Ardupilot manifest file unavailable.""" + """AutoPilot manifest file unavailable.""" class NoCandidate(ValueError): @@ -44,19 +44,19 @@ class InvalidFirmwareFile(ValueError): class UndefinedPlatform(ValueError): - """Ardupilot platform is not defined.""" + """AutoPilot platform is not defined.""" class UnsupportedPlatform(ValueError): - """Ardupilot platform not supported.""" + """AutoPilot platform not supported.""" class FirmwareInstallFail(RuntimeError): """Firmware install operation failed.""" -class ArdupilotProcessKillFail(RuntimeError): - """Could not kill Ardupilot process.""" +class AutoPilotProcessKillFail(RuntimeError): + """Could not kill AutoPilot process.""" class NoDefaultFirmwareAvailable(RuntimeError): diff --git a/core/services/ardupilot_manager/main.py b/core/services/ardupilot_manager/main.py index 58251d79f6..3555565768 100755 --- a/core/services/ardupilot_manager/main.py +++ b/core/services/ardupilot_manager/main.py @@ -15,13 +15,13 @@ logging.basicConfig(handlers=[InterceptHandler()], level=0) init_logger(SERVICE_NAME) -logger.info("Starting ArduPilot Manager.") +logger.info("Starting AutoPilot Manager.") autopilot = AutoPilotManager() from api import application if not is_running_as_root(): - raise RuntimeError("ArduPilot manager needs to run with root privilege.") + raise RuntimeError("AutoPilot manager needs to run with root privilege.") if __name__ == "__main__": args = CommandLineArgs.from_args() diff --git a/core/services/ardupilot_manager/setup.py b/core/services/ardupilot_manager/setup.py index d4ebcb7b08..b32e42579d 100644 --- a/core/services/ardupilot_manager/setup.py +++ b/core/services/ardupilot_manager/setup.py @@ -55,7 +55,7 @@ version="0.0.1", author="Patrick José Pereira", author_email="patrick@bluerobotics.com", - description="ArduPilot service manager.", + description="AutoPilot service manager.", long_description=long_description, long_description_content_type="text/markdown", packages=setuptools.find_packages(),