Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a KeyError if group is provided but not user in cmd states #33538

Merged
merged 1 commit into from
May 26, 2016
Merged

Fix a KeyError if group is provided but not user in cmd states #33538

merged 1 commit into from
May 26, 2016

Conversation

anlutro
Copy link
Contributor

@anlutro anlutro commented May 26, 2016

I replaced user with runas but forgot to remove group and a KeyError happened for natural reasons.

@@ -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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just write if kwargs.get('user') and runas is None here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was considering that, but wasn't sure if there was some special case behavior if you provide False or an empty string that needs to be preserved. I'd be happy to change it to that if you think it's OK.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was just a thought. I can't think of one offhand, since I'd expect strings to be the only case we operate on. I'm fine either way. Just let me know.

@cachedout cachedout added the Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged label May 26, 2016
@cachedout cachedout merged commit 4831c6a into saltstack:2016.3 May 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending-Discussion The issue or pull request needs more discussion before it can be closed or merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants