(self)
return True
Check volume paths
Check volume paths
Check volume paths
def _check_volumes(self):
        """Check volume paths"""
        for vol in list(self.opt["vol"]):
            (host_path, cont_path) = Uvolume(vol).split()
            if not (host_path and host_path.startswith('/')):
                Msg().err("Error: invalid host volume path:", host_path)
                return False
            if not (cont_path and cont_path != '/' and
                    cont_path.startswith('/')):
                Msg().err("Error: invalid container volume path:", cont_path)
                return False
            if not os.path.exists(host_path):
                if (host_path in Config.conf['dri_list'] or
                        host_path in Config.conf['sysdirs_list']):
                    self.opt["vol"].remove(vol)
                    continue
                Msg().err("Error: invalid host volume path:", host_path)
                return False
            if not self._create_mountpoint(host_path, cont_path):
                Msg().err("Error: creating mountpoint:", host_path, cont_path)
                return False
        return True
def _check_volumes ( self ) : for vol in list ( self . opt [ "vol" ] ) : ( host_path , cont_path ) = Uvolume ( vol ) . split ( ) if not ( host_path and host_path . startswith ( '/' ) ) : Msg ( ) . err ( "Error: invalid host volume path:" , host_path ) return False if not ( cont_path and cont_path != '/' and cont_path . startswith ( '/' ) ) : Msg ( ) . err ( "Error: invalid container volume path:" , cont_path ) return False if not os . path . exists ( host_path ) : if ( host_path in Config . conf [ 'dri_list' ] or host_path in Config . conf [ 'sysdirs_list' ] ) : self . opt [ "vol" ] . remove ( vol ) continue Msg ( ) . err ( "Error: invalid host volume path:" , host_path ) return False if not self . _create_mountpoint ( host_path , cont_path ) : Msg ( ) . err ( "Error: creating mountpoint:" , host_path , cont_path ) return False return True