{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/26337","labels_url":"https://api.github.com/repos/saltstack/salt/issues/26337/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/26337/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/26337/events","html_url":"https://github.com/saltstack/salt/issues/26337","id":101088823,"number":26337,"title":"windows cmd.run state function broken","user":{"login":"jfindlay","id":702905,"avatar_url":"https://avatars.githubusercontent.com/u/702905?v=3","gravatar_id":"","url":"https://api.github.com/users/jfindlay","html_url":"https://github.com/jfindlay","followers_url":"https://api.github.com/users/jfindlay/followers","following_url":"https://api.github.com/users/jfindlay/following{/other_user}","gists_url":"https://api.github.com/users/jfindlay/gists{/gist_id}","starred_url":"https://api.github.com/users/jfindlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfindlay/subscriptions","organizations_url":"https://api.github.com/users/jfindlay/orgs","repos_url":"https://api.github.com/users/jfindlay/repos","events_url":"https://api.github.com/users/jfindlay/events{/privacy}","received_events_url":"https://api.github.com/users/jfindlay/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/saltstack/salt/labels/High%20Severity","name":"High Severity","color":"ff9143"},{"url":"https://api.github.com/repos/saltstack/salt/labels/P2","name":"P2","color":"155fb5"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Platform","name":"Platform","color":"fef2c0"},{"url":"https://api.github.com/repos/saltstack/salt/labels/State%20Module","name":"State Module","color":"006b75"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Windows","name":"Windows","color":"006b75"}],"state":"open","locked":false,"assignee":{"login":"twangboy","id":9383935,"avatar_url":"https://avatars.githubusercontent.com/u/9383935?v=3","gravatar_id":"","url":"https://api.github.com/users/twangboy","html_url":"https://github.com/twangboy","followers_url":"https://api.github.com/users/twangboy/followers","following_url":"https://api.github.com/users/twangboy/following{/other_user}","gists_url":"https://api.github.com/users/twangboy/gists{/gist_id}","starred_url":"https://api.github.com/users/twangboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twangboy/subscriptions","organizations_url":"https://api.github.com/users/twangboy/orgs","repos_url":"https://api.github.com/users/twangboy/repos","events_url":"https://api.github.com/users/twangboy/events{/privacy}","received_events_url":"https://api.github.com/users/twangboy/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/63","html_url":"https://github.com/saltstack/salt/milestones/Be%20-1","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/63/labels","id":1259068,"number":63,"title":"Be -1","description":"","creator":{"login":"rallytime","id":6547906,"avatar_url":"https://avatars.githubusercontent.com/u/6547906?v=3","gravatar_id":"","url":"https://api.github.com/users/rallytime","html_url":"https://github.com/rallytime","followers_url":"https://api.github.com/users/rallytime/followers","following_url":"https://api.github.com/users/rallytime/following{/other_user}","gists_url":"https://api.github.com/users/rallytime/gists{/gist_id}","starred_url":"https://api.github.com/users/rallytime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rallytime/subscriptions","organizations_url":"https://api.github.com/users/rallytime/orgs","repos_url":"https://api.github.com/users/rallytime/repos","events_url":"https://api.github.com/users/rallytime/events{/privacy}","received_events_url":"https://api.github.com/users/rallytime/received_events","type":"User","site_admin":false},"open_issues":28,"closed_issues":7,"state":"open","created_at":"2015-08-17T20:17:04Z","updated_at":"2015-08-24T15:27:13Z","due_on":"2015-08-31T06:00:00Z","closed_at":null},"comments":6,"created_at":"2015-08-14T19:40:04Z","updated_at":"2015-08-26T16:47:50Z","closed_at":null,"body":"### configs\r\n```saltstack\r\n# cat > salt-manual-tests/tests/windows/cmd.sls\r\ncmd run:\r\n  module.run:\r\n    - name: cmd.run\r\n    - cmd: type c:\\salt\\conf\\minion > nul\r\n```\r\n\r\n### commands\r\n\r\nRunning the command with the `cmd.run` exec function works:\r\n```console\r\n# salt jmoney-windows-12 cmd.run 'type c:\\salt\\conf\\minion > nul'\r\njmoney-windows-12:\r\n```\r\nbut running it with the `cmd.run` state function fails:\r\n```console\r\n# salt jmoney-windows-12 state.sls tests.windows.cmd\r\njmoney-windows-12:\r\n----------\r\n          ID: cmd run\r\n    Function: module.run\r\n        Name: cmd.run\r\n      Result: False\r\n     Comment: Module function cmd.run threw an exception. Exception: Unable to run command ['type', 'c:\\\\salt\\\\conf\\\\minion', '>', 'nul'] with the context {'with_communicate': True, 'shell': False, 'env': {'TMP': 'C:\\\\Users\\\\ADMINI~1\\\\AppData\\\\Local\\\\Temp\\\\2', 'COMPUTERNAME': 'JMONEY-WINDOWS-', 'USERDOMAIN': 'JMONEY-WINDOWS-', 'PYTHON': 'C:\\\\salt\\\\bin\\\\python.exe', 'PSMODULEPATH': 'C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\Modules\\\\', 'COMMONPROGRAMFILES': 'C:\\\\Program Files\\\\Common Files', 'PROCESSOR_IDENTIFIER': 'AMD64 Family 21 Model 2 Stepping 0, AuthenticAMD', 'PROGRAMFILES': 'C:\\\\Program Files', 'PROCESSOR_REVISION': '0200', 'SYSTEMROOT': 'C:\\\\Windows', 'PATH': 'C:\\\\Windows\\\\system32;C:\\\\Windows;C:\\\\Windows\\\\System32\\\\Wbem;C:\\\\Windows\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\', 'PROGRAMFILES(X86)': 'C:\\\\Program Files (x86)', 'TEMP': 'C:\\\\Users\\\\ADMINI~1\\\\AppData\\\\Local\\\\Temp\\\\2', 'SCRIPT': 'C:\\\\salt\\\\bin\\\\Scripts\\\\salt-minion', 'COMMONPROGRAMFILES(X86)': 'C:\\\\Program Files (x86)\\\\Common Files', 'PROCESSOR_ARCHITECTURE': 'AMD64', 'ALLUSERSPROFILE': 'C:\\\\ProgramData', 'SALTDIR': 'C:\\\\salt', 'LOCALAPPDATA': 'C:\\\\Users\\\\Administrator\\\\AppData\\\\Local', 'HOMEPATH': '\\\\Users\\\\Administrator', 'USERDOMAIN_ROAMINGPROFILE': 'JMONEY-WINDOWS-', 'PROGRAMW6432': 'C:\\\\Program Files', 'USERNAME': 'Administrator', 'LOGONSERVER': '\\\\\\\\JMONEY-WINDOWS-', 'PROMPT': '$P$G', 'COMSPEC': 'C:\\\\Windows\\\\system32\\\\cmd.exe', 'PROGRAMDATA': 'C:\\\\ProgramData', 'SESSIONNAME': 'RDP-Tcp#0', 'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC', 'CLIENTNAME': 'poseidon', 'FP_NO_HOST_CHECK': 'NO', 'WINDIR': 'C:\\\\Windows', 'HOMEDRIVE': 'C:', 'APPDATA': 'C:\\\\Users\\\\Administrator\\\\AppData\\\\Roaming', 'SYSTEMDRIVE': 'C:', 'NUMBER_OF_PROCESSORS': '2', 'PROCESSOR_LEVEL': '21', 'COMMONPROGRAMW6432': 'C:\\\\Program Files\\\\Common Files', 'OS': 'Windows_NT', 'PUBLIC': 'C:\\\\Users\\\\Public', 'USERPROFILE': 'C:\\\\Users\\\\Administrator'}, 'stdout': -1, 'stdin': None, 'stderr': -2, 'cwd': 'C:\\\\Users\\\\Administrator'}, reason: [Error 2] The system cannot find the file specified\r\n     Started: 19:37:04.426000\r\n    Duration: 15.0 ms\r\n     Changes:\r\n\r\nSummary\r\n------------\r\nSucceeded: 0\r\nFailed:    1\r\n------------\r\nTotal states run:     1\r\n```\r\n\r\n### versions\r\n```yaml\r\n# salt jmoney-windows-12 test.versions_report\r\njmoney-windows-12:\r\n               Salt: 2015.5.3-235-g1e3f33a\r\n             Python: 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)]\r\n             Jinja2: 2.7.3\r\n           M2Crypto: 0.21.1\r\n     msgpack-python: 0.4.5\r\n       msgpack-pure: Not Installed\r\n           pycrypto: 2.6\r\n            libnacl: Not Installed\r\n             PyYAML: 3.11\r\n              ioflo: Not Installed\r\n              PyZMQ: 14.6.0\r\n               RAET: Not Installed\r\n                ZMQ: 4.0.5\r\n               Mako: Not Installed\r\n            Tornado: Not Installed\r\n            timelib: Not Installed\r\n```"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/135105239","html_url":"https://github.com/saltstack/salt/issues/26337#issuecomment-135105239","issue_url":"https://api.github.com/repos/saltstack/salt/issues/26337","id":135105239,"user":{"login":"twangboy","id":9383935,"avatar_url":"https://avatars.githubusercontent.com/u/9383935?v=3","gravatar_id":"","url":"https://api.github.com/users/twangboy","html_url":"https://github.com/twangboy","followers_url":"https://api.github.com/users/twangboy/followers","following_url":"https://api.github.com/users/twangboy/following{/other_user}","gists_url":"https://api.github.com/users/twangboy/gists{/gist_id}","starred_url":"https://api.github.com/users/twangboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twangboy/subscriptions","organizations_url":"https://api.github.com/users/twangboy/orgs","repos_url":"https://api.github.com/users/twangboy/repos","events_url":"https://api.github.com/users/twangboy/events{/privacy}","received_events_url":"https://api.github.com/users/twangboy/received_events","type":"User","site_admin":false},"created_at":"2015-08-26T16:47:50Z","updated_at":"2015-08-26T16:47:50Z","body":"I think the preferred method is to use cmd.shell, but understand there are security risks"}}