chef resource ruby_block replacing aline in file

131 Views Asked by At

how to replace :

export JAVA_HOME=${JAVA_HOME}  

with :

export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::") in  
hadoop-env.sh using   
RUBY_BLOCK resource in CHEF
1

There are 1 best solutions below

0
On BEST ANSWER

replacements should be simple replacements. For something this complex you should grab the entire file as it currently exists and use it as an ERB template with your changes inside of it, even if that means not putting any variables inside of it similar to what Tensibai said in comment