Ejemplo n.º 1
0
def get_s3_home_directory(user=None):
    from desktop.models import _handle_user_dir_raz

    remote_home_s3 = REMOTE_STORAGE_HOME.get() if hasattr(
        REMOTE_STORAGE_HOME, 'get') and REMOTE_STORAGE_HOME.get() else 's3a://'
    remote_home_s3 = _handle_user_dir_raz(user, remote_home_s3)

    return remote_home_s3
Ejemplo n.º 2
0
def create_profile_for_user(user):
  p = UserProfile()
  p.user = user
  p.last_activity = dtz.now()
  p.home_directory = REMOTE_STORAGE_HOME.get() if REMOTE_STORAGE_HOME.get() else  "/user/%s" % p.user.username
  try:
    p.save()
    return p
  except:
    LOG.exception("Failed to automatically create user profile.")
    return None
Ejemplo n.º 3
0
def get_home_dir_for_abfs(user=None):
    """
  Attempts to go to the directory set in the config file or core-site.xml else defaults to abfs://
  """
    from desktop.models import _handle_user_dir_raz

    try:
        filesystem = parse_uri(get_default_abfs_fs())[0]
        remote_home_abfs = "abfs://" + filesystem
    except:
        remote_home_abfs = 'abfs://'

    # Check from remote_storage_home config only for RAZ env
    if RAZ.IS_ENABLED.get() and hasattr(REMOTE_STORAGE_HOME,
                                        'get') and REMOTE_STORAGE_HOME.get():
        remote_home_abfs = REMOTE_STORAGE_HOME.get()
        remote_home_abfs = _handle_user_dir_raz(user, remote_home_abfs)

    return remote_home_abfs
Ejemplo n.º 4
0
 def get_home_directory(self, force_home=False):
     return REMOTE_STORAGE_HOME.get() if hasattr(REMOTE_STORAGE_HOME, 'get') and REMOTE_STORAGE_HOME.get() and not force_home \
         else self._get_profile().home_directory
Ejemplo n.º 5
0
def get_s3_home_directory():
  return REMOTE_STORAGE_HOME.get() \
         if hasattr(REMOTE_STORAGE_HOME, 'get') and REMOTE_STORAGE_HOME.get() \
         else 's3a://'
Ejemplo n.º 6
0
 def get_home_directory(self):
     return REMOTE_STORAGE_HOME.get() if hasattr(REMOTE_STORAGE_HOME, 'get') and REMOTE_STORAGE_HOME.get() \
         else self._get_profile().home_directory