Example #1
0
 def delete_config_file(self) -> bool:
     if self.app_type in (Types.PYTHON_APP.value, Types.APT_APP.value):
         file = self.app_setting.config_file if self.app_setting.config_file else os.path.join(
             self.get_global_dir(), 'config/config.json')
         delete_file(file)
         return True
     return False
Example #2
0
 def uninstall_plugin(self, plugin) -> bool:
     try:
         plugin_file_name = get_plugin_file_name(plugin)
         file = os.path.join(self.get_plugin_installation_dir(),
                             plugin_file_name)
         delete_file(file)
     except Exception as e:
         logger.info(str(e))
         return False
     return True
Example #3
0
 def install_plugin(self, plugin) -> bool:
     try:
         mode = 0o744
         plugin_file_name = get_plugin_file_name(plugin)
         plugin_download_file = os.path.join(self.get_plugin_download_dir(),
                                             plugin_file_name)
         if os.path.exists(plugin_download_file):
             plugin_installation_dir: str = self.get_plugin_installation_dir(
             )
             plugin_installation_file: str = os.path.join(
                 plugin_installation_dir, plugin_file_name)
             os.makedirs(plugin_installation_dir, mode, True)
             shutil.copy(plugin_download_file, plugin_installation_file)
             delete_file(plugin_download_file)
             return True
     except Exception as e:
         logger.info(str(e))
     return False
Example #4
0
    def uninstall(self) -> bool:
        print('Stopping Linux Service...')
        if not execute_command('systemctl stop {}'.format(
                self.__service_file_name)):
            return False

        print('Un-linking Linux Service...')
        try:
            os.unlink(self.__symlink_service_file)
        except FileNotFoundError as e:
            print(str(e))

        print('Removing Linux Service...')
        delete_file(self.__service_file)

        print('Hitting daemon-reload...')
        if not execute_command('sudo systemctl daemon-reload'):
            return False
        print('Service is deleted.')
        return True
Example #5
0
 def delete_env_file(self) -> bool:
     if self.app_type == Types.FRONTEND_APP.value:
         delete_file(os.path.join(self.get_global_dir(), 'config/.env'))
         return True
     return False
Example #6
0
 def delete_logging_file(self) -> bool:
     if self.app_type == Types.PYTHON_APP.value:
         delete_file(
             os.path.join(self.get_global_dir(), 'config/logging.conf'))
         return True
     return False