コード例 #1
0
ファイル: container.py プロジェクト: LCROBOT/rce
 def __init__(self, reactor, rootfs, conf):
     """ Initialize the Container.
         
         @param reactor:     Reference to the twisted::reactor
         @type  reactor:     twisted::reactor
         
         @param rootfs:      Filesystem path of the root directory of the
                             container filesystem.
         @type  rootfs:      str
         
         @param conf:        Filesystem path of folder where configuration
                             files for the container should be stored.
         @type  conf:        str
     """
     self._reactor = reactor
     self._rootfs = rootfs
     self._conf = pjoin(conf, 'config')
     self._fstab = pjoin(conf, 'fstab')
     
     pathUtil.checkPath(conf, 'Container Configuration')
     
     if os.path.exists(self._conf):
         raise ValueError('There is already a config file in given '
                          'configuration folder.')
     
     if os.path.exists(self._fstab):
         raise ValueError('There is already a fstab file in given '
                          'configuration folder.')
     
     self._fstabExt = []
コード例 #2
0
ファイル: manager.py プロジェクト: LCROBOT/rce
 def __init__(self, reactor):
     """ Initialize the Container Manager.
         
         @raise:         ValueError, if the paths/names are invalid.
     """
     super(ContainerManager, self).__init__(reactor)
     
     self._relayID = None
     
     # Keys:    Container tag
     # Values:  bool (True = ok; False = delete again)
     self._pending = {}
     
     self._rootfs = self._ROOTFS
     self._confDir = self._CONF_DIR
     self._dataDir = self._DATA_DIR
     self._srcDir = self._ROOT_SRC_DIR
     
     # Validate directory paths
     pathUtil.checkPath(self._confDir, 'Configuration')
     pathUtil.checkPath(self._dataDir, 'Data')
     pathUtil.checkPath(self._rootfs, 'Container file system')
     pathUtil.checkPath(self._srcDir, 'RCE source')
     
     # Validate executable paths
     pathUtil.checkExe(self._srcDir, 'environment.py')
     pathUtil.checkExe(self._srcDir, 'launcher.py')
     
     # Process ROS package paths
     self._pkgDir = pathUtil.processPackagePaths(self._ROOT_PKG_DIR)
     
     for _, path in self._pkgDir:
         os.mkdir(os.path.join(self._rootfs, path))