Skip to content

Commit

Permalink
Fix handling of target list to account for possible omission
Browse files Browse the repository at this point in the history
  • Loading branch information
greenc-FNAL committed Sep 10, 2024
1 parent da4dc28 commit 55e5e29
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,12 @@ public class MigrationCopyCommand implements Callable<String> {
usage = "Enables the transfer of files from a disabled pool.")
boolean forceSourceMode;

@Argument(metaVar = "target")
String[] targets;
@Argument(metaVar = "target",
required = false,
usage = "Required unless -target=pgroup is supplied, in which case we" +
"default to the unique pool group of which the source pool is a member," +
"if such exists.")
String[] targets = {};

@CommandLine
String commandLine;
Expand Down Expand Up @@ -804,8 +808,13 @@ public String call() throws IllegalArgumentException {
Expression includeExpression =
createPoolPredicate(includeWhen, TRUE_EXPRESSION);

List<String> targets_list = asList(targets);
if (targets_list.isEmpty() && ! target.equals("pgroup")) {
throw new IllegalArgumentException("target(s) required when target type is " + target);
}

RefreshablePoolList poolList =
new PoolListFilter(createPoolList(target, asList(targets)),
new PoolListFilter(createPoolList(target, targets_list),
excluded, excludeExpression,
included, includeExpression,
sourceList);
Expand Down

0 comments on commit 55e5e29

Please sign in to comment.