home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import logging
- from checkbox.lib.process import Process
- from checkbox.frontend import frontend
- from checkbox.properties import String
- from checkbox.registry import Registry
-
- class CommandRegistry(Registry):
- '''Base registry for running commands.
-
- The default behavior is to return the output of the command.
-
- Subclasses should define a command parameter.
- '''
- command = String()
-
- def __init__(self, command = None):
- super(CommandRegistry, self).__init__()
- if command is not None:
- self.command = command
-
-
-
- def __str__(self):
- logging.info('Running command: %s', self.command)
- process = Process(self.command)
- while process.read():
- pass
- if process.errdata:
- logging.error('Failed to run command: %s', process.errdata.strip())
-
- return process.outdata
-
- __str__ = frontend('get_registry')(__str__)
-
- def items(self):
- item = str(self)
- return []
-
-
-