Skip to content

Commit

Permalink
pretty print output on Clone Step
Browse files Browse the repository at this point in the history
  • Loading branch information
ltamaster committed Sep 7, 2018
1 parent bb8aacb commit fb64b55
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.rundeck.plugin

import com.dtolabs.rundeck.core.execution.ExecutionListener
import com.dtolabs.rundeck.core.execution.workflow.steps.StepException
import com.dtolabs.rundeck.core.plugins.Plugin
import com.dtolabs.rundeck.core.plugins.configuration.Describable
Expand Down Expand Up @@ -95,7 +96,7 @@ If `yes`, require remote host SSH key is defined in the `~/.ssh/known_hosts` fil
gitManager.setSshPrivateKey(key)
}

PluginLogger logger = context.getLogger()
ExecutionListener logger = context.getExecutionContext().getExecutionListener()
logger.log(3, "Cloning Repo ${gitManager.gitURL} to local path ${localPath}")

File base = new File(localPath)
Expand All @@ -104,14 +105,17 @@ If `yes`, require remote host SSH key is defined in the `~/.ssh/known_hosts` fil
base.mkdir()
}

Map<String, String> meta = new HashMap<>();
meta.put("content-data-type", "application/json");

try{
gitManager.cloneOrCreate(base)

def jsonMap = base.listFiles().collect {file ->
return [name: file.name, directory: file.directory, file: file.file, path: file.absolutePath]
}
def json = JsonOutput.toJson(jsonMap)
logger.log(2, json)
logger.log(2, json, meta)

}catch(Exception e){
logger.log(0, e.getMessage())
Expand Down

0 comments on commit fb64b55

Please sign in to comment.