Skip to content

Commit

Permalink
Remove plugin modules from node config.
Browse files Browse the repository at this point in the history
  • Loading branch information
maffoo committed Feb 3, 2016
1 parent 9aa92c0 commit 779e90c
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions labrad/node/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
that contain a file called '.nodeignore' will be skipped,
along with all their subdirs.
extensions (*s): what files to look at, e.g. ['.ini', '.py', '.exe']
packages (*s): python packages to be scanned for servers using twisted's
plugin system (this feature is deprecated and will be removed).
autostart (*s): list of servers to be autostarted
Changes required on the server:
Expand Down Expand Up @@ -87,7 +86,6 @@
from twisted.internet.error import ProcessDone, ProcessTerminated
from twisted.python import usage
from twisted.python.runtime import platformType
from twisted.plugin import getPlugins

import labrad
from labrad import protocol, util, types as T, constants as C
Expand Down Expand Up @@ -438,8 +436,6 @@ class NodeConfig(object):
runnable servers.
exts (list(string)): a list of file extensions that will be included
when searching for servers.
mods (list(string)): a list of python modules that will be searched for
runnable servers using twisted's plugin mechanism. TODO: remove this
autostart (list(string)): a list of servers that will be automatically
started when the node launches.
"""
Expand Down Expand Up @@ -496,9 +492,9 @@ def _packet(self):

def _update(self, config, triggerRefresh=True):
"""Update instance variables from loaded config."""
self.dirs, self.mods, self.extensions, self.autostart = config
print 'config updated: dirs={}, modules={}, extensions={}, autostart={}'.format(
self.dirs, self.mods, self.extensions, self.autostart)
self.dirs, self.extensions, self.autostart = config
print 'config updated: dirs={}, extensions={}, autostart={}'.format(
self.dirs, self.extensions, self.autostart)
if triggerRefresh:
self.parent.refreshServers()

Expand All @@ -510,27 +506,23 @@ def _load(self, nodename=None, create=False, defaults=None):
p.cd(['', 'Nodes', nodename], True)
if create:
p.set('directories', defaults[0])
p.set('packages', defaults[1])
p.set('extensions', defaults[2])
p.set('autostart', defaults[3])
p.get('directories', '*s', key='dirs')
p.get('packages', '*s', key='mods')
p.get('extensions', '*s', key='exts')
p.get('autostart', '*s', True, [], key='autostart')
ans = yield p.send()
def remove_empties(strs):
return [s for s in strs if s]
dirs = remove_empties(ans.dirs)
mods = remove_empties(ans.mods)
exts = remove_empties(ans.exts)
autostart = sorted(remove_empties(ans.autostart))
returnValue((dirs, mods, exts, autostart))
returnValue((dirs, exts, autostart))

def _save(self):
"""Save the current configuration to the registry."""
p = self._packet()
p.set('directories', self.dirs)
p.set('packages', self.mods)
p.set('extensions', self.extensions)
return p.send()

Expand Down

0 comments on commit 779e90c

Please sign in to comment.