Hi,

I have 2 problems with lines functions : the first and the second ;)

My configuration :

I create line functions (present, absent...)

define line ($file, $line, $ensure = 'present') {
    case $ensure {
        default : {
            err("unknown ensure value ${ensure}")
        }
        present : {
            exec {
                "/bin/echo '${line}' >> '${file}'" :
                    unless => "/bin/grep -qFx '${line}' '${file}'",
                    logoutput => true
            }
        }
        absent : {
            exec {
                "/bin/grep -vFx '${line}' '${file}' | tee '${file}' > 
/dev/null 2>&1" :
                    onlyif => "/bin/grep -qFx '${line}' '${file}'",
                    logoutput => true
            }
        }
...
...
...


Il create a profil class with line function


class profil::redhat {
line {'alias vim':
            file => '/root/.bashrc',
            line => "alias vi=\'vim\'",
            ensure => present
    }
line {'alias color':
            file => '/root/.bashrc',
            line => "alias grep=\'grep --color\'",
            ensure => present
    }
}


First problem : a single quote problem

My result in my '/root/.bashrc' file, i would like

alias grep='grep --color'
alias vi='vim'

but i have

alias grep=grep --color
alias vi=vim

Can you have an idea to protect single quote?


Second problem : my manifect consider that *alias grep=grep --color*
 is absent in my '/root/.bashrc' file but is present so he create this line 
all the time


alias grep=grep --color
alias grep=grep --color
alias grep=grep --color
alias grep=grep --color

I think it's the space beetween grep and --color 

can you have an idea

thanks a lot in adavace
regards

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/3942e61e-4391-4f49-9309-9b3c3dc5c535%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to