mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
CFINSPEC-80: Improve grep to match sentence starting with alias followed by :
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
parent
af7ed7bc15
commit
853afe2244
2 changed files with 2 additions and 2 deletions
|
@ -34,7 +34,7 @@ module Inspec::Resources
|
|||
# aliased_to matcher checks if the given alias_value is set to the initialized alias_key
|
||||
def aliased_to?(alias_value)
|
||||
# /etc/aliases if the file where the alias and its value(s) are stored
|
||||
cmd = inspec.command("cat /etc/aliases | grep #{@alias_key}")
|
||||
cmd = inspec.command("cat /etc/aliases | grep '^#{@alias_key}:'")
|
||||
raise Inspec::Exceptions::ResourceFailed, "#{@alias_key} is not a valid key in the aliases" if cmd.exit_status.to_i != 0
|
||||
|
||||
# in general aliases file contains : separated values like alias_key : alias_value1, alias_value2
|
||||
|
|
|
@ -384,7 +384,7 @@ class MockLoader
|
|||
"cgget -n -r memory.stat carrotking" => cmd.call("cgget-n-r-stat"),
|
||||
%{sh -c 'type "cgget"'} => empty.call,
|
||||
# mail_alias
|
||||
"cat /etc/aliases | grep daemon" => cmd.call("mail-alias"),
|
||||
"cat /etc/aliases | grep '^daemon:'" => cmd.call("mail-alias"),
|
||||
# apache_conf
|
||||
"sh -c 'find /etc/apache2/ports.conf -type f -maxdepth 1'" => cmd.call("find-apache2-ports-conf"),
|
||||
"sh -c 'find /etc/httpd/conf.d/*.conf -type f -maxdepth 1'" => cmd.call("find-httpd-ssl-conf"),
|
||||
|
|
Loading…
Reference in a new issue