{"action":"opened","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/47190","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/47190/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/47190/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/47190/events","html_url":"https://github.com/saltstack/salt/issues/47190","id":316009042,"number":47190,"title":"boto_secgroup.present intermittently when run as part of an Orchestration state","user":{"login":"MDPolaris","id":17074189,"avatar_url":"https://avatars3.githubusercontent.com/u/17074189?v=4","gravatar_id":"","url":"https://api.github.com/users/MDPolaris","html_url":"https://github.com/MDPolaris","followers_url":"https://api.github.com/users/MDPolaris/followers","following_url":"https://api.github.com/users/MDPolaris/following{/other_user}","gists_url":"https://api.github.com/users/MDPolaris/gists{/gist_id}","starred_url":"https://api.github.com/users/MDPolaris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MDPolaris/subscriptions","organizations_url":"https://api.github.com/users/MDPolaris/orgs","repos_url":"https://api.github.com/users/MDPolaris/repos","events_url":"https://api.github.com/users/MDPolaris/events{/privacy}","received_events_url":"https://api.github.com/users/MDPolaris/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-19T19:26:54Z","updated_at":"2018-04-19T19:26:54Z","closed_at":null,"author_association":"NONE","body":"### Description of Issue/Question\r\nI have a state to create a security group as part of a larger orchestration state. The state fails fairly regularly during the orch run. I have tried to reproduce the issue while running the state manually with state.apply however it has not failed when executed as a standalone state. The result is a security group with the name specified, however the Security Group does not getted tagged with Name: <SG_NAME>. No rules are added to the group either. I reviewed this briefly with @gtmanfred in the slack channel and nothing jumped out as bad with the states. Here is the error produced:\r\n\r\n>     nv-salt-syndic:\r\n>     ----------\r\n>               ID: cad_worker_sg\r\n>         Function: boto_secgroup.present\r\n>             Name: nv-wc-creo-stage-syndic-cli-test1-sg\r\n>           Result: False\r\n>          Comment: Attempt 1: Returned a result of \"False\", with the following comment: \" Security group nv-wc-creo-stage-syndic-cli-test1-sg created. nv-wc-creo-stage-syndic-cli-test1-sg security group configuration could not be retrieved. nv-wc-creo-stage-syndic-cli-test1-sg security group configuration could not be retrieved. nv-wc-creo-stage-syndic-cli-test1-sg security group configuration could not be retrieved.\"\r\n>                   Attempt 2: Returned a result of \"False\", with the following comment: \"An exception occurred in this state: Traceback (most recent call last):\r\n>                     File \"/usr/lib/python2.7/site-packages/salt/state.py\", line 1837, in call\r\n>                       **cdata['kwargs'])\r\n>                     File \"/usr/lib/python2.7/site-packages/salt/loader.py\", line 1794, in wrapper\r\n>                       return f(*args, **kwargs)\r\n>                     File \"/usr/lib/python2.7/site-packages/salt/states/boto_secgroup.py\", line 184, in present\r\n>                       key=key, keyid=keyid, profile=profile)\r\n>                     File \"/usr/lib/python2.7/site-packages/salt/states/boto_secgroup.py\", line 240, in _security_group_present\r\n>                       profile=profile)\r\n>                     File \"/usr/lib/python2.7/site-packages/salt/modules/boto_secgroup.py\", line 398, in create\r\n>                       created = conn.create_security_group(name, description, vpc_id)\r\n>                     File \"/usr/lib/python2.7/site-packages/boto/ec2/connection.py\", line 3019, in create_security_group\r\n>                       SecurityGroup, verb='POST')\r\n>                     File \"/usr/lib/python2.7/site-packages/boto/connection.py\", line 1208, in get_object\r\n>                       raise self.ResponseError(response.status, response.reason, body)\r\n>                   EC2ResponseError: EC2ResponseError: 400 Bad Request\r\n>                   <?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n>                   <Response><Errors><Error><Code>InvalidGroup.Duplicate</Code><Message>The security group 'nv-wc-creo-stage-syndic-cli-test1-sg' already exists for VPC 'vpc-5160b037'</Message></Error></Errors><RequestID>83ff2c4b-8cda-4ab4-aae2-c3215ef3bce5</RequestID></Response>\r\n>                   \"\r\n>                   An exception occurred in this state: Traceback (most recent call last):\r\n>                     File \"/usr/lib/python2.7/site-packages/salt/state.py\", line 1837, in call\r\n>                       **cdata['kwargs'])\r\n>                     File \"/usr/lib/python2.7/site-packages/salt/loader.py\", line 1794, in wrapper\r\n>                       return f(*args, **kwargs)\r\n>                     File \"/usr/lib/python2.7/site-packages/salt/states/boto_secgroup.py\", line 184, in present\r\n>                       key=key, keyid=keyid, profile=profile)\r\n>                     File \"/usr/lib/python2.7/site-packages/salt/states/boto_secgroup.py\", line 240, in _security_group_present\r\n>                       profile=profile)\r\n>                     File \"/usr/lib/python2.7/site-packages/salt/modules/boto_secgroup.py\", line 398, in create\r\n>                       created = conn.create_security_group(name, description, vpc_id)\r\n>                     File \"/usr/lib/python2.7/site-packages/boto/ec2/connection.py\", line 3019, in create_security_group\r\n>                       SecurityGroup, verb='POST')\r\n>                     File \"/usr/lib/python2.7/site-packages/boto/connection.py\", line 1208, in get_object\r\n>                       raise self.ResponseError(response.status, response.reason, body)\r\n>                   EC2ResponseError: EC2ResponseError: 400 Bad Request\r\n>                   <?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n>                   <Response><Errors><Error><Code>InvalidGroup.Duplicate</Code><Message>The security group 'nv-wc-creo-stage-syndic-cli-test1-sg' already exists for VPC 'vpc-5160b037'</Message></Error></Errors><RequestID>fd47a316-0a5e-479e-a131-1a39022b9ef4</RequestID></Response>\r\n>          Started: 17:09:24.567103\r\n>         Duration: 31451.466 ms\r\n>          Changes:\r\n> \r\n>     Summary for nv-salt-syndic\r\n>     ------------\r\n>     Succeeded: 0\r\n>     Failed:    1\r\n>     ------------\r\n>     Total states run:     1\r\n>     Total run time:  31.451 s\r\n\r\n\r\n### Setup\r\nHere is the rendered section of the Orch state that calls this state:\r\n```\r\ncreate_cadworker_sg:\r\n  salt.state:\r\n    - tgt: nv-salt-syndic\r\n    - sls:\r\n      - plm.cad_worker_sg\r\n    - concurrent: True\r\n    - pillar:\r\n        sg_name: nv-wc-creo-stage-syndic-cli-test1-sg\r\n        cad_worker_type: creo\r\n        new_environment_id: SVC0002373\r\n    - require:\r\n      - salt: creo_cadworker_start_notify\r\n```\r\n\r\nHere is the rendered plm.cad_worker_sg state:\r\n```\r\ncad_worker_sg:\r\n  boto_secgroup.present:\r\n    - name: nv-wc-creo-ptcstg1-sg\r\n    - description: nv-wc-creo-ptcstg1-sg\r\n    - vpc_id: vpc-5160b037\r\n    - rules:\r\n      - ip_protocol: tcp\r\n        from_port: 20\r\n        to_port: 21\r\n        cidr_ip:\r\n          - 10.20.2.33/32\r\n      - ip_protocol: tcp\r\n        from_port: 601\r\n        to_port: 601\r\n        cidr_ip:\r\n          - 10.20.2.33/32\r\n      - ip_protocol: tcp\r\n        from_port: 990\r\n        to_port: 990\r\n        cidr_ip:\r\n          - 10.20.2.33/32\r\n      - ip_protocol: tcp\r\n        from_port: 5600\r\n        to_port: 5600\r\n        cidr_ip:\r\n          - 10.20.2.33/32\r\n      - ip_protocol: tcp\r\n        from_port: 50000\r\n        to_port: 50100\r\n        cidr_ip:\r\n          - 10.20.2.33/32\r\n    - rules_egress:\r\n      - ip_protocol: all\r\n        from_port: -1\r\n        to_port: -1\r\n        cidr_ip:\r\n          - 0.0.0.0/0\r\n    - tags:\r\n        Name: nv-wc-creo-ptcstg1-sg\r\n        Owner: 'mfreitas@ptc.com'\r\n        Customer: 'Mike Freitas'\r\n    - region: us-east-1\r\n    - retry:\r\n        attempts: 3\r\n        interval: 15\r\n        until: True\r\n```\r\n\r\n### Steps to Reproduce Issue\r\nsalt-run state.orch orch_new_plm_environment 'pillar={KEY: VALUE}' -l debug\r\n\r\n### Versions Report\r\nI have tested on 2 versions with the same results (2017.7.1 and 2017.7.5):\r\n\r\nSalt Version:\r\n           Salt: 2017.7.1\r\n\r\nDependency Versions:\r\n           cffi: 1.6.0\r\n       cherrypy: Not Installed\r\n       dateutil: 2.6.1\r\n      docker-py: Not Installed\r\n          gitdb: Not Installed\r\n      gitpython: Not Installed\r\n          ioflo: Not Installed\r\n         Jinja2: 2.7.2\r\n        libgit2: 0.24.6\r\n        libnacl: Not Installed\r\n       M2Crypto: Not Installed\r\n           Mako: Not Installed\r\n   msgpack-pure: Not Installed\r\n msgpack-python: 0.4.8\r\n   mysql-python: Not Installed\r\n      pycparser: 2.14\r\n       pycrypto: 2.6.1\r\n   pycryptodome: 3.4.3\r\n         pygit2: 0.24.2\r\n         Python: 2.7.5 (default, Aug  4 2017, 00:39:18)\r\n   python-gnupg: Not Installed\r\n         PyYAML: 3.11\r\n          PyZMQ: 15.3.0\r\n           RAET: Not Installed\r\n          smmap: Not Installed\r\n        timelib: Not Installed\r\n        Tornado: 4.2.1\r\n            ZMQ: 4.1.4\r\n\r\nSystem Versions:\r\n           dist: centos 7.4.1708 Core\r\n         locale: UTF-8\r\n        machine: x86_64\r\n        release: 3.10.0-693.5.2.el7.x86_64\r\n         system: Linux\r\n        version: CentOS Linux 7.4.1708 Core\r\n\r\n\r\nSalt Version:\r\n           Salt: 2017.7.5\r\n\r\nDependency Versions:\r\n           cffi: Not Installed\r\n       cherrypy: unknown\r\n       dateutil: 1.5\r\n      docker-py: Not Installed\r\n          gitdb: Not Installed\r\n      gitpython: Not Installed\r\n          ioflo: Not Installed\r\n         Jinja2: 2.7.2\r\n        libgit2: Not Installed\r\n        libnacl: Not Installed\r\n       M2Crypto: Not Installed\r\n           Mako: Not Installed\r\n   msgpack-pure: Not Installed\r\n msgpack-python: 0.4.8\r\n   mysql-python: Not Installed\r\n      pycparser: Not Installed\r\n       pycrypto: 2.6.1\r\n   pycryptodome: 3.4.3\r\n         pygit2: Not Installed\r\n         Python: 2.7.5 (default, Aug  4 2017, 00:39:18)\r\n   python-gnupg: Not Installed\r\n         PyYAML: 3.11\r\n          PyZMQ: 15.3.0\r\n           RAET: Not Installed\r\n          smmap: Not Installed\r\n        timelib: Not Installed\r\n        Tornado: 4.2.1\r\n            ZMQ: 4.1.4\r\n\r\nSystem Versions:\r\n           dist: centos 7.4.1708 Core\r\n         locale: UTF-8\r\n        machine: x86_64\r\n        release: 3.10.0-514.10.2.el7.x86_64\r\n         system: Linux\r\n        version: CentOS Linux 7.4.1708 Core"}}
{"actor":{"display_login":"MDPolaris"}}