>#salt -t 60 '192.168.133.188' state.apply read_data.read_data
jid: 20170920115532084030
Data failed to compile:
----------
Rendering SLS 'base:read_data.read_data' failed: Problem running salt function in Jinja template: Unable to run command '['type', 'C:\\salt\\conf\\minion', '|', 'findstr', 'alternative.mysql.host']' with the context '{'timeout': None, 'with_communicate': True, 'shell': False, 'bg': False, 'stderr': -2, 'env': {'TMP': 'C:\\Windows\\TEMP', 'COMPUTERNAME': 'WIN-D8G7L2C6FAR', 'USERDOMAIN': 'WORKGROUP', 'PSMODULEPATH': 'C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\', 'COMMONPROGRAMFILES': 'C:\\Program Files\\Common Files', 'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 142 Stepping 9, GenuineIntel', 'PROGRAMFILES': 'C:\\Program Files', 'PROCESSOR_REVISION': '8e09', 'SYSTEMROOT': 'C:\\Windows', 'PATH': 'C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\salt;C:\\Python27;C:\\Python27\\Lib\\site-packages;C:\\Python27\\Lib;C:\\Python27\\DLLs;C:\\Python27\\Lib\\lib-tk;C:\\Python27\\Scripts;C:\\Python27\\Lib\\site-packages;;c:\\salt\\bin\\lib\\site-packages\\pywin32_system32;/bin;/sbin;/usr/bin;/usr/sbin;/usr/local/bin;c:\\salt\\bin\\lib\\site-packages\\pywin32_system32', 'PROGRAMFILES(X86)': 'C:\\Program Files (x86)', 'WINDOWS_TRACING_FLAGS': '3', 'TEMP': 'C:\\Windows\\TEMP', 'COMMONPROGRAMFILES(X86)': 'C:\\Program Files (x86)\\Common Files', 'PROCESSOR_ARCHITECTURE': 'AMD64', 'ALLUSERSPROFILE': 'C:\\ProgramData', 'LOCALAPPDATA': 'C:\\Windows\\system32\\config\\systemprofile\\AppData\\Local', 'PROGRAMW6432': 'C:\\Program Files', 'USERNAME': 'WIN-D8G7L2C6FAR$', 'COMSPEC': 'C:\\Windows\\system32\\cmd.exe', 'PROGRAMDATA': 'C:\\ProgramData', 'PYTHONPATH': 'C:\\Python27;C:\\Python27\\Lib\\site-packages;C:\\Python27\\Lib;C:\\Python27\\DLLs;C:\\Python27\\Lib\\lib-tk;C:\\Python27\\Scripts;C:\\Python27\\Lib\\site-packages', 'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC', 'FP_NO_HOST_CHECK': 'NO', 'WINDIR': 'C:\\Windows', 'WINDOWS_TRACING_LOGFILE': 'C:\\BVTBin\\Tests\\installpackage\\csilogfile.log', 'APPDATA': 'C:\\Windows\\system32\\config\\systemprofile\\AppData\\Roaming', 'SYSTEMDRIVE': 'C:', 'PYTHONHOME': '', 'NUMBER_OF_PROCESSORS': '1', 'PROCESSOR_LEVEL': '6', 'COMMONPROGRAMW6432': 'C:\\Program Files\\Common Files', 'OS': 'Windows_NT', 'PUBLIC': 'C:\\Users\\Public', 'USERPROFILE': 'C:\\Windows\\system32\\config\\systemprofile'}, 'stdout': -1, 'stdin': None, 'cwd': 'C:\\Windows\\system32\\config\\systemprofile'}', reason: command not found; line 2
---
{%- set var1 = salt.cmd.run('type C:\salt\conf\minion | findstr alternative.mysql.host') %} <======================
get_data_in_variable:
module.run:
- name: test.echo
- text: "Printing the variable -----> '{{ var1 }}'"
---
ERROR: Minions returned with non-zero exit code
But when I login to the machine and fire the same command from command prompt as admin then the same works fine. Any suggestions how to fix this?