Skip to content

Commit a2dffd0

Browse files
committed
Always honor --no-register
If `auto-register` was turned on, newly added hosts would always be registered automatically. Even if the `--no-register` was specifically set as command line parameter. The cli parameters should always overwrite the defaults set in the configuration. That's what this patch is fixing.
1 parent 6669ee2 commit a2dffd0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

deterrerscli/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def delete(ipv4):
6262
@click.option('--admin', '-a', multiple=True, required=True)
6363
@click.option('--profile', '-p', default='', type=types.PROFILE_TYPE)
6464
@click.option('--firewall', '-f', default='', type=types.HOST_FIREWALL_TYPE)
65-
@click.option('--register/--no-register', default=False,
65+
@click.option('--register/--no-register', default=None,
6666
help='If the added host should be registered immediately')
6767
@click.option('--skip-scan/--no-skip-scan', default=None,
6868
help='If the added host should get an initial security scan. '
@@ -72,7 +72,7 @@ def add(ipv4, admin, profile, firewall, register, skip_scan):
7272
'''Add IP address to DETERRERS.
7373
'''
7474
deterrers.add(ipv4, admin, profile, firewall)
75-
if profile and auto_register or register:
75+
if profile and (auto_register if register is None else register):
7676
skip_scan = auto_skip_scan if skip_scan is None else skip_scan
7777
deterrers.action(ipv4, 'register', skip_scan)
7878

0 commit comments

Comments
 (0)