I am trying to edit hadoop file on my guest machine using Vagrantfile. I am using cat
. This edites the file but even EOF is considered as text and it has been inserted in the file /hadoop/conf/core-site.xml
. EOF is not exiting and hence everything below is being considered as part of the text.
What change should I make on this code?
if node.vm.hostname == "node1"
node.vm.provision "shell", inline: <<-SHELL
cat >/hadoop/conf/core-site.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:8000</value>
</property>
</configuration>
EOF
SHELL
end
I had the same problem a few days age, you only need to delete the tabs/spaces in front of the "EOF".
So simply change
cat >/hadoop/conf/core-site.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:8000</value>
</property>
</configuration>
EOF
to
cat >/hadoop/conf/core-site.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:8000</value>
</property>
</configuration>
EOF