From c738a0de7629dc02f6f1e606e7f62104f0be755e Mon Sep 17 00:00:00 2001 From: Andreas Lutro Date: Thu, 26 May 2016 15:08:31 +0200 Subject: [PATCH] fix a KeyError if group is provided but not user --- salt/states/cmd.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/salt/states/cmd.py b/salt/states/cmd.py index f32e4ec7af..13b6afd9c5 100644 --- a/salt/states/cmd.py +++ b/salt/states/cmd.py @@ -491,7 +491,7 @@ def wait(name, 'Replace them with runas. ' 'These arguments will be removed in Salt Oxygen.' ) - if kwargs['user'] is not None and runas is None: + if 'user' in kwargs and kwargs['user'] is not None and runas is None: runas = kwargs.pop('user') # Ignoring our arguments is intentional. @@ -622,7 +622,7 @@ def wait_script(name, 'Replace them with runas. ' 'These arguments will be removed in Salt Oxygen.' ) - if kwargs['user'] is not None and runas is None: + if 'user' in kwargs and kwargs['user'] is not None and runas is None: runas = kwargs.pop('user') # Ignoring our arguments is intentional. @@ -805,7 +805,7 @@ def run(name, 'Replace them with runas. ' 'These arguments will be removed in Salt Oxygen.' ) - if kwargs['user'] is not None and runas is None: + if 'user' in kwargs and kwargs['user'] is not None and runas is None: runas = kwargs.pop('user') cmd_kwargs = {'cwd': cwd, @@ -1041,7 +1041,7 @@ def script(name, 'Replace them with runas. ' 'These arguments will be removed in Salt Oxygen.' ) - if kwargs['user'] is not None and runas is None: + if 'user' in kwargs and kwargs['user'] is not None and runas is None: runas = kwargs.pop('user') cmd_kwargs = copy.deepcopy(kwargs)