saltstack / saltstack/salt

boto_secgroup is using group's Name, not the usual tag:Name - breaking both execution (.run) and state (.instance_present) modules if Name and tag:Name are different

Open
#55,337 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

boto bug Confirmed severity-high
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

So far, I've seen salt referring to tag:Name in its boto modules. I've had to figure out myself boto_secgroup is actually using the Name, not the usual tag:Name. For consistency, the tag:Name should be used to manage AWS Security groups. This has important consequences because this module is used by boto_ec2.run, which is turn used by boto_ec2.instance_present. Basically if we're trying to use default SG's name in instance_present bith state and module will fail.

This is Checking all Security groups, we see that every security group has a name, and a tag:Name. Usually, these are identical, but with the default group, the Name will be 'default' while the tag:Name will be the one we've defined.

salt-call boto_secgroup.get_all_security_groups

If I try searching for the SG by using the tag name 'SG-NAT' instead of the Name 'default', salt returns nothing.

The following will return 'False' ('SG-NAT' is the tag Name of the default group)

salt-call boto_secgroup.get_group_id 'SG-NAT' vpc_name='VPC-SALT'

This will instead successfully find the group's ID

salt-call boto_secgroup.get_group_id 'default' vpc_name='VPC-SALT'

For consistency with other modules, this module should only use tags.
Or at least this peculiarity should be documented..

Versions Report
Salt Version:
           Salt: 2019.2.2
 
Dependency Versions:
           cffi: 1.6.0
       cherrypy: unknown
       dateutil: 2.8.0
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.31.0
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Aug  7 2019, 00:51:29)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.3.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: centos 7.7.1908 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-1062.4.3.el7.x86_64
         system: Linux
        version: CentOS Linux 7.7.1908 Core

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the boto_secgroup.get_all_security_groups and get_group_id entry points, then trace how boto_ec2.run and boto_ec2.instance_present use security-group names. Reproduce the difference between the group's Name and tag:Name with the commands in the report; done means the tag:Name lookup works consistently without breaking default security-group handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.