{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/20789","labels_url":"https://api.github.com/repos/saltstack/salt/issues/20789/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/20789/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/20789/events","html_url":"https://github.com/saltstack/salt/issues/20789","id":58053124,"number":20789,"title":"`user.present` state doesn't show reason for failure when password doesn't match policy requirements","user":{"login":"eliasp","id":48491,"avatar_url":"https://avatars.githubusercontent.com/u/48491?v=3","gravatar_id":"","url":"https://api.github.com/users/eliasp","html_url":"https://github.com/eliasp","followers_url":"https://api.github.com/users/eliasp/followers","following_url":"https://api.github.com/users/eliasp/following{/other_user}","gists_url":"https://api.github.com/users/eliasp/gists{/gist_id}","starred_url":"https://api.github.com/users/eliasp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eliasp/subscriptions","organizations_url":"https://api.github.com/users/eliasp/orgs","repos_url":"https://api.github.com/users/eliasp/repos","events_url":"https://api.github.com/users/eliasp/events{/privacy}","received_events_url":"https://api.github.com/users/eliasp/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/Medium%20Severity","name":"Medium Severity","color":"fad8c7"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Windows","name":"Windows","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/13","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/13/labels","id":9265,"number":13,"title":"Approved","description":"All issues that are ready to be worked on, both bugs and features.","creator":{"login":"thatch45","id":507599,"avatar_url":"https://avatars.githubusercontent.com/u/507599?v=3","gravatar_id":"","url":"https://api.github.com/users/thatch45","html_url":"https://github.com/thatch45","followers_url":"https://api.github.com/users/thatch45/followers","following_url":"https://api.github.com/users/thatch45/following{/other_user}","gists_url":"https://api.github.com/users/thatch45/gists{/gist_id}","starred_url":"https://api.github.com/users/thatch45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thatch45/subscriptions","organizations_url":"https://api.github.com/users/thatch45/orgs","repos_url":"https://api.github.com/users/thatch45/repos","events_url":"https://api.github.com/users/thatch45/events{/privacy}","received_events_url":"https://api.github.com/users/thatch45/received_events","type":"User","site_admin":false},"open_issues":1958,"closed_issues":1529,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2015-02-18T17:25:52Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-02-18T10:54:31Z","updated_at":"2015-02-18T17:26:06Z","closed_at":null,"body":"**OS:** `Win 7 Enterprise x86_64 en_US`\r\n**Salt:**\r\n```\r\n               Salt: 2014.7.1\r\n             Python: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]\r\n             Jinja2: 2.7.1\r\n           M2Crypto: 0.21.1\r\n     msgpack-python: 0.4.2\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.1.1\r\n               RAET: Not Installed\r\n                ZMQ: 4.0.4\r\n               Mako: Not Installed\r\n```\r\n**State:**\r\n```SaltStack\r\njohndoe:\r\n    user.present:\r\n        - password: johndoe\r\n```\r\n\r\n**Result:**\r\n```\r\n          ID: johndoe\r\n    Function: user.present\r\n      Result: False\r\n     Comment: Failed to create new user johndoe\r\n     Started: 11:28:05.724000\r\n    Duration: 109.0 ms\r\n     Changes:  \r\n```\r\n\r\n**Debug:**\r\n```\r\n    [INFO    ] Running state [johndoe] at time 10:54:56.555000\r\n    [INFO    ] Executing state user.present for johndoe\r\n    [INFO    ] Executing command ['net', 'user', 'johndoe', '/add'] in directory 'C:\\\\Windows\\\\system32\\\\config\\\\systemprofile'\r\n    [ERROR   ] Command ['net', 'user', 'johndoe', '/add'] failed with return code: 2\r\n    [ERROR   ] stderr: The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements.\r\n    \r\n    More help is available by typing NET HELPMSG 2245.\r\n    [ERROR   ] retcode: 2\r\n    [ERROR   ] Failed to create new user johndoe\r\n    [INFO    ] Completed state [johndoe] at time 10:54:56.680000\r\n\r\n```\r\n**Conclusion:**\r\nThe execution module function `win_useradd.add` should handle some common return codes from `net user` (see also: [salt/modules/win_system.py:311](https://github.com/saltstack/salt/blob/2014.7/salt/modules/win_system.py#L311)) and at least log such failures as error."},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/74906848","html_url":"https://github.com/saltstack/salt/issues/20789#issuecomment-74906848","issue_url":"https://api.github.com/repos/saltstack/salt/issues/20789","id":74906848,"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},"created_at":"2015-02-18T17:26:06Z","updated_at":"2015-02-18T17:26:06Z","body":"Thanks for reporting, @eliasp."}}