Skip to content

Commit

Permalink
Reverting changes to get absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
tjmadonna committed Feb 13, 2024
1 parent 8d4b812 commit 02b754d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/routes/entity_CRUD/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ def publish_datastage(identifier):
abort_bad_req(f"{dataset_uuid} missing contacts or contributors. Must have at least one of each")

ingest_helper = IngestFileHelper(current_app.config)
ds_path = ingest_helper.get_dataset_directory_absolute_path(entity_dict, dataset_group_uuid, dataset_uuid, False)
ds_path = ingest_helper.dataset_directory_absolute_path(dataset_data_access_level, dataset_group_uuid, dataset_uuid, False)

md_file = os.path.join(ds_path, "metadata.json")
json_object = entity_json_dumps(entity, auth_tokens, entity_instance)
Expand Down
12 changes: 6 additions & 6 deletions src/routes/entity_CRUD/ingest_file_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def make_directory(new_file_path, symbolic_file_path=None):
def dataset_asset_directory_absolute_path(self, dataset_uuid):
return file_helper.ensureTrailingSlashURL(self.appconfig['SENNET_WEBSERVICE_FILEPATH']) + dataset_uuid

def get_dataset_directory_absolute_path(self, dataset_record, group_uuid, dataset_uuid, published=False):
def get_dataset_directory_absolute_path(self, dataset_record, group_uuid, dataset_uuid):
if dataset_record['contains_human_genetic_sequences']:
access_level = self.appconfig['ACCESS_LEVEL_PROTECTED']
elif not 'data_access_level' in dataset_record:
Expand All @@ -40,9 +40,9 @@ def get_dataset_directory_absolute_path(self, dataset_record, group_uuid, datase
if 'status' in dataset_record and dataset_record['status'] == 'Published':
published = True

return self.__dataset_directory_absolute_path(access_level, group_uuid, dataset_uuid, published)
return self.dataset_directory_absolute_path(access_level, group_uuid, dataset_uuid, published)

def __dataset_directory_absolute_path(self, access_level, group_uuid, dataset_uuid, published):
def dataset_directory_absolute_path(self, access_level, group_uuid, dataset_uuid, published):
grp_name = AuthHelper.getGroupDisplayName(group_uuid)
if access_level == 'protected':
base_dir = self.appconfig['GLOBUS_PROTECTED_ENDPOINT_FILEPATH']
Expand Down Expand Up @@ -175,12 +175,12 @@ def set_dir_permissions(self, access_level, file_path, published=False, trial_ru
self.logger.error(e, exc_info=True)

def move_dataset_files_for_publishing(self, uuid, group_uuid, dataset_access_level, trial_run=False):
from_path = self.__dataset_directory_absolute_path(dataset_access_level, group_uuid, uuid, False)
from_path = self.dataset_directory_absolute_path(dataset_access_level, group_uuid, uuid, False)
if not os.path.isdir(from_path):
raise HTTPException(f"{uuid}: path not found to dataset will not publish, path is {from_path}", 500)
data_access_level = 'protected'
if not dataset_access_level == 'protected': data_access_level = 'public'
to_path = self.__dataset_directory_absolute_path(data_access_level, group_uuid, uuid, True)
to_path = self.dataset_directory_absolute_path(data_access_level, group_uuid, uuid, True)
if not trial_run:
shutil.move(from_path, to_path)
else:
Expand All @@ -204,7 +204,7 @@ def create_upload_directory(self, group_uuid, upload_uuid):
self.logger.error(e, exc_info=True)

def set_dataset_permissions(self, dataset_uuid, group_uuid, dataset_access_level, published, trial_run=False):
file_path = self.__dataset_directory_absolute_path(dataset_access_level, group_uuid, dataset_uuid, published)
file_path = self.dataset_directory_absolute_path(dataset_access_level, group_uuid, dataset_uuid, published)
return self.set_dir_permissions(dataset_access_level, file_path, published, trial_run=trial_run)

def relink_to_public(self, dataset_uuid):
Expand Down

0 comments on commit 02b754d

Please sign in to comment.