diff --git a/installation_and_upgrade/ibex_install_utils/tasks/mysql_tasks.py b/installation_and_upgrade/ibex_install_utils/tasks/mysql_tasks.py index 78eeec3..d448923 100644 --- a/installation_and_upgrade/ibex_install_utils/tasks/mysql_tasks.py +++ b/installation_and_upgrade/ibex_install_utils/tasks/mysql_tasks.py @@ -64,7 +64,7 @@ class MysqlTasks(BaseTasks): Tasks relating to installing or maintaining an installation of MySQL on a machine. """ - def _get_mysql_dir(self): + def _get_mysql_dir(self) -> str: """ Returns the mysql 8 default install directory if it exists, else 5.7. @@ -76,7 +76,7 @@ def _get_mysql_dir(self): return mysql_bin_dir - def _get_mysql_backup_dir(self): + def _get_mysql_backup_dir(self) -> str: mysql_backup_dir = os.path.join( STAGE_DELETED, self._get_machine_name(), @@ -87,14 +87,16 @@ def _get_mysql_backup_dir(self): return mysql_backup_dir @task("Truncate database") - def truncate_database(self): + def truncate_database(self) -> None: """ Truncate the message log, sample and alarms tables """ try: mysql_bin_dir = self._get_mysql_dir() - sql_command = "truncate table msg_log.message;truncate table archive.sample;truncate table alarm.pv" + sql_command = ("truncate table msg_log.message;" + "truncate table archive.sample;" + "truncate table alarm.pv") RunProcess( MYSQL_FILES_DIR, @@ -110,7 +112,7 @@ def truncate_database(self): f"Error is {ex}" ) - def _configure_mysql(self): + def _configure_mysql(self) -> None: """ Copy mysql settings and run the MySQL configuration script """ @@ -131,7 +133,7 @@ def _configure_mysql(self): admin_commands.add_command("sc", "start MYSQL80", expected_return_val=None) admin_commands.run_all() - def _remove_old_versions_of_mysql8(self, clean_install): + def _remove_old_versions_of_mysql8(self, clean_install: bool) -> None: if clean_install: self.prompt.prompt_and_raise_if_not_yes( "Warning: this will erase all data held in the MySQL database. " @@ -151,11 +153,11 @@ def _remove_old_versions_of_mysql8(self, clean_install): if clean_install: self._remove_old_mysql_data_dir() - def _remove_old_mysql_data_dir(self): + def _remove_old_mysql_data_dir(self) -> None: if os.path.exists(MYSQL_FILES_DIR): shutil.rmtree(MYSQL_FILES_DIR) - def _create_mysql_binaries(self): + def _create_mysql_binaries(self) -> None: os.makedirs(MYSQL8_INSTALL_DIR) mysql_unzip_temp = os.path.join(APPS_BASE_DIR, "temp-mysql-unzip") @@ -171,7 +173,7 @@ def _create_mysql_binaries(self): shutil.rmtree(mysql_unzip_temp) - def _initialize_mysql_data_area_for_vhd(self): + def _initialize_mysql_data_area_for_vhd(self) -> None: os.makedirs(os.path.join(MYSQL_FILES_DIR, "data")) RunProcess(