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