summaryrefslogtreecommitdiffstats
path: root/src/twisted
diff options
context:
space:
mode:
authorAlexander <alex@spline.inf.fu-berlin.de>2015-08-28 02:43:22 +0200
committerAlexander <alex@spline.inf.fu-berlin.de>2015-08-28 02:43:22 +0200
commitb5e718d6f4d37ca31c12eef603c6199c4b89a046 (patch)
tree3f8a96985aae9a998a9a65e9cc8bda3f12ae0fc0 /src/twisted
downloadgit-tftpd-b5e718d6f4d37ca31c12eef603c6199c4b89a046.tar.gz
git-tftpd-b5e718d6f4d37ca31c12eef603c6199c4b89a046.tar.bz2
git-tftpd-b5e718d6f4d37ca31c12eef603c6199c4b89a046.zip
Initial commit
Diffstat (limited to 'src/twisted')
-rw-r--r--src/twisted/plugins/git_tftpd_plugin.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/twisted/plugins/git_tftpd_plugin.py b/src/twisted/plugins/git_tftpd_plugin.py
new file mode 100644
index 0000000..1d2b53e
--- /dev/null
+++ b/src/twisted/plugins/git_tftpd_plugin.py
@@ -0,0 +1,32 @@
+from git_tftpd.backend import GitBackend
+from git_tftpd.protocol import TFTPProtocol
+
+from twisted.python import usage
+from twisted.plugin import IPlugin
+from twisted.application.service import IServiceMaker
+from twisted.application import internet
+
+from zope.interface import implements
+
+class Options(usage.Options):
+ optParameters = [
+ ['port', 'p', 50069, 'The port number to listen on.'],
+ ['repo', 'r', None, 'The path to the git repo. [required]'],
+ ]
+
+
+class MyServiceMaker(object):
+ implements(IServiceMaker, IPlugin)
+ tapname = 'git-tftpd'
+ description = 'A tftp server, that commits the files into a git repo.'
+ options = Options
+
+ def makeService(self, options):
+ if options['repo'] is None:
+ raise usage.UsageError, 'Missing required argument'
+
+ backend = GitBackend(options['repo'])
+ return internet.UDPServer(int(options["port"]), TFTPProtocol(backend))
+
+
+serviceMaker = MyServiceMaker()