Check skylab_inventory_imported.

BUG=chromium:826492
TEST=unit_tests

Change-Id: I34b0c6a22803548a37236a7657410ed85358f8df
Reviewed-on: https://chromium-review.googlesource.com/1035533
Tested-by: Ningning Xia <[email protected]>
Trybot-Ready: Ningning Xia <[email protected]>
Reviewed-by: Xixuan Wu <[email protected]>
diff --git a/cli/topic_common.py b/cli/topic_common.py
index 7242249..03ac28e 100644
--- a/cli/topic_common.py
+++ b/cli/topic_common.py
@@ -70,10 +70,12 @@
 from autotest_lib.client.common_lib.test_utils import mock
 from autotest_lib.client.common_lib import autotemp
 
+skylab_inventory_imported = False
 try:
     from skylab_inventory import translation_utils
+    skylab_inventory_imported = True
 except ImportError:
-    skylab_inventory = None
+    pass
 
 
 # Maps the AFE keys to printable names.
@@ -505,7 +507,7 @@
 
         # TODO(nxia): crbug.com/837831 Add skylab_inventory to
         # autotest-server-deps ebuilds to remove the ImportError check.
-        if skylab_inventory is None:
+        if not skylab_inventory_imported:
             raise skylab_utils.SkylabInventoryNotImported(
                     "Please try to run utils/build_externals.py.")