(self)
return vol_list
Get the volume bindings string for singularity exec
Get the volume bindings string for singularity exec
Get the volume bindings string for singularity exec
def _get_volume_bindings(self):
        """Get the volume bindings string for singularity exec"""
        vol_list = []
        home_dir = NixAuthentication().get_home()
        home_is_binded = False
        tmp_is_binded = False
        vartmp_is_binded = False
        for vol in self.opt["vol"]:
            (host_path, cont_path) = Uvolume(vol).split()
            if os.path.isdir(host_path):
                if host_path == home_dir and cont_path in ("", host_path):
                    home_is_binded = True
                elif host_path == "/tmp" and cont_path in ("", "/tmp"):
                    tmp_is_binded = True
                elif host_path == "/var/tmp" and cont_path in ("", "/var/tmp"):
                    vartmp_is_binded = True
            vol_list.extend(["-B", "%s:%s" % (host_path, cont_path), ])
        if not home_is_binded:
            vol_list.extend(["--home", "%s/root:%s" %
                             (self.container_root, "/root"), ])
        if not tmp_is_binded:
            vol_list.extend(["-B", "%s/tmp:/tmp" %
                             (self.container_root), ])
        if not vartmp_is_binded:
            vol_list.extend(["-B", "%s/var/tmp:/var/tmp" %
                             (self.container_root), ])
        return vol_list
def _get_volume_bindings ( self ) : vol_list = [ ] home_dir = NixAuthentication ( ) . get_home ( ) home_is_binded = False tmp_is_binded = False vartmp_is_binded = False for vol in self . opt [ "vol" ] : ( host_path , cont_path ) = Uvolume ( vol ) . split ( ) if os . path . isdir ( host_path ) : if host_path == home_dir and cont_path in ( "" , host_path ) : home_is_binded = True elif host_path == "/tmp" and cont_path in ( "" , "/tmp" ) : tmp_is_binded = True elif host_path == "/var/tmp" and cont_path in ( "" , "/var/tmp" ) : vartmp_is_binded = True vol_list . extend ( [ "-B" , "%s:%s" % ( host_path , cont_path ) , ] ) if not home_is_binded : vol_list . extend ( [ "--home" , "%s/root:%s" % ( self . container_root , "/root" ) , ] ) if not tmp_is_binded : vol_list . extend ( [ "-B" , "%s/tmp:/tmp" % ( self . container_root ) , ] ) if not vartmp_is_binded : vol_list . extend ( [ "-B" , "%s/var/tmp:/var/tmp" % ( self . container_root ) , ] ) return vol_list