From e3934d66feb06c3ba651a16a9f633645da524eb4 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Tue, 8 Dec 2020 17:45:48 -0800 Subject: [PATCH] reorg code slightly, make it easier to update constant, also flip this around as addkeys should be smaller than attrs... --- bitelab/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bitelab/__init__.py b/bitelab/__init__.py index a85e48a..4ebd1d1 100644 --- a/bitelab/__init__.py +++ b/bitelab/__init__.py @@ -388,7 +388,8 @@ async def release_board(board_id, user: str = Depends(lookup_user), ) env = os.environ.copy() - env.update({ k: v for k, v in brd.attrs.items() if k in { 'iface', 'ip', 'devfsrule' } }) + addkeys = { 'iface', 'ip', 'devfsrule' } + env.update((k, brd.attrs[k]) for k in addkeys if k in brd.attrs) sub = await asyncio.create_subprocess_exec( settings.setup_script, 'release', brd.name, user, env=env,