Cleanup ssh and git functions

Change-Id: I5e9a1acab12e479d86321aa9822e6383a707d624
diff --git a/test-salt-models-pipeline.groovy b/test-salt-models-pipeline.groovy
index ebc99c9..1928e4c 100644
--- a/test-salt-models-pipeline.groovy
+++ b/test-salt-models-pipeline.groovy
@@ -1,5 +1,7 @@
 def common = new com.mirantis.mk.Common()
 def gerrit = new com.mirantis.mk.Gerrit()
+def ssh = new com.mirantis.mk.Ssh()
+def git = new com.mirantis.mk.Git()
 
 node("python") {
   try{
@@ -7,7 +9,15 @@
       gerrit.gerritPatchsetCheckout ([
           credentialsId : CREDENTIALS_ID
       ])
-      sh("git submodule init; git submodule sync; git submodule update --recursive")
+
+      if (fileExists('classes/system') {
+        ssh.prepareSshAgentKey(CREDENTIALS_ID)
+        dir('classes/system') {
+          remoteUrl = git.getGitRemote()
+          ssh.ensureKnownHosts(remoteUrl)
+        }
+        ssh.agentSh("git submodule init; git submodule sync; git submodule update --recursive")
+      }
     }
     stage("test") {
       wrap([$class: 'AnsiColorBuildWrapper']) {
@@ -21,4 +31,4 @@
   } finally {
      common.sendNotification(currentBuild.result,"",["slack"])
   }
-}
\ No newline at end of file
+}