Skip to content

handle semodule version >=2.4 (#37732) and fix typo - #37736

Merged
cachedout merged 4 commits into
saltstack:2016.3from
dhaines:issue-37732
Nov 24, 2016
Merged

cachedout merged 4 commits into
saltstack:2016.3from
dhaines:issue-37732

Conversation

@dhaines

@dhaines dhaines commented Nov 16, 2016

Copy link
Copy Markdown

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.

David Haines and others added 3 commits November 16, 2016 14:47
missed a pair of parens
both the existing code and my addition erroneously strip the first result from the semodule call
Comment thread salt/modules/selinux.py Outdated
'Version': comps[1]}
semodule_versioncheck = __salt__['cmd.run']('semodule -h').splitlines()
semodule_version = ''
for line in versioncheck[1:]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

semodule_versioncheck? This looks like it's undefined.

Comment thread salt/modules/selinux.py Outdated
if semodule_version == 'new':
mdata = __salt__['cmd.run']('semodule -lfull').splitlines()
ret = {}
for line in mdata[0:]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reasoning for splicing this as you've done? for line in mdata: should be fine.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I was merely parroting what was there before (well, it was mdata[1:] for some reason, but I digress).

Comment thread salt/modules/selinux.py Outdated
else:
mdata = __salt__['cmd.run']('semodule -l').splitlines()
ret = {}
for line in mdata[0:]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same question about the splice here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Same as above.

@cachedout cachedout added the pending-discussion The issue or pull request needs more discussion before it can be closed or merged label Nov 17, 2016
Fixed (hopefully) a couple of issues with the commit. That's what I get for parroting (and for not really knowing Python syntax yet).
@dhaines

dhaines commented Nov 23, 2016

Copy link
Copy Markdown
Author

Do my fixes address your concerns?

@cachedout

Copy link
Copy Markdown
Contributor

@dhaines Looks great. Thanks so much!

@cachedout
cachedout merged commit 371b0a8 into saltstack:2016.3 Nov 24, 2016
@dhaines
dhaines deleted the issue-37732 branch November 24, 2016 03:34
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.

2 participants