feat: add throttle option to corenetworks_dns module
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Robert Kaussow 2021-02-19 13:38:30 +01:00
parent 742aed260a
commit c024883a2b
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
6 changed files with 30 additions and 10 deletions

View File

@ -83,6 +83,15 @@ local PipelineBuild = {
'cd dist/ && sha256sum * > ../sha256sum.txt', 'cd dist/ && sha256sum * > ../sha256sum.txt',
], ],
}, },
{
name: 'changelog',
image: 'thegeeklab/git-chglog',
commands: [
'git fetch -tq',
'git-chglog --no-color --no-emoji ${DRONE_TAG:---next-tag unreleased unreleased}',
'git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}',
],
},
{ {
name: 'publish-gitea', name: 'publish-gitea',
image: 'plugins/gitea-release', image: 'plugins/gitea-release',

View File

@ -103,6 +103,13 @@ steps:
commands: commands:
- cd dist/ && sha256sum * > ../sha256sum.txt - cd dist/ && sha256sum * > ../sha256sum.txt
- name: changelog
image: thegeeklab/git-chglog
commands:
- git fetch -tq
- git-chglog --no-color --no-emoji ${DRONE_TAG:---next-tag unreleased unreleased}
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}
- name: publish-gitea - name: publish-gitea
image: plugins/gitea-release image: plugins/gitea-release
settings: settings:
@ -192,6 +199,6 @@ depends_on:
--- ---
kind: signature kind: signature
hmac: 183bee0f94387357e4cb3c1f4c38c47e0b12318e3ed0cbde2637c36dea06e38e hmac: ccd6854d77f9c42527ab5ca2b8337c8ee904fc917b9b229e2761352f578b35e6
... ...

1
.gitignore vendored
View File

@ -107,3 +107,4 @@ docs/themes/
docs/public/ docs/public/
resources/_gen/ resources/_gen/
CHANGELOG.md

View File

@ -1,6 +0,0 @@
- BUGFIX
- fix typos
- add missing defaults for parameters
- ENHANCEMENT
- add parameter `verify_ssl` (default: true)
- add parameter `auth_timeout` (default: 5)

View File

@ -61,6 +61,11 @@ options:
- Only use with C(state=present). - Only use with C(state=present).
- This will delete all other records with the same record name and type. - This will delete all other records with the same record name and type.
type: bool type: bool
throttle:
description:
- Throttle API calls in seconds.
default: 2
type: int
state: state:
description: description:
- whether the record should exist or not - whether the record should exist or not
@ -111,6 +116,7 @@ EXAMPLES = """
RETURN = r"""# """ RETURN = r"""# """
import copy import copy
import time
import traceback import traceback
CORENETWORKS_IMP_ERR = None CORENETWORKS_IMP_ERR = None
@ -206,6 +212,7 @@ def main():
ttl = module.params.get("ttl") ttl = module.params.get("ttl")
value = module.params.get("value") value = module.params.get("value")
state = module.params.get("state") state = module.params.get("state")
throttle = module.params.get("throttle")
is_solo = module.params.get("solo") is_solo = module.params.get("solo")
params = {"name": record, "ttl": ttl} params = {"name": record, "ttl": ttl}
@ -227,7 +234,9 @@ def main():
# perform actions # perform actions
try: try:
# request throtteling to workaround the current rate limit # request throttling to workaround the rate limit
time.sleep(throttle)
changed = False changed = False
if api_token: if api_token:
client = CoreNetworks(api_token=api_token, auto_commit=True) client = CoreNetworks(api_token=api_token, auto_commit=True)

View File

@ -4,7 +4,7 @@ known_first_party = ansiblelater
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
force_single_line = true force_single_line = true
line_length = 99 line_length = 99
skip_glob = **/.env*,**/env/*,**/docs/*,**/inventory/*,**/modules/* skip_glob = **/.venv*,**/venv/*,**/docs/*,**/inventory/*,**/modules/*
[yapf] [yapf]
based_on_style = google based_on_style = google
@ -22,4 +22,4 @@ filterwarnings =
[coverage:run] [coverage:run]
omit = omit =
**/test/* **/test/*
**/.env/* **/.venv/*