{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/36977","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/36977/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/36977/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/36977/events","html_url":"https://github.com/ansible/ansible/issues/36977","id":302083037,"node_id":"MDU6SXNzdWUzMDIwODMwMzc=","number":36977,"title":"module_utils/eos.py does not handle error when maximux sessions reached","user":{"login":"user318","id":671062,"node_id":"MDQ6VXNlcjY3MTA2Mg==","avatar_url":"https://avatars2.githubusercontent.com/u/671062?v=4","gravatar_id":"","url":"https://api.github.com/users/user318","html_url":"https://github.com/user318","followers_url":"https://api.github.com/users/user318/followers","following_url":"https://api.github.com/users/user318/following{/other_user}","gists_url":"https://api.github.com/users/user318/gists{/gist_id}","starred_url":"https://api.github.com/users/user318/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/user318/subscriptions","organizations_url":"https://api.github.com/users/user318/orgs","repos_url":"https://api.github.com/users/user318/repos","events_url":"https://api.github.com/users/user318/events{/privacy}","received_events_url":"https://api.github.com/users/user318/received_events","type":"User","site_admin":false},"labels":[{"id":562292166,"node_id":"MDU6TGFiZWw1NjIyOTIxNjY=","url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.4","name":"affects_2.4","color":"ededed","default":false},{"id":785271699,"node_id":"MDU6TGFiZWw3ODUyNzE2OTk=","url":"https://api.github.com/repos/ansible/ansible/labels/bug","name":"bug","color":"fbca04","default":true},{"id":496359346,"node_id":"MDU6TGFiZWw0OTYzNTkzNDY=","url":"https://api.github.com/repos/ansible/ansible/labels/module","name":"module","color":"1d76db","default":false},{"id":339653091,"node_id":"MDU6TGFiZWwzMzk2NTMwOTE=","url":"https://api.github.com/repos/ansible/ansible/labels/networking","name":"networking","color":"c7def8","default":false},{"id":669761792,"node_id":"MDU6TGFiZWw2Njk3NjE3OTI=","url":"https://api.github.com/repos/ansible/ansible/labels/support:network","name":"support:network","color":"ededed","default":false}],"state":"closed","locked":false,"assignee":{"login":"justjais","id":26872141,"node_id":"MDQ6VXNlcjI2ODcyMTQx","avatar_url":"https://avatars2.githubusercontent.com/u/26872141?v=4","gravatar_id":"","url":"https://api.github.com/users/justjais","html_url":"https://github.com/justjais","followers_url":"https://api.github.com/users/justjais/followers","following_url":"https://api.github.com/users/justjais/following{/other_user}","gists_url":"https://api.github.com/users/justjais/gists{/gist_id}","starred_url":"https://api.github.com/users/justjais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justjais/subscriptions","organizations_url":"https://api.github.com/users/justjais/orgs","repos_url":"https://api.github.com/users/justjais/repos","events_url":"https://api.github.com/users/justjais/events{/privacy}","received_events_url":"https://api.github.com/users/justjais/received_events","type":"User","site_admin":false},"assignees":[{"login":"justjais","id":26872141,"node_id":"MDQ6VXNlcjI2ODcyMTQx","avatar_url":"https://avatars2.githubusercontent.com/u/26872141?v=4","gravatar_id":"","url":"https://api.github.com/users/justjais","html_url":"https://github.com/justjais","followers_url":"https://api.github.com/users/justjais/followers","following_url":"https://api.github.com/users/justjais/following{/other_user}","gists_url":"https://api.github.com/users/justjais/gists{/gist_id}","starred_url":"https://api.github.com/users/justjais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justjais/subscriptions","organizations_url":"https://api.github.com/users/justjais/orgs","repos_url":"https://api.github.com/users/justjais/repos","events_url":"https://api.github.com/users/justjais/events{/privacy}","received_events_url":"https://api.github.com/users/justjais/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/ansible/ansible/milestones/11","html_url":"https://github.com/ansible/ansible/milestone/11","labels_url":"https://api.github.com/repos/ansible/ansible/milestones/11/labels","id":2644825,"node_id":"MDk6TWlsZXN0b25lMjY0NDgyNQ==","number":11,"title":"2.5.0","description":"","creator":{"login":"gundalow","id":940557,"node_id":"MDQ6VXNlcjk0MDU1Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/940557?v=4","gravatar_id":"","url":"https://api.github.com/users/gundalow","html_url":"https://github.com/gundalow","followers_url":"https://api.github.com/users/gundalow/followers","following_url":"https://api.github.com/users/gundalow/following{/other_user}","gists_url":"https://api.github.com/users/gundalow/gists{/gist_id}","starred_url":"https://api.github.com/users/gundalow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gundalow/subscriptions","organizations_url":"https://api.github.com/users/gundalow/orgs","repos_url":"https://api.github.com/users/gundalow/repos","events_url":"https://api.github.com/users/gundalow/events{/privacy}","received_events_url":"https://api.github.com/users/gundalow/received_events","type":"User","site_admin":false},"open_issues":37,"closed_issues":485,"state":"open","created_at":"2017-07-17T13:35:32Z","updated_at":"2018-06-07T07:52:08Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2018-03-04T12:47:47Z","updated_at":"2018-06-07T07:52:08Z","closed_at":"2018-06-07T07:52:08Z","author_association":"NONE","body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\neos_command\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from \"ansible --version\" between quotes below -->\r\n```\r\nansible 2.4.3.0\r\n  config file = /home/user/.ansible.cfg\r\n  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']\r\n  ansible python module location = /home/user/soft/ansible/lib/python3.6/site-packages/ansible\r\n  executable location = /home/user/bin/ansible\r\n  python version = 3.6.1 (default, Jun  2 2017, 15:55:17) [GCC 4.8.4]\r\n```\r\n\r\n##### CONFIGURATION\r\nN/A\r\n\r\n##### OS / ENVIRONMENT\r\nN/A\r\n\r\n##### SUMMARY\r\nmodule_utils/eos.py does not handle error when maximux sessions reached and config commands are being sent in exec mode.\r\n\r\n##### STEPS TO REPRODUCE\r\nRun 5 configuraion sessions (or other maximum your switch have). Try to use eos_command plugin on switch (even with check mode).\r\n\r\n##### EXPECTED RESULTS\r\nError is noticed before configuration commands are sent to switch.\r\n\r\n##### ACTUAL RESULTS\r\nIt does not notice an error and that switch haven't entered configuration mode and tries to run configuration commands in exec mode. Even in check mode it could potentially input something that would make somethin unexpected to the switch.\r\n```\r\nTASK [testrole : testtask] ****************************************************\r\nfatal: [switch]: FAILED! => {\"changed\": false, \"commands\": [\"...\", \"...\"], \"msg\": \"...\\r\\n% Invalid input\\r\\nswitch#...\\r\\n% Invalid input\\r\\nswitch#\"}\r\n```\r\n\r\nHere is the piece of code from module_utils/eos.py that tries to create a configure session:\r\n```\r\n        rc, out, err = self.exec_command('configure session %s' % session)\r\n        if rc != 0:\r\n            self._module.fail_json(msg='unable to enter configuration mode', output=to_text(err, errors='surrogate_then_replace'))\r\n```\r\nIn case of error we actually receive:\r\n```\r\nrc=0\r\nout=% Maximum number of pending sessions has been reached. Please commit or abort previous sessions before creating a new one.\r\nerr=0\r\n```\r\n\r\nI tracked down where the command actually executed (plugins/connection/network_cli.py) and it turns out that it always return rc == 0:\r\n```\r\n    def exec_command(self, cmd):\r\n...\r\n            out = self.send(obj['command'], obj.get('prompt'), obj.get('answer'), obj.get('sendonly'))\r\n            signal.alarm(0)\r\n            return 0, out, b''\r\n```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/395327156","html_url":"https://github.com/ansible/ansible/issues/36977#issuecomment-395327156","issue_url":"https://api.github.com/repos/ansible/ansible/issues/36977","id":395327156,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTMyNzE1Ng==","user":{"login":"justjais","id":26872141,"node_id":"MDQ6VXNlcjI2ODcyMTQx","avatar_url":"https://avatars2.githubusercontent.com/u/26872141?v=4","gravatar_id":"","url":"https://api.github.com/users/justjais","html_url":"https://github.com/justjais","followers_url":"https://api.github.com/users/justjais/followers","following_url":"https://api.github.com/users/justjais/following{/other_user}","gists_url":"https://api.github.com/users/justjais/gists{/gist_id}","starred_url":"https://api.github.com/users/justjais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justjais/subscriptions","organizations_url":"https://api.github.com/users/justjais/orgs","repos_url":"https://api.github.com/users/justjais/repos","events_url":"https://api.github.com/users/justjais/events{/privacy}","received_events_url":"https://api.github.com/users/justjais/received_events","type":"User","site_admin":false},"created_at":"2018-06-07T07:52:08Z","updated_at":"2018-06-07T07:52:08Z","author_association":"CONTRIBUTOR","body":"It'll be fixed with the merge of PR #41230."}}
{"actor":{"display_login":"justjais"}}