Forum: CFEngine Help
Subject: Re: How to instert white line ?
Author: Beto
Link to topic: https://cfengine.com/forum/read.php?3,26615,26644#msg-26644


wilma:/home/root/inputs# cat vim.cf
body common control
{
bundlesequence          => { "test" };
}

bundle agent test
{
vars:
        "vim_configuration_default"
                slist => {
                          " ",
                          "\" Change default colour set",
                          "colorscheme elflord"
                         };

        "vim_configuration_default_s" string => join("$(const.n)", 
"vim_configuration_default");

files:
        "/home/root/inputs/vimrc"
                edit_line       => 
append_if_no_lines_preserve("$(vim_configuration_default_s)"),
                comment         => "edit default configuration of vim 
(colorscheme, ...)";

reports:
 cfengine_3::
        "$(vim_configuration_default_s)";

}

bundle edit_line append_if_no_lines_preserve(list) {
insert_lines:
        "$(list)"
                insert_type     => "preserve_block",
                comment         => "Append lines to the file if they don't 
already exist";
}




wilma:/home/root/inputs# cf-agent -KIf ./vim.cf  
 -> Edited file /home/root/inputs/vimrc
R:  
" Change default colour set
colorscheme elflord
wilma:/home/root/inputs# tail vimrc
     set t_Co=8
     set t_Sb=dm
     set t_Sf=dm
endif

highlight Comment ctermfg=green
highlight Search ctermbg=LightBlue
 
" Change default colour set
colorscheme elflord


_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to