[sr-dev] git:5.2:a2660fbe: utils/kamctl: fix dbtestdb

Victor Seva linuxmaniac at torreviejawireless.org
Mon May 4 17:08:17 CEST 2020


Module: kamailio
Branch: 5.2
Commit: a2660fbe2e974553f0146c9ee84fcc6fa2f8f705
URL: https://github.com/kamailio/kamailio/commit/a2660fbe2e974553f0146c9ee84fcc6fa2f8f705

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2020-05-04T17:07:05+02:00

utils/kamctl: fix dbtestdb

some indentantion errors introduced at https://github.com/kamailio/kamailio/commit/bc8bdcaa726f375f6deea8228a1ab0cf97c67035

related #1747

(cherry picked from commit b722a48144ac9e029bdbc2968dedbe56966a3f7c)
(cherry picked from commit c4dd3218e6b723c688762a5c4253fa70f3f588bc)

---

Modified: utils/kamctl/dbtextdb/dbtextdb.py

---

Diff:  https://github.com/kamailio/kamailio/commit/a2660fbe2e974553f0146c9ee84fcc6fa2f8f705.diff
Patch: https://github.com/kamailio/kamailio/commit/a2660fbe2e974553f0146c9ee84fcc6fa2f8f705.patch

---

diff --git a/utils/kamctl/dbtextdb/dbtextdb.py b/utils/kamctl/dbtextdb/dbtextdb.py
index 3d5ee7ecc5..7e1de04687 100755
--- a/utils/kamctl/dbtextdb/dbtextdb.py
+++ b/utils/kamctl/dbtextdb/dbtextdb.py
@@ -146,11 +146,11 @@ def _ParseColumns(self):
         # check if there is a function modifier on the columns
         if self.tokens[0] == 'COUNT':
             self.count = True
-        if col_end == 1:
-            raise ParseError('COUNT must be followed by column name[s]')
-        if not self.tokens[1].startswith(self._paren_placeholder):
-            raise ParseError('COUNT must be followed by ()')
-        cols_str = self._ReplaceParens(self.tokens[1])
+            if col_end == 1:
+                raise ParseError('COUNT must be followed by column name[s]')
+            if not self.tokens[1].startswith(self._paren_placeholder):
+                raise ParseError('COUNT must be followed by ()')
+            cols_str = self._ReplaceParens(self.tokens[1])
 
         cols = cols_str.split(',')
         for col in cols:
@@ -300,7 +300,7 @@ def _ParseTargets(self):
             if self.tokens.pop(0) != 'SET':
                 raise ParseError('UPDATE command must be followed by SET')
 
-        self.targets = self._ParsePairs(' '.join(self.tokens), ',')
+            self.targets = self._ParsePairs(' '.join(self.tokens), ',')
 
         # INSERT
         if self.command == 'INSERT':
@@ -570,19 +570,19 @@ def _ParseOutHelper(self, placeholder, delims, mode):
                         string = '%s%s' % (string, c)
                         continue  # wait for matching delim
 
-                started -= 1
-                if not started:
-                    values.append(string)
-                    new_args = '%s %s' % (new_args, '%s%d' % (placeholder,
-                                                              my_id))
-                    my_id += 1
-                    string = ''
+                    started -= 1
+                    if not started:
+                        values.append(string)
+                        new_args = '%s %s' % (new_args, '%s%d' % (placeholder,
+                                                                  my_id))
+                        my_id += 1
+                        string = ''
 
-        else:
-            if not started:
-                new_args = '%s%s' % (new_args, c)
             else:
-                string = '%s%s' % (string, c)
+                if not started:
+                    new_args = '%s%s' % (new_args, c)
+                else:
+                    string = '%s%s' % (string, c)
 
         if started:
             if mode == 'parens':
@@ -714,8 +714,8 @@ def _RunInsert(self):
             elif self.header[col]['auto']:
                 new_row[col] = self._GetNextAuto(col)
 
-        else:
-            raise ExecuteError(col + ' cannot be empty or null')
+            else:
+                raise ExecuteError(col + ' cannot be empty or null')
 
         self.data.append(new_row)
         return [1]




More information about the sr-dev mailing list