예제 #1
0
파일: packaging.py 프로젝트: TurpIF/KHome
def uninstall(module_name):
    """
    Uninstall a module by its name. Raise a ValueError if the module is already
    installed.
    """
    if not is_installed(module_name):
        raise ValueError('Module not installed')

    # stop the instance
    try:
        instance.stop(module_name)
    except RuntimeError:
        pass # ignore if module is already stopped

    # run the "uninstall" command
    # if not run_module_command(module_name, 'uninstall'):
    #     print 'Pas reussi a desinstaller'
    #     return False

    # remove the module directory tree
    try:
        shutil.rmtree(path.module_directory(module_name))
    except OSError as e:
        logger.exception(e)
        return False
    else:
        return True
예제 #2
0
def stop_instance():
    os.system('clear')
    ec2 = boto3.resource('ec2')

    print ('''
     ===========================================
                 Stopping Instance
     ===========================================
     ''')

    ints = []
    for i in ec2.instances.all():
        ints.append(i)

    for x in range (0, len(ints)):
        print (' Index ', x + 1, '=>\t', ints[x].id, " is ", ints[x].state)

    print ("\nEneter the index of desired instance:")
    index = input (' >>> ')

    instance = ints[int(index) - 1]

    try:
        if (instance.state == 'stopped'):
            print ("Instance is already stopped")
        else:
            instance.reload()
            instance.stop()
            print ("Instance stopping!! ")
            time.sleep(5)
            print('\n Done *__*')

    except Exception as error:
        print('\n< ----- !!!!OPSIES something went wrong!!!!! ----- >\n\n')
        print(error)
예제 #3
0
파일: packaging.py 프로젝트: jmcomets/KHome
def uninstall(module_name):
    """
    Uninstall a module by its name. Raise a ValueError if the module is already
    installed.
    """
    if not is_installed(module_name):
        raise ValueError('Module not installed')

    # stop the instance
    try:
        instance.stop(module_name)
    except RuntimeError:
        pass  # ignore if module is already stopped

    # run the "uninstall" command
    # if not run_module_command(module_name, 'uninstall'):
    #     print 'Pas reussi a desinstaller'
    #     return False

    # remove the module directory tree
    try:
        shutil.rmtree(path.module_directory(module_name))
    except OSError as e:
        logger.exception(e)
        return False
    else:
        return True
예제 #4
0
파일: daemon.py 프로젝트: hw233/python_misc
        def stop(self):
                if self._func_stop:
                        self._func_stop()
                
                instance.stop()

                db_ins.stop()
                
                net_trans.stop()
예제 #5
0
    def stop(self):
        self.running = False
        self.sock.shutdown(socket.SHUT_RDWR)
        self.sock.close()
        self.join()

        for k, instance in self.instances.items():
            instance.stop()
        self.master_instance.stop()
        shutil.rmtree(self.session_dir, True)