Fix using distribRevision parameter in extraRepo config Yaml

DistribReviosion was hardcoded by mistake, however it was parametrized
in function.

Also add ability to operate with repo_key gpg

Change-Id: I700628393be698711d8f83fa959dd897d4528e3d
diff --git a/src/com/mirantis/mk/Common.groovy b/src/com/mirantis/mk/Common.groovy
index 3af2a92..54eb85a 100644
--- a/src/com/mirantis/mk/Common.groovy
+++ b/src/com/mirantis/mk/Common.groovy
@@ -892,28 +892,31 @@
  * Example :
  configYaml = '''
  ---
- distrib_revision: 'nightly'
  aprConfD: |-
     APT::Get::AllowUnauthenticated 'true';
  repo:
     mcp_saltstack:
-        source: "deb [arch=amd64] http://mirror.mirantis.com/SUB_DISTRIB_REVISION/saltstack-2017.7/xenial xenial main"
+        source: "deb [arch=amd64] http://mirror.mirantis.com/nightly/saltstack-2017.7/xenial xenial main"
         pinning: |-
             Package: libsodium18
             Pin: release o=SaltStack
             Pin-Priority: 50
+        repo_key: "http://mirror.mirantis.com/public.gpg"
  '''
  *
  */
 
 def debianExtraRepos(configYaml) {
     def config = readYaml text: configYaml
-    def distribRevision = config.get('distribRevision', 'nightly')
     if (config.get('repo', false)) {
         for (String repo in config['repo'].keySet()) {
-            source = config['repo'][repo]['source'].replace('SUB_DISTRIB_REVISION', distribRevision)
+            source = config['repo'][repo]['source']
             warningMsg("Write ${source} >  /etc/apt/sources.list.d/${repo}.list")
             sh("echo '${source}' > /etc/apt/sources.list.d/${repo}.list")
+            if (config['repo'][repo].containsKey('repo_key')) {
+                key = config['repo'][repo]['repo_key']
+                sh("wget -O - '${key}' | apt-key add -")
+            }
             // TODO implement pining
         }
     }