Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8e3fe99

Browse files
committed
added 'reclone' command
1 parent 4f14d59 commit 8e3fe99

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

‎README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,5 @@ You can now use the following commands in the prompt :
7070
- restart : Restart the daemon and server. To refresh your configuration for example
7171
- clear : Clear the screen
7272
- keepalive {id} {True|False} : Choose if a service should be automatically restarted or not
73-
- log : Print the contents of the logfile
73+
- log : Print the contents of the logfile
74+
- reclone : Delete the directory of a service and clone it again

‎modules/commands.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import logging as log
33
import config
4-
available_commands = ["quit", "list", "start", "kill", "status", "restart", "clear", "keepalive", "log"]
4+
available_commands = ["quit", "list", "start", "kill", "status", "restart", "clear", "keepalive", "log", "reclone"]
55

66
def handle_input(command, worker, server=None):
77
command = command.strip()
@@ -84,3 +84,8 @@ def kill(worker, args=None, server=None):
8484
return "Service killed"
8585
return "Cannot find service"
8686

87+
def reclone(worker, args=None, server=None):
88+
if len(args) > 1:
89+
worker.delete(int(args[1]))
90+
return "Service deleted"
91+
return "Cannot find service"

‎modules/service.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from sys import path
66
from time import sleep
77
import run
8+
import shutil
89
import sys
910
import os
1011
import logging as log
@@ -61,6 +62,9 @@ def start(self):
6162
self.process = Process(target=self.run, args=[])
6263
self.process.start()
6364

65+
def delete(self):
66+
shutil.rmtree('%s/%s' %(self.services_directory, self.directory))
67+
6468
def stop(self):
6569
self.process.terminate()
6670

‎modules/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ def check_config():
2323

2424
def git_clone(url, name):
2525
Repo.clone_from(url, config.daemon['services_directory'] + "/" + name)
26-

‎modules/worker.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ def add(self, service):
4545
self.lastId += 1
4646
service.setId(self.lastId)
4747
self.services.append(service)
48-
48+
49+
def delete(self, id):
50+
service = self.getService(id)
51+
if service is None:
52+
log.warning("There is no service with id %i" %id)
53+
return
54+
service.delete()
55+
4956
def kill(self, id):
5057
service = self.getService(id)
5158
if service is None:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /