Skip to content

Commit

Permalink
Merge pull request #416 from /issues/415
Browse files Browse the repository at this point in the history
fixes #415 - 7.0.0 release
  • Loading branch information
jantman authored Aug 13, 2019
2 parents 9e76b4b + f7a85d2 commit 7189c5a
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 35 deletions.
6 changes: 5 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
Changelog
=========

Unreleased Changes
7.0.0 (2019-08-13)
------------------

This release **removes one limit and adds two new limits**!

* `Issue #412 <https://github.com/jantman/awslimitchecker/issues/412>`__ / `PR #414 <https://github.com/jantman/awslimitchecker/pull/414>`__ - Since some time in June 2019, the former ``ELB`` Service ``Active load balancers`` limit is now two separate limits, ``Classic load balancers`` and ``Application load balancers``. **Anyone who was using the "Active load balancers" limit name (e.g. in overrides or custom code) must update their code accordingly.** This release removes the ``Active load balancers`` limit and adds two new limits, ``Classic load balancers`` and ``Application load balancers``, to match how AWS now calculates and exposes these limits.
* `Issue #410 <https://github.com/jantman/awslimitchecker/issues/410>`__ - Documentation fix for missing Trusted Advisor information on Limits page.
* Fix some test failures related to exception objects in pytest 5.0.0.

6.1.7 (2019-05-17)
------------------
Expand Down
23 changes: 18 additions & 5 deletions awslimitchecker/services/elb.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ def find_usage(self):
elb_usage = self._find_usage_elbv1()
alb_usage = self._find_usage_elbv2()
logger.debug('ELBs in use: %d, ALBs in use: %d', elb_usage, alb_usage)
self.limits['Active load balancers']._add_current_usage(
(elb_usage + alb_usage),
self.limits['Classic load balancers']._add_current_usage(
elb_usage,
aws_type='AWS::ElasticLoadBalancing::LoadBalancer',
)
self.limits['Application load balancers']._add_current_usage(
alb_usage,
aws_type='AWS::ElasticLoadBalancingV2::LoadBalancer',
)
self._have_usage = True
logger.debug("Done checking usage.")

Expand Down Expand Up @@ -260,8 +264,8 @@ def get_limits(self):
return self.limits
limits = {}
# ELBv1 (Classic ELB) limits
limits['Active load balancers'] = AwsLimit(
'Active load balancers',
limits['Classic load balancers'] = AwsLimit(
'Classic load balancers',
self,
20,
self.warning_threshold,
Expand All @@ -287,6 +291,14 @@ def get_limits(self):
limit_subtype='Instance'
)
# ELBv2 (ALB) limits
limits['Application load balancers'] = AwsLimit(
'Application load balancers',
self,
20,
self.warning_threshold,
self.critical_threshold,
limit_type='AWS::ElasticLoadBalancingV2::LoadBalancer',
)
limits['Target groups'] = AwsLimit(
'Target groups',
self,
Expand Down Expand Up @@ -352,7 +364,7 @@ def _update_limits_from_api(self):
logger.debug("Querying ELB DescribeAccountLimits for limits")
attribs = self.conn.describe_account_limits()
name_to_limits = {
'classic-load-balancers': 'Active load balancers',
'classic-load-balancers': 'Classic load balancers',
'classic-listeners': 'Listeners per load balancer',
'classic-registered-instances':
'Registered instances per load balancer'
Expand All @@ -371,6 +383,7 @@ def _update_limits_from_api(self):
logger.debug("Querying ELBv2 (ALB) DescribeAccountLimits for limits")
attribs = self.conn2.describe_account_limits()
name_to_limits = {
'application-load-balancers': 'Application load balancers',
'target-groups': 'Target groups',
'listeners-per-application-load-balancer':
'Listeners per application load balancer',
Expand Down
17 changes: 12 additions & 5 deletions awslimitchecker/tests/services/test_elb.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ def test_get_limits(self):
cls.limits = {}
res = cls.get_limits()
assert sorted(res.keys()) == sorted([
'Active load balancers',
'Application load balancers',
'Certificates per application load balancer',
'Classic load balancers',
'Listeners per application load balancer',
'Listeners per load balancer',
'Listeners per network load balancer',
Expand Down Expand Up @@ -119,7 +120,8 @@ def test_update_limits_from_api(self):
call('elbv2', foo='bar', baz='blam'),
call().describe_account_limits()
]
assert cls.limits['Active load balancers'].api_limit == 3
assert cls.limits['Classic load balancers'].api_limit == 3
assert cls.limits['Application load balancers'].api_limit == 6
assert cls.limits['Listeners per load balancer'].api_limit == 5
assert cls.limits[
'Registered instances per load balancer'].api_limit == 1800
Expand All @@ -142,9 +144,14 @@ def test_find_usage(self):
assert cls._have_usage is True
assert mock_v1.mock_calls == [call(cls)]
assert mock_v2.mock_calls == [call(cls)]
assert len(cls.limits['Active load balancers'].get_current_usage()) == 1
assert cls.limits['Active load balancers'
''].get_current_usage()[0].get_value() == 8
assert len(cls.limits[
'Classic load balancers'].get_current_usage()) == 1
assert len(cls.limits[
'Application load balancers'].get_current_usage()) == 1
assert cls.limits[
'Classic load balancers'].get_current_usage()[0].get_value() == 3
assert cls.limits['Application load balancers'
].get_current_usage()[0].get_value() == 5

def test_find_usage_elbv1(self):
mock_conn = Mock()
Expand Down
6 changes: 3 additions & 3 deletions awslimitchecker/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def test_no_marker_path(self):
paginate_dict(func)
ex_str = "alc_marker_path must be specified for queries " \
"that return a dict."
assert ex_str in str(excinfo)
assert ex_str in str(excinfo.value)

def test_no_data_path(self):
func = Mock()
Expand All @@ -166,7 +166,7 @@ def test_no_data_path(self):
paginate_dict(func, alc_marker_path=[])
ex_str = "alc_data_path must be specified for queries " \
"that return a dict."
assert ex_str in str(excinfo)
assert ex_str in str(excinfo.value)

def test_no_marker_param(self):
func = Mock()
Expand All @@ -179,7 +179,7 @@ def test_no_marker_param(self):
)
ex_str = "alc_marker_param must be specified for queries " \
"that return a dict."
assert ex_str in str(excinfo)
assert ex_str in str(excinfo.value)

def test_bad_path(self):
result = {
Expand Down
2 changes: 1 addition & 1 deletion awslimitchecker/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
except ImportError:
logger.error("Unable to import versionfinder", exc_info=True)

_VERSION_TUP = (6, 1, 7)
_VERSION_TUP = (7, 0, 0)
_VERSION = '.'.join([str(x) for x in _VERSION_TUP])
_PROJECT_URL = 'https://github.com/jantman/awslimitchecker'

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/check_aws_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
'Running On-Demand c1.medium instances': 1000,
},
'ELB': {
'Active load balancers': 100,
'Application load balancers': 100,
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"Running On-Demand c1.medium instances": 1000
},
"ELB": {
"Active load balancers": 100
"Application load balancers": 100
}
}
21 changes: 10 additions & 11 deletions docs/source/cli_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ use as a Nagios-compatible plugin).
(venv)$ awslimitchecker --help
usage: awslimitchecker [-h] [-S [SERVICE [SERVICE ...]]]
[--skip-service SKIP_SERVICE] [-s] [-l]
[--skip-check SKIP_CHECK]
[--list-defaults] [-L LIMIT] [-u] [--iam-policy]
[-W WARNING_THRESHOLD] [-C CRITICAL_THRESHOLD]
[-P PROFILE_NAME] [-A STS_ACCOUNT_ID]
[-R STS_ACCOUNT_ROLE] [-E EXTERNAL_ID]
[-M MFA_SERIAL_NUMBER] [-T MFA_TOKEN] [-r REGION]
[--skip-ta]
[--skip-service SKIP_SERVICE] [--skip-check SKIP_CHECK]
[-s] [-l] [--list-defaults] [-L LIMIT] [-u]
[--iam-policy] [-W WARNING_THRESHOLD]
[-C CRITICAL_THRESHOLD] [-P PROFILE_NAME]
[-A STS_ACCOUNT_ID] [-R STS_ACCOUNT_ROLE]
[-E EXTERNAL_ID] [-M MFA_SERIAL_NUMBER] [-T MFA_TOKEN]
[-r REGION] [--skip-ta]
[--ta-refresh-wait | --ta-refresh-trigger | --ta-refresh-older TA_REFRESH_OLDER]
[--ta-refresh-timeout TA_REFRESH_TIMEOUT] [--no-color]
[--no-check-version] [-v] [-V]
Expand All @@ -48,7 +47,7 @@ use as a Nagios-compatible plugin).
avoid performing actions for the specified service
name; see -s|--list-services for valid names
--skip-check SKIP_CHECK
avoid performing actions for the specified check
avoid performing actions for the specified check name
-s, --list-services print a list of all AWS service types that
awslimitchecker knows how to check
-l, --list-limits print all AWS effective limits in
Expand Down Expand Up @@ -391,10 +390,10 @@ permissions for it to perform all limit checks. This can be viewed with the
"Statement": [
{
"Action": [
"apigateway:GET",
"apigateway:GET",
(...)
}
],
],
"Version": "2012-10-17"
}
Expand Down
2 changes: 1 addition & 1 deletion docs/source/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ For further information, see :ref:`Internals / Trusted Advisor <internals.truste
Unit Testing
------------

Testing is done via `pytest <http://pytest.org/latest/>`_, driven by `tox <https://tox.readthedocs.org/>`_.
Testing is done via `pytest <http://pytest.org/en/latest/>`_, driven by `tox <https://tox.readthedocs.org/>`_.

* testing is as simple as:

Expand Down
13 changes: 7 additions & 6 deletions docs/source/limits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ Running On-Demand m5.24xlarge instances 5
Running On-Demand m5.2xlarge instances 20
Running On-Demand m5.4xlarge instances 10
Running On-Demand m5.large instances |check| 20
Running On-Demand m5.xlarge instances |check| 20
Running On-Demand m5.xlarge instances 20
Running On-Demand m5a.12xlarge instances 20
Running On-Demand m5a.24xlarge instances 20
Running On-Demand m5a.2xlarge instances 20
Expand All @@ -276,7 +276,7 @@ Running On-Demand r3.large instances 20
Running On-Demand r3.xlarge instances 20
Running On-Demand r4.16xlarge instances 1
Running On-Demand r4.2xlarge instances 20
Running On-Demand r4.4xlarge instances 10
Running On-Demand r4.4xlarge instances |check| 10
Running On-Demand r4.8xlarge instances 5
Running On-Demand r4.large instances |check| 20
Running On-Demand r4.xlarge instances |check| 20
Expand All @@ -286,7 +286,7 @@ Running On-Demand r5.24xlarge instances 20
Running On-Demand r5.2xlarge instances 20
Running On-Demand r5.4xlarge instances 20
Running On-Demand r5.8xlarge instances 20
Running On-Demand r5.large instances 20
Running On-Demand r5.large instances |check| 20
Running On-Demand r5.metal instances 20
Running On-Demand r5.xlarge instances 20
Running On-Demand r5a.12xlarge instances 20
Expand Down Expand Up @@ -317,7 +317,7 @@ Running On-Demand t3.large instances |check| 20
Running On-Demand t3.medium instances |check| 20
Running On-Demand t3.micro instances |check| 20
Running On-Demand t3.nano instances 20
Running On-Demand t3.small instances 20
Running On-Demand t3.small instances |check| 20
Running On-Demand t3.xlarge instances 20
Running On-Demand x1.16xlarge instances 20
Running On-Demand x1.32xlarge instances 20
Expand Down Expand Up @@ -372,8 +372,9 @@ ELB
========================================== =============== ======= ====
Limit Trusted Advisor API Default
========================================== =============== ======= ====
Active load balancers |check| |check| 20
Application load balancers |check| 20
Certificates per application load balancer 25
Classic load balancers |check| 20
Listeners per application load balancer |check| 50
Listeners per load balancer |check| 100
Listeners per network load balancer |check| 50
Expand Down Expand Up @@ -469,7 +470,7 @@ DB Clusters |check| |check| 40
DB instances |check| |check| 40
DB parameter groups |check| |check| 50
DB security groups |check| |check| 25
DB snapshots per user |check| |check| 100
DB snapshots per user |check| 100
Event Subscriptions |check| |check| 20
Max auths per security group |check| |check| 20
Option Groups |check| 20
Expand Down

0 comments on commit 7189c5a

Please sign in to comment.