Skip to content

Commit

Permalink
Merge pull request #2599 from rutsky/remove_reflection_from_commands_…
Browse files Browse the repository at this point in the history
…registry

remove reflection from worker commands registry
  • Loading branch information
tardyp committed Jan 17, 2017
2 parents 1f5865a + 676a8a6 commit f91803b
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions worker/buildbot_worker/commands/registry.py
Expand Up @@ -16,26 +16,27 @@
from __future__ import absolute_import
from __future__ import print_function

from twisted.python import reflect
import buildbot_worker.commands.fs
import buildbot_worker.commands.shell
import buildbot_worker.commands.transfer

commandRegistry = {
# command name : fully qualified factory name (callable)
"shell": "buildbot_worker.commands.shell.WorkerShellCommand",
"uploadFile": "buildbot_worker.commands.transfer.WorkerFileUploadCommand",
"uploadDirectory": "buildbot_worker.commands.transfer.WorkerDirectoryUploadCommand",
"downloadFile": "buildbot_worker.commands.transfer.WorkerFileDownloadCommand",
"mkdir": "buildbot_worker.commands.fs.MakeDirectory",
"rmdir": "buildbot_worker.commands.fs.RemoveDirectory",
"cpdir": "buildbot_worker.commands.fs.CopyDirectory",
"stat": "buildbot_worker.commands.fs.StatFile",
"glob": "buildbot_worker.commands.fs.GlobPath",
"listdir": "buildbot_worker.commands.fs.ListDir",
# command name : fully qualified factory (callable)
"shell": buildbot_worker.commands.shell.WorkerShellCommand,
"uploadFile": buildbot_worker.commands.transfer.WorkerFileUploadCommand,
"uploadDirectory": buildbot_worker.commands.transfer.WorkerDirectoryUploadCommand,
"downloadFile": buildbot_worker.commands.transfer.WorkerFileDownloadCommand,
"mkdir": buildbot_worker.commands.fs.MakeDirectory,
"rmdir": buildbot_worker.commands.fs.RemoveDirectory,
"cpdir": buildbot_worker.commands.fs.CopyDirectory,
"stat": buildbot_worker.commands.fs.StatFile,
"glob": buildbot_worker.commands.fs.GlobPath,
"listdir": buildbot_worker.commands.fs.ListDir,
}


def getFactory(command):
factory_name = commandRegistry[command]
factory = reflect.namedObject(factory_name)
factory = commandRegistry[command]
return factory


Expand Down

0 comments on commit f91803b

Please sign in to comment.