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

changed command for redhat family to modprobe to properly evaluate test #10

Merged
merged 6 commits into from
Mar 20, 2018

Conversation

michael-c-hoffman
Copy link

modinfo does not produce the correct output for the test and should use modprobe. Test currently always fails when using modinfo due to output not matching.

@chris-rock
Copy link
Member

@crashdummymch Thank you very much, once you've rebased, this should turn green.

@chris-rock
Copy link
Member

Is this fixing #4?

@michael-c-hoffman
Copy link
Author

this fixes #4

@@ -59,7 +59,7 @@ def version

def command
modinfo_cmd = if inspec.os.redhat? || inspec.os.name == 'fedora'
"/sbin/modinfo -n -v #{@module}"
"/sbin/modprobe -n -v #{@module} | awk '{$1=$1;print}'"
else
"modinfo -n -v #{@module}"
Copy link
Member

Choose a reason for hiding this comment

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

It seems that we need to use modprobe here too, even on ubuntu the -v flag is not available:

root@9d282e26d262:/# modinfo -h
Usage:
	modinfo [options] filename [args]
Options:
	-a, --author                Print only 'author'
	-d, --description           Print only 'description'
	-l, --license               Print only 'license'
	-p, --parameters            Print only 'parm'
	-n, --filename              Print only 'filename'
	-0, --null                  Use \0 instead of \n
	-F, --field=FIELD           Print only provided FIELD
	-k, --set-version=VERSION   Use VERSION instead of `uname -r`
	-b, --basedir=DIR           Use DIR as filesystem root for /lib/modules
	-V, --version               Show version
	-h, --help                  Show this help

In addition, /sbin/modprobe works on ubuntu too, therefore I do not think we need to distinguish between redhat and other linux platforms here

Copy link
Author

Choose a reason for hiding this comment

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

removed condition logic so that all linux systems utilize modprobe for detecting module status

Copy link
Author

@michael-c-hoffman michael-c-hoffman left a comment

Choose a reason for hiding this comment

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

removed linux distribution specific command and replaced with modprobe

@@ -59,7 +59,7 @@ def version

def command
modinfo_cmd = if inspec.os.redhat? || inspec.os.name == 'fedora'
"/sbin/modinfo -n -v #{@module}"
"/sbin/modprobe -n -v #{@module} | awk '{$1=$1;print}'"
else
"modinfo -n -v #{@module}"
Copy link
Author

Choose a reason for hiding this comment

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

removed condition logic so that all linux systems utilize modprobe for detecting module status

@rarenerd rarenerd merged commit c1cfc2b into dev-sec:master Mar 20, 2018
@rarenerd rarenerd mentioned this pull request Mar 20, 2018
@michael-c-hoffman michael-c-hoffman deleted the linux_command_modprobe branch March 20, 2018 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants