Skip to content

Commit

Permalink
Merge pull request #483 from jantman/issues/482
Browse files Browse the repository at this point in the history
fixes #482 - 8.1.0 release
  • Loading branch information
jantman authored Sep 18, 2020
2 parents 2bb3ae7 + c6b0100 commit a6eef26
Show file tree
Hide file tree
Showing 68 changed files with 449 additions and 278 deletions.
74 changes: 74 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
pip-selfcheck.json

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/build/

# PyBuilder
target/

# virtualenv
bin/
include/

# IntelliJ
*.iml
.idea/

dev/.terraform
dev/iam_policy.json
dev/terraform.tfstate.backup
results/
.release_position.json
dev/terraform.tfstate
man/
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ sudo: false
cache: pip
matrix:
include:
- python: "2.7"
env: TOXENV=py27
- python: "3.4"
env: TOXENV=py34
- python: "3.5"
env: TOXENV=py35
- python: "3.6"
Expand All @@ -27,9 +23,7 @@ matrix:
- docker
- python: "3.8"
env: TOXENV=docs
- python: "2.7"
env: TOXENV=integration
- python: "3.7"
- python: "3.8"
env: TOXENV=integration3
install:
- git config --global user.email "travisci@jasonantman.com"
Expand Down
17 changes: 17 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
Changelog
=========

.. _changelog.8_1_0:

8.1.0 (2020-09-18)
------------------

* `PR #468 <https://github.com/jantman/awslimitchecker/pull/468>`_ - Fix transposed headings in CLI Usage documentation. Thanks to `@owenmann <https://github.com/owenmann>`__.
* `PR #470 <https://github.com/jantman/awslimitchecker/pull/470>`_ - Fix new EBS "Active snapshots" limit (bumped from 10,000 to 100,000) and Quotas Service name. Thanks to `@rashidamiri <https://github.com/rashidamiri>`__.
* `Issue #464 <https://github.com/jantman/awslimitchecker/issues/464>`_ - Fix bug where SES was causing ``ConnectTimeoutError`` in some regions. This has been added to the list of SES exceptions that we catch and silently ignore. This is a new exception thrown by regions that do not have SES support.
* Add ``.dockerignore`` file to make local builds quite a bit smaller.
* `Issue #465 <https://github.com/jantman/awslimitchecker/issues/465>`_ - Fixed via `versionfinder 1.1.1 <https://github.com/jantman/versionfinder/pull/13>`_.
* Internal testing changes:

* Stop testing under Python 2.7 and Python 3.4.
* Switch from deprecated pep8 / pytest-pep8 to pycodestyle / pytest-pycodestyle.
* Pin pytest to ``<6.0.0`` to avoid some breaking changes for now.
* Switch integration test environment from Python 3.7 to Python 3.8.

.. _changelog.8_0_2:

8.0.2 (2020-03-03)
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Requirements

**Either Docker in order to run via the** `docker image <http://awslimitchecker.readthedocs.io/en/latest/docker.html>`__, **or:**

* Python 3.5 or newer. Python 2.7 will not be supported as of January 1, 2010.
* Python 3.5 or newer.
* Python `VirtualEnv <http://www.virtualenv.org/>`_ and ``pip`` (recommended installation method; your OS/distribution should have packages for these)
* `boto3 <http://boto3.readthedocs.org/>`_ >= 1.4.6 and its dependency `botocore <https://botocore.readthedocs.io/en/latest/>`_ >= 1.6.0.

Expand Down
6 changes: 3 additions & 3 deletions awslimitchecker/limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,13 @@ def get_current_usage_str(self):
"<unknown>".
If the limit has only one current usage instance, this will be
that instance's :py:meth:`~.AwsLimitUsage.__str__` value.
that instance's ``AwsLimitUsage.__str__`` value.
If the limit has more than one current usage instance, this
will be the a string of the form ``max: X (Y)`` where ``X`` is
the :py:meth:`~.AwsLimitUsage.__str__` value of the instance
the ``AwsLimitUsage.__str__`` value of the instance
with the maximum value, and ``Y`` is a comma-separated list
of the :py:meth:`~.AwsLimitUsage.__str__` values of all usage
of the ``AwsLimitUsage.__str__`` values of all usage
instances in ascending order.
:returns: representation of current usage
Expand Down
6 changes: 4 additions & 2 deletions awslimitchecker/services/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ def _find_usage_dynamodb(self):
gsi_write += gsi['ProvisionedThroughput'][
'WriteCapacityUnits']
table_write_capacity = table.provisioned_throughput[
'WriteCapacityUnits'] + gsi_write
'WriteCapacityUnits'
] + gsi_write
table_read_capacity = table.provisioned_throughput[
'ReadCapacityUnits'] + gsi_read
'ReadCapacityUnits'
] + gsi_read
region_write_capacity += table_write_capacity
region_read_capacity += table_read_capacity

Expand Down
60 changes: 32 additions & 28 deletions awslimitchecker/services/ebs.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,32 +117,36 @@ def _find_usage_ebs(self):
piops,
aws_type='AWS::EC2::Volume'
)
self.limits['Provisioned IOPS (SSD) storage '
'(GiB)']._add_current_usage(
piops_gb,
aws_type='AWS::EC2::Volume'
)
self.limits['General Purpose (SSD) volume storage '
'(GiB)']._add_current_usage(
gp_gb,
aws_type='AWS::EC2::Volume'
)
self.limits['Magnetic volume storage '
'(GiB)']._add_current_usage(
mag_gb,
aws_type='AWS::EC2::Volume'
)
self.limits['Throughput Optimized (HDD) volume storage '
'(GiB)']._add_current_usage(
st_gb,
aws_type='AWS::EC2::Volume'
)
self.limits['Cold (HDD) volume storage '
'(GiB)']._add_current_usage(
sc_gb,
aws_type='AWS::EC2::Volume'
)

self.limits[
'Provisioned IOPS (SSD) storage (GiB)'
]._add_current_usage(
piops_gb,
aws_type='AWS::EC2::Volume'
)
self.limits[
'General Purpose (SSD) volume storage (GiB)'
]._add_current_usage(
gp_gb,
aws_type='AWS::EC2::Volume'
)
self.limits[
'Magnetic volume storage (GiB)'
]._add_current_usage(
mag_gb,
aws_type='AWS::EC2::Volume'
)
self.limits[
'Throughput Optimized (HDD) volume storage (GiB)'
]._add_current_usage(
st_gb,
aws_type='AWS::EC2::Volume'
)
self.limits[
'Cold (HDD) volume storage (GiB)'
]._add_current_usage(
sc_gb,
aws_type='AWS::EC2::Volume'
)
self.limits['Active volumes']._add_current_usage(
vols,
aws_type='AWS::EC2::Volume'
Expand Down Expand Up @@ -262,11 +266,11 @@ def _get_limits_ebs(self):
limits['Active snapshots'] = AwsLimit(
'Active snapshots',
self,
10000,
100000,
self.warning_threshold,
self.critical_threshold,
limit_type='AWS::EC2::VolumeSnapshot',
quotas_name='Number of EBS snapshots'
quotas_name='Snapshots Per Region'
)
limits['Active volumes'] = AwsLimit(
'Active volumes',
Expand Down
13 changes: 7 additions & 6 deletions awslimitchecker/services/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,12 +698,13 @@ def _find_usage_networking_eni_sg(self):
for iface in ints:
if iface.vpc is None:
continue
self.limits['VPC security groups per elastic network '
'interface']._add_current_usage(
len(iface.groups),
aws_type='AWS::EC2::NetworkInterface',
resource_id=iface.id,
)
self.limits[
'VPC security groups per elastic network interface'
]._add_current_usage(
len(iface.groups),
aws_type='AWS::EC2::NetworkInterface',
resource_id=iface.id,
)

def _get_limits_networking(self):
"""
Expand Down
21 changes: 14 additions & 7 deletions awslimitchecker/services/lambdafunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ def find_usage(self):
logger.warn('Skipping Lambda: %s', str(ex))
return
self.limits['Function Count']._add_current_usage(
resp['AccountUsage']['FunctionCount'])
resp['AccountUsage']['FunctionCount']
)
self.limits['Total Code Size (MiB)']._add_current_usage(
int((resp['AccountUsage']['TotalCodeSize'])/1048576))
int((resp['AccountUsage']['TotalCodeSize']) / 1048576)
)
self._have_usage = True

def get_limits(self):
Expand Down Expand Up @@ -98,15 +100,20 @@ def _update_limits_from_api(self):
self.connect()
lims = self.conn.get_account_settings()['AccountLimit']
self.limits['Total Code Size (MiB)']._set_api_limit(
(lims['TotalCodeSize']/1048576))
(lims['TotalCodeSize'] / 1048576)
)
self.limits['Code Size Unzipped (MiB) per Function']._set_api_limit(
(lims['CodeSizeUnzipped']/1048576))
(lims['CodeSizeUnzipped'] / 1048576)
)
self.limits['Unreserved Concurrent Executions']._set_api_limit(
lims['UnreservedConcurrentExecutions'])
lims['UnreservedConcurrentExecutions']
)
self.limits['Concurrent Executions']._set_api_limit(
lims['ConcurrentExecutions'])
lims['ConcurrentExecutions']
)
self.limits['Code Size Zipped (MiB) per Function']._set_api_limit(
(lims['CodeSizeZipped']/1048576))
(lims['CodeSizeZipped'] / 1048576)
)

def _construct_limits(self):
self.limits = {}
Expand Down
11 changes: 9 additions & 2 deletions awslimitchecker/services/ses.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@

from .base import _AwsService
from ..limit import AwsLimit
from botocore.exceptions import EndpointConnectionError
from botocore.exceptions import ClientError
from botocore.exceptions import (
EndpointConnectionError, ClientError, ConnectTimeoutError
)

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -73,6 +74,9 @@ def find_usage(self):
logger.warning('Skipping SES: %s', ex)
return
raise
except ConnectTimeoutError as ex:
logger.warning('Skipping SES: %s', str(ex))
return
self.limits['Daily sending quota']._add_current_usage(
resp['SentLast24Hours']
)
Expand Down Expand Up @@ -117,6 +121,9 @@ def _update_limits_from_api(self):
logger.warning('Skipping SES: %s', ex)
return
raise
except ConnectTimeoutError as ex:
logger.warning('Skipping SES: %s', str(ex))
return
self.limits['Daily sending quota']._set_api_limit(resp['Max24HourSend'])

def required_iam_permissions(self):
Expand Down
24 changes: 0 additions & 24 deletions awslimitchecker/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,9 @@
################################################################################
"""

import sys
import os
import re

from _pytest.terminal import TerminalReporter
import pytest
from awslimitchecker.services import _services
from awslimitchecker.tests.test_integration import REGION

Expand Down Expand Up @@ -108,27 +105,6 @@ def fullwidth(self):
return self._tw.fullwidth


class WholeNodeIDTerminalReporter(TerminalReporter):

def _outrep_summary(self, rep):
sanitizer = OutputSanitizer(self._tw)
rep.toterminal(sanitizer)
for secname, content in rep.sections:
self._tw.sep("-", secname)
if content[-1:] == "\n":
content = content[:-1]
sanitizer.line(content)


@pytest.mark.trylast
def pytest_configure(config):
# Get the standard terminal reporter plugin and replace it with our
standard_reporter = config.pluginmanager.getplugin('terminalreporter')
wholenodeid_reporter = WholeNodeIDTerminalReporter(config, sys.stdout)
config.pluginmanager.unregister(standard_reporter)
config.pluginmanager.register(wholenodeid_reporter, 'terminalreporter')


def pytest_generate_tests(metafunc):
if (
metafunc.cls.__name__ == 'Test_AwsServiceSubclasses' and
Expand Down
Loading

0 comments on commit a6eef26

Please sign in to comment.