Skip to content

Commit 3137892

Browse files
voetbergrdimaio
authored andcommitted
Client: Enforce DID requirement for content list/history rucio#7674
1 parent a344e14 commit 3137892

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/rucio/cli/did.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def content():
117117

118118

119119
@content.command("history")
120-
@click.argument("dids", nargs=-1)
120+
@click.argument("dids", nargs=-1, required=True)
121121
@click.pass_context
122122
def content_history(ctx, dids):
123123
"""List the content history of a collection-type DID"""
@@ -146,7 +146,7 @@ def content_remove(ctx, dids, from_did):
146146

147147

148148
@content.command("list")
149-
@click.argument("dids", nargs=-1)
149+
@click.argument("dids", nargs=-1, required=True)
150150
@click.option("--short", is_flag=True, default=False, help="Just dump the list of DIDs.")
151151
@click.pass_context
152152
def content_list_(ctx, dids, short):

tests/test_cli_client_structure.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,15 @@ def test_did_content(root_account, rucio_client):
314314
assert "ERROR" not in err
315315
assert dataset in out
316316

317+
# Verify dids are required for list/history is enforced
318+
cmd = "rucio did content list"
319+
exitcode, out, err = execute(cmd)
320+
assert exitcode == 2
321+
322+
cmd = "rucio did content history"
323+
exitcode, out, err = execute(cmd)
324+
assert exitcode == 2
325+
317326
execute(f"rucio did content remove {scope}:{dataset} --from-did {scope}:{container}")
318327

319328
cmd = f"rucio did content history {scope}:{container}"

0 commit comments

Comments
 (0)