Mounts a share at /Volumes

    Args:
        share_path: String URL with all auth info to connect to file share.

    Returns:
        The mount point or raises an error.
766463
def mount_share(share_path):
    
    sh_url = CFURLCreateWithString(None, share_path, None)
    # Set UI to reduced interaction
    open_options = {NetFS.kNAUIOptionKey: NetFS.kNAUIOptionNoUI}
    # Allow mounting sub-directories of root shares
    mount_options = {NetFS.kNetFSAllowSubMountsKey: True}
    # Build our connected pointers for our results
    result, output = NetFS.NetFSMountURLSync(sh_url, None, None, None,
                                             open_options, mount_options, None)
    # Check if it worked
    if result != 0:
        raise Exception('Error mounting url "%s": %s' % (share_path, output))
    # Return the mountpath
    return str(output[0])
257129
def mkdir(self, pathobj, _):
        
        if not pathobj.drive or not pathobj.root:
            raise RuntimeError("Full path required: '%s'" % str(pathobj))

        if pathobj.exists():
            raise OSError(17, "File exists: '%s'" % str(pathobj))

        url = str(pathobj) + '/'
        text, code = self.rest_put(url, session=pathobj.session, verify=pathobj.verify, cert=pathobj.cert)

        if not code == 201:
            raise RuntimeError("%s %d" % (text, code))
253589
def shares(path, options={})
      path = path.sub(/^\//, '')
      rest = Dropbox.check_path(path).split('/')
      
      begin
        return JSON.parse( api_response(:post, 'shares', root(options), *rest).body ).symbolize_keys_recursively
      rescue UnsuccessfulResponseError => error
        return error.response['Location'] if error.response.kind_of?(Net::HTTPFound)
        #TODO shouldn't be using rescue blocks for normal program flow
        raise error
      end
    end
455927
def can_share_folder(self, user, folder):
        
        return folder.parent_id is None and folder.author_id == user.id
900978
def get_path(self, path=''):
        

        if not path:
            host = self.resource_config.backup_location
            if ':' not in host:
                scheme = self.resource_config.backup_type
                if not scheme or scheme.lower() == self.DEFAULT_FILE_SYSTEM.lower():
                    scheme = self.file_system
                scheme = re.sub('(:|/+).*$', '', scheme, re.DOTALL)
                host = re.sub('^/+', '', host)
                host = '{}://{}'.format(scheme, host)
            path = host

        url = UrlParser.parse_url(path)

        if url[UrlParser.SCHEME].lower() in AUTHORIZATION_REQUIRED_STORAGE:
            if UrlParser.USERNAME not in url or not url[UrlParser.USERNAME]:
                url[UrlParser.USERNAME] = self.resource_config.backup_user
            if UrlParser.PASSWORD not in url or not url[UrlParser.PASSWORD]:
                url[UrlParser.PASSWORD] = self._api.DecryptPassword(self.resource_config.backup_password).Value
        try:
            result = UrlParser.build_url(url)
        except Exception as e:
            self._logger.error('Failed to build url: {}'.format(e))
            raise Exception('ConfigurationOperations', 'Failed to build path url to remote host')
        return result
743973
def url_for(path, opts = {})
      path = absolute(path)
      (opts[:expires] ? storage.media(path) : storage.shares(path))['url']
    end
172096
def safe_mkdir(path, uid=-1, gid=-1):
    
    try:
        os.mkdir(path)
    except OSError as e:
        if e.errno == errno.EEXIST:
            pass
        else:
            raise
    else:
        os.chown(path, uid, gid)
939893
def listdir(self, path='.'):
        
        self._connect()

        if self.sftp:
            contents = self._sftp_listdir(path)
        else:
            contents = self._ftp_listdir(path)

        self._close()

        return contents
72696
def mount_tune(path, data = {})
      json = client.post("/v1/sys/mounts/#{encode_path(path)}/tune", JSON.fast_generate(data))
      return true
    end
981671
def check_path(path, credentials=None):
    
    from thunder.readers import get_file_reader
    reader = get_file_reader(path)(credentials=credentials)
    existing = reader.list(path, directories=True)
    if existing:
        raise ValueError('Path %s appears to already exist. Specify a new directory, '
                         'or call with overwrite=True to overwrite.' % path)
45723
def _build_mountpoint(self, volume):
        
        self.add_volume(self._build_volume(volume))
        return {
            'sourceVolume': self.path_to_name(volume.get('host')),
            'containerPath': volume.get('container')
        }
291287
def join(self, path):
        

        return self.parse_uri(urlparse(os.path.join(str(self), path)), storage_args=self.storage_args)
548982
def link(src, path):
    '''
    
    '''
    src = os.path.expanduser(src)

    if not os.path.isabs(src):
        raise SaltInvocationError('File path must be absolute.')

    try:
        os.link(src, path)
        return True
    except (OSError, IOError):
        raise CommandExecutionError('Could not create \'{0}\''.format(path))
    return False
1302422
def connect(self, require_secure_negotiate=True):
        
        log.info("Session: %s - Creating connection to share %s"
                 % (self.session.username, self.share_name))
        utf_share_name = self.share_name.encode('utf-16-le')
        connect = SMB2TreeConnectRequest()
        connect['buffer'] = utf_share_name

        log.info("Session: %s - Sending Tree Connect message"
                 % self.session.username)
        log.debug(str(connect))
        request = self.session.connection.send(connect,
                                               sid=self.session.session_id)

        log.info("Session: %s - Receiving Tree Connect response"
                 % self.session.username)
        response = self.session.connection.receive(request)
        tree_response = SMB2TreeConnectResponse()
        tree_response.unpack(response['data'].get_value())
        log.debug(str(tree_response))

        # https://msdn.microsoft.com/en-us/library/cc246687.aspx
        self.tree_connect_id = response['tree_id'].get_value()
        log.info("Session: %s - Created tree connection with ID %d"
                 % (self.session.username, self.tree_connect_id))
        self._connected = True
        self.session.tree_connect_table[self.tree_connect_id] = self

        capabilities = tree_response['capabilities']
        self.is_dfs_share = capabilities.has_flag(
            ShareCapabilities.SMB2_SHARE_CAP_DFS)
        self.is_ca_share = capabilities.has_flag(
            ShareCapabilities.SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY)

        dialect = self.session.connection.dialect
        if dialect >= Dialects.SMB_3_0_0 and \
                self.session.connection.supports_encryption:
            self.encrypt_data = tree_response['share_flags'].has_flag(
                ShareFlags.SMB2_SHAREFLAG_ENCRYPT_DATA)

            self.is_scaleout_share = capabilities.has_flag(
                ShareCapabilities.SMB2_SHARE_CAP_SCALEOUT)

            # secure negotiate is only valid for SMB 3 dialects before 3.1.1
            if dialect < Dialects.SMB_3_1_1 and require_secure_negotiate:
                self._verify_dialect_negotiate()
1021891
def add_volume(self, path):
        
        self.check_not_finalized()
        if self.volumes is None:
            self.volumes = [path]
        else:
            self.volumes.append(path)
764838
def UploadType(cls, file_path):
        
        if not os.path.isabs(file_path):
            return False
        
        if os.path.isfile(file_path):
            cls.SendKeys(file_path)
        else:            
            return False
1298731
def put_and_get_url(path, options = {})
      ext = options[:ext] || File.extname(path)
      path = path.to_s
      tname = put(path, :ext => ext)

      "http://img0#{rand(4)+1}.taobaocdn.com/tfscom/#{t}#{ext}" unless tname.nil?
    end