mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Allow using empty string to remove all whitelisted IPs
Currently, you have to set "--ip_whitelist=null", which is unintuitive. This adds the option to just give an empty string: "--ip_whitelist=" ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=227550896
This commit is contained in:
parent
2e7d71b238
commit
566f60d495
2 changed files with 20 additions and 3 deletions
|
@ -154,7 +154,7 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
|
|||
|
||||
@Parameter(
|
||||
names = "--ip_whitelist",
|
||||
description = "Comma-delimited list of IP ranges")
|
||||
description = "Comma-delimited list of IP ranges. An empty string clears the whitelist.")
|
||||
List<String> ipWhitelist = new ArrayList<>();
|
||||
|
||||
@Nullable
|
||||
|
@ -332,7 +332,9 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
|
|||
ImmutableList.Builder<CidrAddressBlock> ipWhitelistBuilder = new ImmutableList.Builder<>();
|
||||
if (!(ipWhitelist.size() == 1 && ipWhitelist.get(0).contains("null"))) {
|
||||
for (String ipRange : ipWhitelist) {
|
||||
ipWhitelistBuilder.add(CidrAddressBlock.create(ipRange));
|
||||
if (!ipRange.isEmpty()) {
|
||||
ipWhitelistBuilder.add(CidrAddressBlock.create(ipRange));
|
||||
}
|
||||
}
|
||||
}
|
||||
builder.setIpAddressWhitelist(ipWhitelistBuilder.build());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue