From 72b44ea07540c55e090c6561a18aa615fc92b37d Mon Sep 17 00:00:00 2001 From: Fabian Schindler <fabian.schindler.strauss@gmail.com> Date: Mon, 1 Aug 2022 17:00:21 +0200 Subject: [PATCH] Fixing command context instance --- registrar/cli.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/registrar/cli.py b/registrar/cli.py index 6b7fb32..567308f 100644 --- a/registrar/cli.py +++ b/registrar/cli.py @@ -71,10 +71,11 @@ def cli( ctx, config_file=None, validate=False, host=None, port=None, debug=False ): """Entry point for the registar""" + ctx.ensure_object(dict) + setup_logging(debug) # ensure that ctx.obj exists and is a dict (in case `cli()` is called # by means other than the `if` block below) - ctx.ensure_object(dict) config = RegistrarConfig.from_file(config_file, validate) if host: @@ -104,7 +105,7 @@ def daemon(ctx, replace=False): daemon --replace """ - config: RegistrarConfig = ctx["CONFIG"] + config: RegistrarConfig = ctx.obj["CONFIG"] if replace is not None: for route in config.routes.values(): @@ -131,12 +132,12 @@ def register(ctx, route_name, item, replace): --debug \ register --replace myroute "{...}" """ - config: RegistrarConfig = ctx["CONFIG"] + config: RegistrarConfig = ctx.obj["CONFIG"] if replace is not None: for route in config.routes.values(): route.replace = replace - registrar.register(config.routes[route_name], item) + registrar.register(config.routes[route_name], config.sources, item) @cli.command(help="Run a single, one-off de-registration") -- GitLab