Salt getPillar and getGrain functions
Change-Id: Ida59a9e86749d2b90f386a866cbf3a0f5edef948
diff --git a/src/com/mirantis/mk/Salt.groovy b/src/com/mirantis/mk/Salt.groovy
index 710d4a6..1afe1d7 100644
--- a/src/com/mirantis/mk/Salt.groovy
+++ b/src/com/mirantis/mk/Salt.groovy
@@ -82,11 +82,28 @@
return http.sendHttpPostRequest("${master.url}/", data, headers)
}
-def pillarGet(master, target, pillar) {
- def out = runSaltCommand(master, 'local', ['expression': target, 'type': 'compound'], 'pillar.get', null, [pillar.replace('.', ':')])
+def getPillar(master, target, pillar = null) {
+ if(pillar != null) {
+ def out = runSaltCommand(master, 'local', ['expression': target, 'type': 'compound'], 'pillar.get', null, [pillar.replace('.', ':')])
+ }
+ else {
+ def out = runSaltCommand(master, 'local', ['expression': target, 'type': 'compound'], 'pillar.data')
+ }
return out
}
+
+def getGrain(master, target, grain = null) {
+ if(grain != null) {
+ def out = runSaltCommand(master, 'local', ['expression': target, 'type': 'compound'], 'grain.item', null, [grain])
+ }
+ else {
+ def out = runSaltCommand(master, 'local', ['expression': target, 'type': 'compound'], 'grain.items')
+ }
+ return out
+}
+
+
def enforceState(master, target, state, output = false) {
def common = new com.mirantis.mk.Common()
def run_states