Enrique Flores created AMBARI-8320:
--------------------------------------
Summary: configs.sh doConfigFileUpdate fails when multiple
occurrences of word "properties" found
Key: AMBARI-8320
URL: https://issues.apache.org/jira/browse/AMBARI-8320
Project: Ambari
Issue Type: Bug
Components: ambari-server
Affects Versions: 1.6.1
Reporter: Enrique Flores
When running configs.sh to read in a properties file per doConfigFileUpdate,
the update fails with the following error:
{noformat}
[root@node-0 out2]# bash -x /var/lib/ambari-server/resources/scripts/configs.sh
set localhost DC-2 hdfs-log4j hdfs-log4j.txt
+ USERID=admin
+ PASSWD=admin
+ PORT=:8080
+ SSL_URL_PREFIX=
+ '[' set == -u ']'
+ '[' set == -p ']'
+ '[' set == -port ']'
+ '[' set == -s ']'
+ AMBARIURL=http://localhost:8080
+ CLUSTER=DC-2
+ SITE=hdfs-log4j
+ SITETAG=
+ CONFIGKEY=hdfs-log4j.txt
+ CONFIGVALUE=
+ case "$1" in
+ (( 5 == 6 ))
+ (( 5 == 5 ))
+ doConfigFileUpdate hdfs-log4j.txt
+ FILENAME=hdfs-log4j.txt
+ '[' -f hdfs-log4j.txt ']'
++ cut -d : -f 1
++ grep -n properties hdfs-log4j.txt
+ '[' 1 == '1
2' ']'
+ echo '[ERROR] File "hdfs-log4j.txt" should be in the following JSON format:'
[ERROR] File "hdfs-log4j.txt" should be in the following JSON format:
+ echo '[ERROR] "properties": {'
[ERROR] "properties": {
+ echo '[ERROR] "key1": "value1",'
[ERROR] "key1": "value1",
+ echo '[ERROR] "key2": "value2",'
[ERROR] "key2": "value2",
+ echo '[ERROR] }'
[ERROR] }
+ exit 1
[root@node-0 out2]#
{noformat}
In this example, there are multiple occurrences of the word "properties" in the
hdfs-log4j.txt properties file I'm trying to read in:
{noformat}
[root@node-0 out2]# grep -n properties hdfs-log4j.txt | cut -d: -f 1
1
2
[root@node-0 out2]#
[root@node-0 out2]# grep -n -o -P '(properties)\S+' hdfs-log4j.txt
1:properties"
2:properties\nhadoop.root.logger=INFO,console\nhadoop.log.dir=.\nhadoop.log.file=hadoop.log\n\n\n#
[root@node-0 out2]#
{noformat}
The file I'm trying to read in is formatted properly , but configs.sh fails due
to the grep test in doConfigFileUpdate not passing.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)