Repository navigation
handle semodule version >=2.4 (#37732) and fix typo - #37736
Merged
Merged
Conversation
both the existing code and my addition erroneously strip the first result from the semodule call
cachedout
reviewed
Nov 17, 2016
| 'Version': comps[1]} | ||
| semodule_versioncheck = __salt__['cmd.run']('semodule -h').splitlines() | ||
| semodule_version = '' | ||
| for line in versioncheck[1:]: |
Contributor
There was a problem hiding this comment.
semodule_versioncheck? This looks like it's undefined.
| if semodule_version == 'new': | ||
| mdata = __salt__['cmd.run']('semodule -lfull').splitlines() | ||
| ret = {} | ||
| for line in mdata[0:]: |
Contributor
There was a problem hiding this comment.
Is there a reasoning for splicing this as you've done? for line in mdata: should be fine.
Author
There was a problem hiding this comment.
I was merely parroting what was there before (well, it was mdata[1:] for some reason, but I digress).
| else: | ||
| mdata = __salt__['cmd.run']('semodule -l').splitlines() | ||
| ret = {} | ||
| for line in mdata[0:]: |
Contributor
There was a problem hiding this comment.
Same question about the splice here.
Fixed (hopefully) a couple of issues with the commit. That's what I get for parroting (and for not really knowing Python syntax yet).
Author
|
Do my fixes address your concerns? |
Contributor
|
@dhaines Looks great. Thanks so much! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Checks for more recent versions of semodule (v2.4+) and runs semodule differently depending on what side of the version line it's on, storing different results in the dictionary
What issues does this PR fix or reference?
#37732
Previous Behavior
errors on any state.apply of a selinux.module state
New Behavior
no more errors, but no more selinux module versioning for newer versions of the selinux userspace (but that's upstream's choice)
Tests written?
No
Please review Salt's Contributing Guide for best practices.