Skip to content

Commit

Permalink
updates based on PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jreadey committed Jan 9, 2024
1 parent acec4be commit db68988
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
6 changes: 3 additions & 3 deletions hsds/link_dn.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ async def GET_Links(request):


async def POST_Links(request):
"""HTTP POST method to return JSON for a link a given set of links """
"""HTTP POST method to return JSON for a link or a given set of links """
log.request(request)
app = request.app
params = request.rel_url.query
Expand All @@ -164,7 +164,7 @@ async def POST_Links(request):
bucket = params["bucket"]

if not bucket:
msg = "GET_Links - no bucket param"
msg = "POST_Links - no bucket param"
log.warn(msg)
raise HTTPBadRequest(reason=msg)

Expand Down Expand Up @@ -224,7 +224,7 @@ async def POST_Links(request):
link_list.append(item)

if not link_list:
msg = f"POST link - requested {len(titles)} but none were found"
msg = f"POST_links - requested {len(titles)} but none were found"
log.warn(msg)
raise HTTPNotFound()

Expand Down
7 changes: 3 additions & 4 deletions hsds/link_sn.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ async def PUT_Link(request):


async def DELETE_Links(request):
"""HTTP method to delete multiple link"""
"""HTTP method to delete multiple links """
log.request(request)
app = request.app
params = request.rel_url.query
Expand Down Expand Up @@ -432,10 +432,9 @@ async def POST_Links(request):

resp_json["links"] = links
else:
# get multi obj
# don't follow links for the groups we visit!
# Use DomainCrawler to fetch links from multiple object.
# set the follow_links and bucket params
crawler_params = {"follow_links": follow_links, "bucket": bucket}
# mixin params

kwargs = {"action": "get_link", "raise_error": True, "params": crawler_params}
crawler = DomainCrawler(app, items, **kwargs)
Expand Down
12 changes: 6 additions & 6 deletions hsds/servicenode_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,30 +452,30 @@ async def putLink(app, group_id, title, tgt_id=None, h5path=None, h5domain=None,

async def putHardLink(app, group_id, title, tgt_id=None, bucket=None):
""" create a new hard link. Return 201 if this is a new link,
or 201 if it's a duplicate of an existing link """
or 200 if it's a duplicate of an existing link """

status = await putLink(app, group_id, title, tgt_id=tgt_id, bucket=bucket)
return status


async def putSoftLink(app, group_id, title, h5path=None, bucket=None):
""" create a new hard link. Return 201 if this is a new link,
or 201 if it's a duplicate of an existing link """
""" create a new soft link. Return 201 if this is a new link,
or 200 if it's a duplicate of an existing link """

status = await putLink(app, group_id, title, h5path=h5path, bucket=bucket)
return status


async def putExternalLink(app, group_id, title, h5path=None, h5domain=None, bucket=None):
""" create a new hard link. Return 201 if this is a new link,
or 201 if it's a duplicate of an existing link """
""" create a new external link. Return 201 if this is a new link,
or 200 if it's a duplicate of an existing link """

status = await putLink(app, group_id, title, h5path=h5path, h5domain=h5domain, bucket=bucket)
return status


async def deleteLinks(app, group_id, titles=None, separator="/", bucket=None):
""" delete the requested set of attributes from the given object """
""" delete the requested set of links from the given object """

if titles is None or len(titles) == 0:
msg = "provide a list of link names for deletion"
Expand Down
2 changes: 1 addition & 1 deletion tests/integ/link_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ def testPostLinkMultiple(self):
self.assertEqual(len(obj_links), 6)
expected_group_links = ("g1", "g2", "g1.1", "g1.2", "g1.2.1", )
expected_dset_links = ("dset1.2", "dset2.2", "dset1.1.1", "dset1.1.2", "dset2.1", )
expected_soft_links = ("slink",)
expected_soft_links = ("slink", )
expected_external_links = ("extlink", )

# listify the returned links
Expand Down

0 comments on commit db68988

Please sign in to comment.