Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-8320

configs.sh doConfigFileUpdate fails when multiple occurrences of word "properties" found

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.6.1, 1.7.0, 2.0.0
    • 2.0.1, 2.1.0
    • ambari-server
    • None

    Description

      When running configs.sh to read in a properties file per doConfigFileUpdate, the update fails with the following error:

      [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]#
      

      In this example, there are multiple occurrences of the word "properties" in the hdfs-log4j.txt properties file I'm trying to read in:

      [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]#
      

      The file I'm trying to read in is formatted properly , but configs.sh fails due to the grep test in doConfigFileUpdate not passing.

      Attachments

        1. AMBARI-8320.2.patch
          0.6 kB
          Dmitry Lysnichenko
        2. AMBARI-8320.patch
          0.6 kB
          Enrique Flores

        Activity

          People

            dmitriusan Dmitry Lysnichenko
            flores.ehf Enrique Flores
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: