Merge pull request #141518 from zakame/contrib/awslimitchecker
This commit is contained in:
commit
8267af946d
3 changed files with 95 additions and 0 deletions
58
pkgs/tools/admin/awslimitchecker/default.nix
Normal file
58
pkgs/tools/admin/awslimitchecker/default.nix
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
{ lib, python3Packages, fetchFromGitHub }:
|
||||||
|
|
||||||
|
python3Packages.buildPythonApplication rec {
|
||||||
|
pname = "awslimitchecker";
|
||||||
|
version = "12.0.0";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "jantman";
|
||||||
|
repo = "awslimitchecker";
|
||||||
|
rev = version;
|
||||||
|
sha256 = "1p6n4kziyl6sfq7vgga9v88ddwh3sgnfb1m1cx6q25n0wyl7phgv";
|
||||||
|
};
|
||||||
|
|
||||||
|
propagatedBuildInputs = with python3Packages; [
|
||||||
|
boto3
|
||||||
|
botocore
|
||||||
|
pytz
|
||||||
|
termcolor
|
||||||
|
versionfinder
|
||||||
|
];
|
||||||
|
|
||||||
|
checkInputs = with python3Packages; [
|
||||||
|
freezegun
|
||||||
|
onetimepass
|
||||||
|
pytestCheckHook
|
||||||
|
pyotp
|
||||||
|
testfixtures
|
||||||
|
];
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
# Fix the version lookup to use only the hardcoded version in the source package
|
||||||
|
./version.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
pytestFlagsArray = [
|
||||||
|
"awslimitchecker/tests"
|
||||||
|
];
|
||||||
|
|
||||||
|
disabledTestPaths = [
|
||||||
|
# AWS tests that use the network
|
||||||
|
"awslimitchecker/tests/services"
|
||||||
|
"awslimitchecker/tests/test_checker.py"
|
||||||
|
"awslimitchecker/tests/test_runner.py"
|
||||||
|
|
||||||
|
# the version lookup tests as patched above
|
||||||
|
"awslimitchecker/tests/test_version.py"
|
||||||
|
];
|
||||||
|
|
||||||
|
pythonImportsCheck = [ "awslimitchecker.checker" ];
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
homepage = "http://awslimitchecker.readthedocs.org";
|
||||||
|
changelog = "https://github.com/jantman/awslimitchecker/blob/${version}/CHANGES.rst";
|
||||||
|
description = "A script and python package to check your AWS service limits and usage via boto3";
|
||||||
|
license = licenses.agpl3Plus;
|
||||||
|
maintainers = with maintainers; [ zakame ];
|
||||||
|
};
|
||||||
|
}
|
35
pkgs/tools/admin/awslimitchecker/version.patch
Normal file
35
pkgs/tools/admin/awslimitchecker/version.patch
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
--- a/awslimitchecker/version.py
|
||||||
|
+++ b/awslimitchecker/version.py
|
||||||
|
@@ -111,32 +106,5 @@ def _get_version_info():
|
||||||
|
:returns: awslimitchecker version
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
- if os.environ.get('VERSIONCHECK_DEBUG', '') != 'true':
|
||||||
|
- for lname in ['versionfinder', 'pip', 'git']:
|
||||||
|
- l = logging.getLogger(lname)
|
||||||
|
- l.setLevel(logging.CRITICAL)
|
||||||
|
- l.propagate = True
|
||||||
|
- try:
|
||||||
|
- vinfo = find_version('awslimitchecker')
|
||||||
|
- dirty = ''
|
||||||
|
- if vinfo.git_is_dirty:
|
||||||
|
- dirty = '*'
|
||||||
|
- tag = vinfo.git_tag
|
||||||
|
- if tag is not None:
|
||||||
|
- tag += dirty
|
||||||
|
- commit = vinfo.git_commit
|
||||||
|
- if commit is not None:
|
||||||
|
- if len(commit) > 7:
|
||||||
|
- commit = commit[:8]
|
||||||
|
- commit += dirty
|
||||||
|
- return AWSLimitCheckerVersion(
|
||||||
|
- vinfo.version,
|
||||||
|
- vinfo.url,
|
||||||
|
- tag=tag,
|
||||||
|
- commit=commit
|
||||||
|
- )
|
||||||
|
- except Exception:
|
||||||
|
- logger.exception("Error checking installed version; this installation "
|
||||||
|
- "may not be in compliance with the AGPLv3 license:")
|
||||||
|
# fall back to returning just the hard-coded release information
|
||||||
|
return AWSLimitCheckerVersion(_VERSION, _PROJECT_URL)
|
|
@ -1343,6 +1343,8 @@ with pkgs;
|
||||||
|
|
||||||
awsebcli = callPackage ../tools/virtualization/awsebcli {};
|
awsebcli = callPackage ../tools/virtualization/awsebcli {};
|
||||||
|
|
||||||
|
awslimitchecker = callPackage ../tools/admin/awslimitchecker { };
|
||||||
|
|
||||||
awslogs = callPackage ../tools/admin/awslogs { };
|
awslogs = callPackage ../tools/admin/awslogs { };
|
||||||
|
|
||||||
aws-lambda-rie = callPackage ../tools/admin/aws-lambda-runtime-interface-emulator { };
|
aws-lambda-rie = callPackage ../tools/admin/aws-lambda-runtime-interface-emulator { };
|
||||||
|
|
Loading…
Reference in a new issue