Updated logging in salt.groovy
Change-Id: If020134ef0dd884a89f633831ae36ebcc11d643e
diff --git a/src/com/mirantis/mk/Common.groovy b/src/com/mirantis/mk/Common.groovy
index be9540b..a605b44 100644
--- a/src/com/mirantis/mk/Common.groovy
+++ b/src/com/mirantis/mk/Common.groovy
@@ -117,7 +117,7 @@
debugEnabled = false
}
if(debugEnabled){
- printMsg(msg, "red")
+ printMsg("[DEBUG] ${msg}", "red")
}
}
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index 285de00..9bb6dbf 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -283,7 +283,7 @@
resKey = k
}
resource = node[resKey]
- common.errorMsg("Checking resource: ${resource}")
+ common.debugMsg("checkResult: checking resource: ${resource}")
if(resource instanceof String || !resource["result"] || (resource["result"] instanceof String && resource["result"] != "true")){
if (failOnError) {
throw new Exception("Salt state on node ${nodeKey} failed: ${resource}. State output: ${node}")
@@ -313,7 +313,7 @@
for (int i=0; i<result['return'].size(); i++) {
def entry = result['return'][i]
for (int j=0; j<entry.size(); j++) {
- common.errorMsg("Entry is: ${entry}")
+ common.debugMsg("printSaltStateResult: printing salt state entry: ${entry}")
def nodeKey = entry.keySet()[j]
def node=entry[nodeKey]
out[nodeKey] = [:]
@@ -344,10 +344,10 @@
def nodeKey = out.keySet()[i]
def node=out[nodeKey]
if (node) {
- println "Node ${nodeKey} changes:"
- print new groovy.json.JsonBuilder(node).toPrettyString().replace('\\n', System.getProperty('line.separator'))
+ common.infoMsg("Node ${nodeKey} changes:")
+ common.infoMsg(new groovy.json.JsonBuilder(node).toPrettyString().replace('\\n', System.getProperty('line.separator')))
} else {
- println "No changes for node ${nodeKey}"
+ common.infoMsg("No changes for node ${nodeKey}")
}
}
}else{
@@ -367,7 +367,7 @@
for (int i=0; i<result['return'].size(); i++) {
def entry = result['return'][i]
for (int j=0; j<entry.size(); j++) {
- common.errorMsg("Entry is: ${entry}")
+ common.debugMsg("printSaltCommandResult: printing salt command entry: ${entry}")
def nodeKey = entry.keySet()[j]
def node=entry[nodeKey]
out[nodeKey] = [:]