From b74a2f7f37fe63eb613c37f07c7a87611f373252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20K=C3=B6lbel?= Date: Wed, 21 Aug 2019 13:55:39 +0200 Subject: [PATCH] Use name from policy definition file Fixes #1807 --- pi-manage | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pi-manage b/pi-manage index c3cb48e897..0be7ec3e29 100755 --- a/pi-manage +++ b/pi-manage @@ -1153,6 +1153,14 @@ def create(name, scope, action, filename=None): params = ast.literal_eval(contents) + if params.get("name") and params.get("name") != name: + print("Found name '{0!s}' in file, will use that instead of " + "'{1!s}'.".format(params.get("name"), name)) + else: + print("name not defined in file, will use the cli value " + "{0!s}.".format(name)) + params["scope"] = name + if params.get("scope") and params.get("scope") != scope: print("Found scope '{0!s}' in file, will use that instead of " "'{1!s}'.".format(params.get("scope"), scope)) @@ -1169,7 +1177,8 @@ def create(name, scope, action, filename=None): "{0!s}.".format(action)) params["action"] = action - r = set_policy(name, scope=params.get("scope"), + r = set_policy(params.get("name"), + scope=params.get("scope"), action=params.get("action"), realm=params.get("realm"), resolver=params.get("resolver"),