lib/inspec/resources/mail_alias.rb
# aliased_to matcher checks if the given alias_value is set to the initialized alias_key
aliased_to matcher checks if the given alias_value is set to the initialized alias_key
aliased_to matcher checks if the given alias_value is set to the initialized alias_key
def aliased_to?(alias_value)
      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
      alias_values_combined = cmd.stdout.split(":").map(&:strip)[1]
      alias_values_splitted = alias_values_combined.split(",").map(&:strip)
      alias_values_splitted.include?(alias_value)
    end
def aliased_to? ( alias_value ) 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 alias_values_combined = cmd . stdout . split ( ":" ) . map ( & :strip ) [ 1 ] alias_values_splitted = alias_values_combined . split ( "," ) . map ( & :strip ) alias_values_splitted . include? ( alias_value ) end
aliased_to matcher checks if the given alias_value is set to the initialized alias_key
aliased_to matcher checks if the given alias_value is set to the initialized alias_key
# /etc/aliases if the file where the alias and its value(s) are stored # in general aliases file contains : separated values like alias_key : alias_value1, alias_value2
alias_value