FIX for NTP and for error log fetching from nodes 25/3225/2
authorSzilard Cserey <szilard.cserey@ericsson.com>
Tue, 10 Nov 2015 21:14:22 +0000 (22:14 +0100)
committerSzilard Cserey <szilard.cserey@ericsson.com>
Thu, 12 Nov 2015 20:00:18 +0000 (21:00 +0100)
Change-Id: I2d56ccc97216676f5bf01b7ea1b35aaade9c33da
Signed-off-by: Szilard Cserey <szilard.cserey@ericsson.com>
fuel/deploy/cloud/deployment.py
fuel/deploy/templates/hardware_environment/conf/ericsson_montreal_lab/dea.yaml
fuel/deploy/templates/virtual_environment/conf/dea.yaml

index a294be5..12c1f89 100644 (file)
@@ -26,6 +26,7 @@ SEARCH_TEXT = 'Puppet (err)'
 LOG_FILE = '/var/log/puppet.log'
 GREP_LINES_OF_LEADING_CONTEXT = 100
 GREP_LINES_OF_TRAILING_CONTEXT = 100
+LIST_OF_CHAR_TO_BE_ESCAPED = ['[', ']', '"']
 
 class Deployment(object):
 
@@ -47,9 +48,14 @@ class Deployment(object):
             results, _ = exec_cmd(cmd, False)
             for result in results.splitlines():
                 log_msg = ''
-                cmd = ('ssh -q node-%s "grep -B%s \\"%s\\" %s"'
-                       % (node_id, GREP_LINES_OF_LEADING_CONTEXT, result,
-                          LOG_FILE))
+
+                sub_cmd = '"%s" %s' % (result, LOG_FILE)
+                for c in LIST_OF_CHAR_TO_BE_ESCAPED:
+                    sub_cmd = sub_cmd.replace(c, '\%s' % c)
+                grep_cmd = ('grep -B%s %s'
+                            % (GREP_LINES_OF_LEADING_CONTEXT, sub_cmd))
+                cmd = ('ssh -q node-%s "%s"' % (node_id, grep_cmd))
+
                 details, _ = exec_cmd(cmd, False)
                 details_list = details.splitlines()
 
@@ -61,9 +67,10 @@ class Deployment(object):
                 if found_prev_log:
                     log_msg += '\n'.join(details_list[i:-1]) + '\n'
 
-                cmd = ('ssh -q node-%s "grep -A%s \\"%s\\" %s"'
-                       % (node_id, GREP_LINES_OF_TRAILING_CONTEXT, result,
-                          LOG_FILE))
+                grep_cmd = ('grep -A%s %s'
+                            % (GREP_LINES_OF_TRAILING_CONTEXT, sub_cmd))
+                cmd = ('ssh -q node-%s "%s"' % (node_id, grep_cmd))
+
                 details, _ = exec_cmd(cmd, False)
                 details_list = details.splitlines()
 
index 67fba4f..30851ea 100644 (file)
@@ -46,8 +46,8 @@ fuel:
     user: admin
     password: admin
   HOSTNAME: opnfv
-  NTP1: 10.118.34.219
-  NTP2:
+  NTP1: 10.118.32.193
+  NTP2: 10.118.34.193
   NTP3:
 interfaces_1:
   eth0:
@@ -488,7 +488,7 @@ settings:
           error: Invalid NTP server list
           source: ^\s*(?:(?:\w+(?:-+\w+)*\.)+[a-z]+|\d{1,3}(?:\.\d{1,3}){3})\s*(?:,\s*(?:(?:\w+(?:-+\w+)*\.)+[a-z]+|\d{1,3}(\.\d{1,3}){3})\s*)*$
         type: text
-        value:  10.118.34.219
+        value: 110.118.32.193, 10.118.34.193
         weight: 10
     kernel_params:
       kernel:
index 8db0ccd..84efe55 100644 (file)
@@ -38,8 +38,8 @@ fuel:
     user: admin
     password: admin
   HOSTNAME: opnfv_virt
-  NTP1: 10.118.34.219
-  NTP2:
+  NTP1: 10.118.32.193
+  NTP2: 10.118.34.193
   NTP3:
 interfaces_1:
   eth0:
@@ -482,7 +482,7 @@ settings:
           error: Invalid NTP server list
           source: ^\s*(?:(?:\w+(?:-+\w+)*\.)+[a-z]+|\d{1,3}(?:\.\d{1,3}){3})\s*(?:,\s*(?:(?:\w+(?:-+\w+)*\.)+[a-z]+|\d{1,3}(\.\d{1,3}){3})\s*)*$
         type: text
-        value: 10.118.34.219
+        value: 110.118.32.193, 10.118.34.193
         weight: 10
     kernel_params:
       kernel: