Migrating to Python v3

 - support for Python v3.8.x
 - support for Python v3.5.x
 - new tag, 2019.2.8
 - updates class generation and iterators
 - unittests updated with coverage >75%
 - new coverage routines
 - unittests profiling
 - full fake data for unittests
 - unittest testrun is ~1.5 seconds long

Bugfixes
 - 34834, proper use of 'sudo' option
 - multiple proper iterator use
 - 37919, show warning when installed and candidate versions
   are newer comparing to release version

Change-Id: Idd6b889f7ce94ae0c832e2f0a0346e4fdc3264a3
Related-PROD: PROD-34834 PROD-34664 PROD-34919
diff --git a/cfg_checker/common/salt_utils.py b/cfg_checker/common/salt_utils.py
index 7bd6ce7..dd6fbec 100644
--- a/cfg_checker/common/salt_utils.py
+++ b/cfg_checker/common/salt_utils.py
@@ -5,15 +5,15 @@
 import os
 import time
 
+import requests
+
 from cfg_checker.common import config, logger, logger_cli
 from cfg_checker.common.exception import InvalidReturnException, SaltException
 from cfg_checker.common.other import shell
 
-import requests
-
 
 def _extract_password(_raw):
-    if not isinstance(_raw, unicode):
+    if not isinstance(_raw, str):
         raise InvalidReturnException(_raw)
     else:
         try:
@@ -69,10 +69,14 @@
 
     :return: password string
     """
-    _cmd = "salt-call"
-    _args = "--out=json pillar.get _param:salt_api_password"
+    _cmd = []
+    if config.ssh_uses_sudo:
+        _cmd = ["sudo"]
+    # salt commands
+    _cmd.append("salt-call")
+    _cmd.append("--out=json pillar.get _param:salt_api_password")
     try:
-        _result = shell(" ".join([_cmd, _args]))
+        _result = shell(" ".join(_cmd))
     except OSError as e:
         raise SaltException(
             "Salt error calling '{}': '{}'\n"
@@ -386,7 +390,7 @@
             param=path,
             kwarg=_kwarg
         )
-        return salt_output[salt_output.keys()[0]]
+        return [*salt_output.values()][0]
 
     def f_append_master(self, path, strings_list, makedirs=True):
         _kwarg = {
@@ -400,7 +404,7 @@
             param=_args,
             kwarg=_kwarg
         )
-        return salt_output[salt_output.keys()[0]]
+        return [*salt_output.values()][0]
 
     def mkdir(self, target, path, tgt_type=None):
         salt_output = self.cmd(
@@ -452,7 +456,7 @@
             param=_arg,
             kwarg=_kwarg
         )
-        return salt_output[salt_output.keys()[0]]
+        return [*salt_output.values()][0]
 
     def cache_file(self, target, source_path):
         salt_output = self.cmd(
@@ -460,7 +464,7 @@
             "cp.cache_file",
             param=source_path
         )
-        return salt_output[salt_output.keys()[0]]
+        return [*salt_output.values()][0]
 
     def get_file(self, target, source_path, target_path, tgt_type=None):
         return self.cmd(