Пример #1
0
 def uninstall(self):
     # Make sure, that the user wants to remove the world.
     question = "Do you really want to remove the world '{}'?"\
                .format(self.world.name)
     if userinput.ask(question):
         self.world.uninstall()
     return None
Пример #2
0
 def _verify_restore(self):
     """
     Asks the user if he really wants to restore a world.
     """
     question = "Do you really want to restore the world '{}'? "\
                "The current world will be removed! "\
                .format(self.world.name)
     return userinput.ask(question, default=False)
Пример #3
0
    def uninstall(self):
        super().uninstall()

        if userinput.ask("Do you want to remove the changes in world.conf?"):
            world_conf = self.app.conf.worlds
            for section in world_conf:
                world_conf.remove_option(section, "enable_initd")
        return None
Пример #4
0
    def uninstall(self):
        super().uninstall()

        question = "{} - Do you want to remove the mirror directories?"\
                   .format(self.name)
        if userinput.ask(question, False):
            for path in self.mirrors:
                shutil.rmtree(path)
        return None
Пример #5
0
    def uninstall(self):
        """
        Called if the plugin should be uninstalled. It should
        remove all files and configuration options that it made.

        Raises: KeyboardInterrupt when the user aborts the uninstallation.
        """        
        if not userinput.ask("Do you really want to remove this plugin?"):
            # I did not want to implement a new exception type for this case.
            # I think KeyboardInterrupt is good enough.
            raise KeyboardInterrupt

        real_module = self.app.plugins.get_module(self.name)
        if real_module:
            os.remove(real_module.__file__)
        
        if userinput.ask("Do you want to remove the data directory?"):
            shutil.rmtree(self.data_dir, True)
            
        if userinput.ask("Do you want to remove the configuration?"):
            self.app.conf.main.remove_section(self.name)
        return True
Пример #6
0
 def uninstall(self):
     """
     Remove the additional configuration options in the worlds.conf.
     """
     super().uninstall()
     
     question = "Do you want to remove the additional "\
                "options in worlds.conf?".format(self.name)
     if userinput.ask(question, default=True):
         worlds_conf = self.app.conf.worlds
         for section in worlds_conf:
             worlds_conf.remove_option(section, "enable_guard")
     return None
Пример #7
0
    def ui_install(self):
        """
        Provides a user interface for the installation.
        """
        print("Installing {} ...".format(self.name))
        
        try:
            self.install()
        except InstallError as err:
            print("> An error occured during the installation.")
            print("> {}".format(err))
        else:
            if userinput.ask("Do you want to read the documentation?", True):
                self.print_doc()

            if userinput.ask("Do you want to load the plugin now?", False):
                try:
                    self.load_plugin()
                except plugin_manager.PluginException as err:
                    print("> An error occured while loading the plugin:")
                    print("> {}".format(err))

            print("Installation complete.")
        return None
Пример #8
0
    def uninstall(self):
        """
        Uninstalls the server.

        Before the server will be uninstalled, there will be some checks to
        make sure the server can be uninstalled without any side effects.
        """
        # We need a server that could replace this one.
        avlb_server = self.app.server.get_names()
        avlb_server.pop( avlb_server.index(self.server.name) )

        # Break if there is no other server available.
        if not avlb_server:
            print("{} - uninstall: failure: There's no other server that "\
                  "could replace this one.".format(self.server.name))
            return None
        
        # Make sure, that the server should be removed.
        question = "{} - uninstall: Are you sure, that you want to "\
                   "uninstall the server? ".format(self.server.name)
        if not userinput.ask(question):
            return None
        
        # Get the name of the server that should replace this one.
        replacement = userinput.get_value(
            prompt=("{} - uninstall: Which server should replace this one?\n\t"
                    "(Chose from: {}) ".format(self.server.name, avlb_server)),
            check_func=lambda server: server in avlb_server,
            )
        replacement = self.app.server.get(replacement)        
        
        # Remove the server.
        try:
            self.server.uninstall(replacement)
        except server_wrapper.ServerIsOnlineError as error:
            print("{} - uninstall: The server is still running. ",
                  "\n\t'{}'".format(self.server.name, error))
        return None