File_line help (regex?)

446 views
Skip to first unread message

mike r

unread,
Jul 19, 2016, 11:36:36 AM7/19/16
to Puppet Users
trying to make sure my grub conf file contains a string,


cat /etc/default/grub

GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto audit=1 rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

my manifest has this,


$file = '/etc/default/grub'

file_line { "(5.2.3) - ${file}: audit=1":
 ensure    => present,
 path      => $file,
 line      => 'audit=1',
 match     => '^GRUB_CMDLINE_LINUX=".*audit=1.*$',
}

I used Rubular regex editor and the regex works in rubular, it should match the line and pass, since hte line contains "audit=1", but during puppet run, it throws an exception,

/Stage[main]/Cis_rhel7::Rule::Rule_5_2_3/File_line[(5.2.3) - /etc/default/grub: audit=1]/ensure: current_value absent, should be present (noop)

Cant figure out why its not matching. Thanks.

Thomas Müller

unread,
Aug 9, 2016, 9:48:40 AM8/9/16
to Puppet Users
this searches for ^GRUB_CMDLINE.*, removes the complete line and adds just "audit=1". Don't think this is your intention.


- Thomas  
Reply all
Reply to author
Forward
0 new messages