twisted/plugins/fixbot_nexus_plugin.py
author Tero Marttila <terom@fixme.fi>
Fri, 05 Feb 2010 22:20:59 +0200
changeset 59 43806d334fb4
parent 43 78bc61c677d8
child 62 e4db89a5f6bc
permissions -rw-r--r--
prepend source name to output type
23
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
     1
from zope.interface import implements
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
     2
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
     3
from twisted.python import usage
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
     4
from twisted.plugin import IPlugin
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
     5
from twisted.application.service import IServiceMaker
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
     6
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
     7
from twisted.application import internet
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
     8
37
6fd6a9fdc001 add --config, and rename some of the option names/shortnames
Tero Marttila <terom@fixme.fi>
parents: 35
diff changeset
     9
from fixbot import config, nexus
23
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    10
37
6fd6a9fdc001 add --config, and rename some of the option names/shortnames
Tero Marttila <terom@fixme.fi>
parents: 35
diff changeset
    11
class NexusOptions (config.ConfigOptions) :
6fd6a9fdc001 add --config, and rename some of the option names/shortnames
Tero Marttila <terom@fixme.fi>
parents: 35
diff changeset
    12
    
23
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    13
    optParameters = [
37
6fd6a9fdc001 add --config, and rename some of the option names/shortnames
Tero Marttila <terom@fixme.fi>
parents: 35
diff changeset
    14
        (   "irc-server",   "s",    "irc.fixme.fi",     "IRC server hostname",                          ),
23
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    15
        (   "irc-port",     "p",    6667,               "IRC server port",                      int     ),
37
6fd6a9fdc001 add --config, and rename some of the option names/shortnames
Tero Marttila <terom@fixme.fi>
parents: 35
diff changeset
    16
        (   "irc-nickname", "N",    "FixBotDev",        "IRC nickname",                                 ),
23
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    17
        (   "irc-username", "U",    "fixbot",           "IRC username",                                 ),
37
6fd6a9fdc001 add --config, and rename some of the option names/shortnames
Tero Marttila <terom@fixme.fi>
parents: 35
diff changeset
    18
        (   "irc-channel",  "C",    "#fixme-test",      "IRC channel",                                  ),
23
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    19
        (   "api-listen",   "l",    "127.0.0.1",        "address for API server to listen on"           ),
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    20
        (   "api-port",     "P",    34888,              "port for API server to listen on",     int     ),
35
5b6043ce9686 kill off the fixbot/*.py.dist config files, prepare for reading them from etc/, add an --api-secret option. Breaks logwatch
Tero Marttila <terom@fixme.fi>
parents: 25
diff changeset
    21
        (   "api-secret",   None,   None,               "secret key for API connections"                ),
23
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    22
    ]
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    23
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    24
    optFlags = [
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    25
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    26
    ]
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    27
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    28
class MyServiceMaker (object) :
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    29
    implements(IServiceMaker, IPlugin)
43
78bc61c677d8 fix fixbot_* -> fixbot-*, update defaults/init.d scripts
Tero Marttila <terom@fixme.fi>
parents: 37
diff changeset
    30
    tapname = "fixbot-nexus"
25
6c0a53a512d8 make fifo.py less spammy, tweak other descriptions/init.d
Tero Marttila <terom@fixme.fi>
parents: 23
diff changeset
    31
    description = "FixBot (nexus component)"
23
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    32
    options = NexusOptions
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    33
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    34
    def makeService (self, config) :
35
5b6043ce9686 kill off the fixbot/*.py.dist config files, prepare for reading them from etc/, add an --api-secret option. Breaks logwatch
Tero Marttila <terom@fixme.fi>
parents: 25
diff changeset
    35
        if config['api-secret'] is None :
37
6fd6a9fdc001 add --config, and rename some of the option names/shortnames
Tero Marttila <terom@fixme.fi>
parents: 35
diff changeset
    36
            raise usage.UsageError("No value given for required option api-secret")
35
5b6043ce9686 kill off the fixbot/*.py.dist config files, prepare for reading them from etc/, add an --api-secret option. Breaks logwatch
Tero Marttila <terom@fixme.fi>
parents: 25
diff changeset
    37
23
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    38
        return nexus.makeService(config)
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    39
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    40
serviceMaker = MyServiceMaker()
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    41
67e71e9170e5 rename plugin fixbot -> fixbot_nexus, add fixbot_logwatch plugin, fix some random bugs
terom@fixme.fi
parents:
diff changeset
    42