@staticmethod
    def validateInfo(doc):
        """
        Ensures we have the necessary information to connect to HDFS instance,
        and uses snakebite to actually connect to it.
        """
        info = doc.get('hdfs', {})
        for field in ('host', 'port', 'path', 'webHdfsPort', 'user'):
            if field not in info:
                raise ValidationException('Missing %s field.' % field)

        if not info['webHdfsPort']:
            info['webHdfsPort'] = 50070

        try:
            info['webHdfsPort'] = int(info['webHdfsPort'])
            info['port'] = int(info['port'])
        except __HOLE__:
            raise ValidationException('Port values must be numeric.',
                                      field='port')

        try:
            client = HdfsAssetstoreAdapter._getClient(doc)
            client.serverdefaults()
        except Exception:
            raise ValidationException('Could not connect to HDFS at %s:%d.' %
                                      (info['host'], info['port']))

        # TODO test connection to webHDFS? Not now since it's not required

        if not posixpath.isabs(info['path']):
            raise ValidationException('Path must be absolute.', field='path')

        if not client.test(info['path'], exists=True, directory=True):
            res = client.mkdir([info['path']], create_parent=True).next()
            if not res['result']:
                raise ValidationException(res['error'], field='path')

        return doc
dataset/ETHPy150Open girder/girder/plugins/hdfs_assetstore/server/assetstore.py/HdfsAssetstoreAdapter.validateInfo