(self, plugins)
return blobfuses
Constructs and returns a list of blobfuse plugins.
Constructs and returns a list of blobfuse plugins.
Constructs and returns a list of blobfuse plugins .
def get_blobfuse_plugins(self, plugins):
        """Constructs and returns a list of blobfuse plugins."""

        enable_blobfuse = self.get_enable_blobfuse()
        if enable_blobfuse is None or enable_blobfuse is False:
            return []

        def identical(e1, e2):
            return e1["name"] == e2["name"] or \
                e1["mountPath"] == e2["mountPath"]

        root_tmppath = None
        local_fast_storage = self.get_local_fast_storage()
        if local_fast_storage is not None and local_fast_storage != "":
            root_tmppath = local_fast_storage.rstrip("/")

        blobfuses = []
        for i, p_bf in enumerate(plugins):
            account_name = p_bf.get("accountName")
            account_key = p_bf.get("accountKey")
            container_name = p_bf.get("containerName")
            mount_path = p_bf.get("mountPath")
            mount_options = p_bf.get("mountOptions")

            # Ignore Azure blobfuse with incomplete configurations
            if invalid_entry(account_name) or \
                    invalid_entry(account_key) or \
                    invalid_entry(container_name) or \
                    invalid_entry(mount_path):
                continue

            name = p_bf.get("name")
            if name is None:
                name = "%s-blobfuse-%d" % (self.job_id, i)

            # Reassign everything for clarity
            bf = {
                "enabled": True,
                "name": name,
                "secreds": "%s-blobfuse-%d-secreds" % (self.job_id, i),
                "accountName": b64encode(account_name),
                "accountKey": b64encode(account_key),
                "containerName": container_name,
                "mountPath": mount_path,
                "jobId": self.job_id,
            }

            if root_tmppath is not None:
                # Make tmppath unique for each blobfuse mount
                bf["rootTmppath"] = root_tmppath
                bf["tmppath"] = name

            # Also support a list of strings
            if isinstance(mount_options, list):
                mount_options = " ".join(mount_options)

            if not invalid_entry(mount_options):
                bf["mountOptions"] = mount_options

            # TODO: Refactor into mountpoint add
            blobfuses = dedup_add(bf, blobfuses, identical)

            # Add to mountpoints
            bf["mountType"] = "blobfuse"
            bf_mp = make_mountpoint(bf)
            if bf_mp is not None:
                self.add_mountpoints(bf_mp)

        return blobfuses
def get_blobfuse_plugins ( self , plugins ) : enable_blobfuse = self . get_enable_blobfuse ( ) if enable_blobfuse is None or enable_blobfuse is False : return [ ] def identical ( e1 , e2 ) : return e1 [ "name" ] == e2 [ "name" ] or e1 [ "mountPath" ] == e2 [ "mountPath" ] root_tmppath = None local_fast_storage = self . get_local_fast_storage ( ) if local_fast_storage is not None and local_fast_storage != "" : root_tmppath = local_fast_storage . rstrip ( "/" ) blobfuses = [ ] for i , p_bf in enumerate ( plugins ) : account_name = p_bf . get ( "accountName" ) account_key = p_bf . get ( "accountKey" ) container_name = p_bf . get ( "containerName" ) mount_path = p_bf . get ( "mountPath" ) mount_options = p_bf . get ( "mountOptions" ) # Ignore Azure blobfuse with incomplete configurations if invalid_entry ( account_name ) or invalid_entry ( account_key ) or invalid_entry ( container_name ) or invalid_entry ( mount_path ) : continue name = p_bf . get ( "name" ) if name is None : name = "%s-blobfuse-%d" % ( self . job_id , i ) # Reassign everything for clarity bf = { "enabled" : True , "name" : name , "secreds" : "%s-blobfuse-%d-secreds" % ( self . job_id , i ) , "accountName" : b64encode ( account_name ) , "accountKey" : b64encode ( account_key ) , "containerName" : container_name , "mountPath" : mount_path , "jobId" : self . job_id , } if root_tmppath is not None : # Make tmppath unique for each blobfuse mount bf [ "rootTmppath" ] = root_tmppath bf [ "tmppath" ] = name # Also support a list of strings if isinstance ( mount_options , list ) : mount_options = " " . join ( mount_options ) if not invalid_entry ( mount_options ) : bf [ "mountOptions" ] = mount_options # TODO: Refactor into mountpoint add blobfuses = dedup_add ( bf , blobfuses , identical ) # Add to mountpoints bf [ "mountType" ] = "blobfuse" bf_mp = make_mountpoint ( bf ) if bf_mp is not None : self . add_mountpoints ( bf_mp ) return blobfuses