boto_asg.present can no longer return a proper value
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description of Issue
when using boto_asg.present, it now results in:
Traceback (most recent call last):
File "/home/user/venv/infra/lib/python3.10/site-packages/salt/state.py", line 2276, in call
ret = self.states[cdata["full"]](
File "/home/user/venv/infra/lib/python3.10/site-packages/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/home/user/venv/infra/lib/python3.10/site-packages/salt/loader/lazy.py", line 1228, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/home/user/venv/infra/lib/python3.10/site-packages/salt/loader/lazy.py", line 1243, in _run_as
return _func_or_method(*args, **kwargs)
File "/home/user/venv/infra/lib/python3.10/site-packages/salt/loader/lazy.py", line 1276, in wrapper
return f(*args, **kwargs)
File "/home/user/venv/infra/lib/python3.10/site-packages/salt/states/boto_asg.py", line 534, in present
asg = __salt__["boto_asg.get_config"](name, region, key, keyid, profile)
File "/home/user/venv/infra/lib/python3.10/site-packages/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/home/user/venv/infra/lib/python3.10/site-packages/salt/loader/lazy.py", line 1228, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/home/user/venv/infra/lib/python3.10/site-packages/salt/loader/lazy.py", line 1243, in _run_as
return _func_or_method(*args, **kwargs)
File "/home/user/venv/infra/lib/python3.10/site-packages/salt/modules/boto_asg.py", line 187, in get_config
ret[attr] = getattr(asg, attr).split(",")
AttributeError: 'NoneType' object has no attribute 'split'
Retrieving vpc_zone_identifiers result in None instead of array.
Salt uses the boto.ec2.autoscale library to get an asg object, then retrieve a list of vpc_zone_identifiers. Now, all of a sudden, this has stopped working and returns "None":
Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from boto.ec2.autoscale import *
>>> c = boto.ec2.autoscale.connect_to_region('us-east-1')
>>> asg = c.get_all_groups(names=['xxxxxxxxxxxxxxxxxxxxxxxxxx'])[0]
>>> print(asg.vpc_zone_identifier)
None
Boto3 still does this successfully:
>>> import boto3
>>>
>>> asg_name = 'xxxxxxxxxxxx'
>>> client = boto3.client('autoscaling')
>>> asg_details = client.describe_auto_scaling_groups(AutoScalingGroupNames=[asg_name])
>>> vpc_zone_identifier = asg_details['AutoScalingGroups'][0]['VPCZoneIdentifier']
>>> print(vpc_zone_identifier)
subnet-xxxxxxxxxxxx,subnet-yyyyyyyyyyyy
The automation we use depends on this, and this was working until the end of last week.
This may have something to do with AWS changing things on their end: https://aws.amazon.com/about-aws/whats-new/2023/03/general-availability-amazon-vpc-lattice/
Setup
Provided in the Description
Steps to Reproduce Issue
# ASG Settings.
Ensure xxxxxxxxxxxxxxxxxxxx asg exists:
boto_asg.present:
- name: zzzzzzzzzzzzzzzzzzzzz
- load_balancers:
- xxxxxxxxxxxxxxxxxxxxxxxxx
- yyyyyyyyyyyyyyyyyyyyyyyy
- launch_config_name: zzzzzzzzzzzzzzzzzzzzzz
- launch_config:
- image_id: ami-xxxxxxxxxxxxxxxxxxxx
- key_name: aaaaaaaaa
- security_groups:
- sssssssssssssssggggggggggggggg
- instance_profile_name: zzzzzzzzzzzzzzzzzzzzzzzzz
- instance_type: m5.xlarge
- block_device_mappings:
- "/dev/sda1":
size: 500
volume_type: gp3
delete_on_termination: true
- associate_public_ip_address: true
- instance_monitoring: true
- vpc_zone_identifier: ['subnet-xxxxxxxxxxxxxxx','subnet-yyyyyyyyyyyyyy' ]
- availability_zones: ['us-east-1b','us-east-1c']
- min_size: 1
- max_size: 1
- health_check_type: EC2
- health_check_period: 900
- termination_policies:
- OldestInstance
- OldestLaunchConfiguration
- tags:
- key: 'Name'
value: 'cccccccccccccccccccccc'
- profile: infra_profile
Versions Report
$ salt --versions-report
Salt Version:
Salt: 3005.1+7.gfe67de4b7f
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.11.3
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.5
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 3.10.1
pycryptodome: 3.17
pygit2: Not Installed
Python: 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]
python-gnupg: Not Installed
PyYAML: 5.4.1
PyZMQ: 20.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.3
System Versions:
dist: ubuntu 22.04 Jammy Jellyfish
locale: utf-8
machine: x86_64
release: 5.19.0-38-generic
system: Linux
version: Ubuntu 22.04 Jammy Jellyfish
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with salt/modules/boto_asg.py at get_config and salt/states/boto_asg.py at present, then reproduce the boto.ec2.autoscale lookup for vpc_zone_identifier. Compare the returned ASG data with the boto3 result and determine the expected handling when the value is None. Done means boto_asg.present no longer raises the reported AttributeError while processing the supplied configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100