[Kimchi-devel] [PATCH 3/3] Add checking for UI codes when running make check-local

Ramon Medeiros ramonn at linux.vnet.ibm.com
Tue Nov 24 20:11:10 UTC 2015


Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
 Makefile.am                                    |  1 +
 check_ui_code_errors.sh                        | 11 +++++++++++
 src/wok/plugins/kimchi/Makefile.am             |  2 +-
 src/wok/plugins/kimchi/check_ui_code_errors.sh | 11 +++++++++++
 src/wok/plugins/kimchi/model/vms.py            |  6 +++---
 5 files changed, 27 insertions(+), 4 deletions(-)
 create mode 100755 check_ui_code_errors.sh
 create mode 100755 src/wok/plugins/kimchi/check_ui_code_errors.sh

diff --git a/Makefile.am b/Makefile.am
index 027344f..106a577 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -56,6 +56,7 @@ check-local:
 	$(PEP8) --version
 	$(PEP8) --filename '*.py,*.py.in' --exclude="$(PEP8_BLACKLIST)" .
 
+	/bin/bash check_ui_code_errors.sh
 
 # Link built mo files in the source tree to enable use of translations from
 # within the source tree
diff --git a/check_ui_code_errors.sh b/check_ui_code_errors.sh
new file mode 100755
index 0000000..7220a75
--- /dev/null
+++ b/check_ui_code_errors.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+errors="$(cat ui/pages/i18n.json.tmpl | grep -o 'WOK[0-9A-Z]*'| sort)"
+uiErrors="$(grep -Ro 'WOK[0-9A-Z]*' ui/js/ | cut -d: -f2 | sort| uniq)"
+
+# all errors on i18n are present in js/html files: success
+if [ "$errors" == "$uiErrors" ]; then
+    echo "UI errors codes are correct"
+else
+    echo "Error while checking UI errors codes."
+fi
diff --git a/src/wok/plugins/kimchi/Makefile.am b/src/wok/plugins/kimchi/Makefile.am
index 8a55b23..250dc83 100644
--- a/src/wok/plugins/kimchi/Makefile.am
+++ b/src/wok/plugins/kimchi/Makefile.am
@@ -65,7 +65,7 @@ check-local:
 
 	$(PEP8) --version
 	$(PEP8) --filename '*.py,*.py.in' --exclude="$(PEP8_BLACKLIST)" .
-
+	./check_ui_code_errors.sh
 
 # Link built mo files in the source tree to enable use of translations from
 # within the source tree
diff --git a/src/wok/plugins/kimchi/check_ui_code_errors.sh b/src/wok/plugins/kimchi/check_ui_code_errors.sh
new file mode 100755
index 0000000..d9f51e2
--- /dev/null
+++ b/src/wok/plugins/kimchi/check_ui_code_errors.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+errors="$(cat ui/pages/i18n.json.tmpl | grep -o 'KCH[0-9A-Z]*'| sort)"
+uiErrors="$(grep -Ro 'KCH[0-9A-Z]*' ui/js/ | cut -d: -f2 | sort| uniq)"
+
+# all errors on i18n are present in js/html files: success
+if [ "$errors" == "$uiErrors" ]; then
+    echo "UI errors codes are correct"
+else
+    echo "Error while checking UI errors codes."
+fi
diff --git a/src/wok/plugins/kimchi/model/vms.py b/src/wok/plugins/kimchi/model/vms.py
index 5623879..bdd32a1 100644
--- a/src/wok/plugins/kimchi/model/vms.py
+++ b/src/wok/plugins/kimchi/model/vms.py
@@ -1520,9 +1520,9 @@ class VMModel(object):
     def migration_pre_check(self, remote_host, user, password):
         self._check_if_host_not_localhost(remote_host)
         self._check_if_password_less_login_enabled(
-           remote_host,
-           user,
-           password
+            remote_host,
+            user,
+            password
         )
         self._check_if_migrating_same_arch_hypervisor(remote_host, user)
 
-- 
2.1.0




More information about the Kimchi-devel mailing list