From e1ee1beb9c312fd3617f58783a5d85b00b945558 Mon Sep 17 00:00:00 2001 From: Sumanth Lingappa Date: Tue, 26 Sep 2023 16:02:51 +0530 Subject: [PATCH] fixed few linting errors Signed-off-by: Sumanth Lingappa --- .gitignore | 7 ++++++- Makefile | 32 +++++++++++++++++++++++++++++++- galaxy.yml | 2 +- plugins/module_utils/client.py | 4 ++-- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 028a8ed1d..4d711be30 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ .vscode/ tools/ +issues/ + +plugins/module_utils/test.ipynb *.pyc __pycache__/ @@ -11,5 +14,7 @@ _built_docs* # collection package **/netscaler-adc-*.tar.gz +examples/*.out + TODO.md -Dockerfile \ No newline at end of file +Dockerfile diff --git a/Makefile b/Makefile index b75bc4d0f..4bca566ed 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,20 @@ fmt: isort plugins/module_utils/*.py isort tools/module_generator.py +fmt_tools: + # ignore if file not found + -autoflake tools/generated_modules/*.py + -autoflake tools/module_generator.py + -autoflake tools/nitro_resource_map.py + + -black tools/generated_modules/*.py + -black tools/module_generator.py + -black tools/nitro_resource_map.py + + -isort tools/generated_modules/*.py + -isort tools/module_generator.py + -isort tools/nitro_resource_map.py + generate_modules: python3 tools/module_generator.py @@ -26,4 +40,20 @@ lint: install # cd _built_docs # pip3 install -r requirements.txt # ./build.sh -# rsync -cprv --delete-after _built_docs/rst/ docs/ +# cd .. +# rsync -cprv _built_docs/build/html/ docs/ # Do not use --delete-after as this will delete .nojekyll file + + +# Run examples/*.yaml playbooks individually +# ansible-playbook -i examples/inventory examples/playbook.yaml +# Run the playbook. if the return code is non-zero, save the output to a file +# skip the playbook which contains "password" in the file name +run_examples: + @for playbook in examples/*.yaml; do \ + if [[ $$playbook == *"password"* ]]; then \ + continue; \ + fi; \ + echo "Running $$playbook"; \ + ansible-playbook -i examples/inventory.ini $$playbook || \ + ansible-playbook -i examples/inventory.ini $$playbook -vvv > $$playbook.out; \ + done diff --git a/galaxy.yml b/galaxy.yml index 41e41c703..33f6b10a0 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -8,7 +8,7 @@ namespace: netscaler name: adc # The version of the collection. Must be compatible with semantic versioning -version: 2.0.0-alpha +version: 2.0.0 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/plugins/module_utils/client.py b/plugins/module_utils/client.py index 87dcf0c6b..f45cc4d2c 100644 --- a/plugins/module_utils/client.py +++ b/plugins/module_utils/client.py @@ -154,7 +154,7 @@ def send(self, method, url, data=None): if "body" in info: try: return status_code, json.loads(to_text(info["body"])) - except json.decoder.JSONDecodeError: + except json.decoder.JSONDecodeError as e: log("ERROR: json.decoder.JSONDecodeError: %s" % e) log("DEBUG: info['body'] = %s" % info["body"]) log("DEBUG: Traceback = %s" % traceback.format_exc()) @@ -164,7 +164,7 @@ def send(self, method, url, data=None): else: try: return status_code, json.loads(to_text(body)) - except json.decoder.JSONDecodeError: + except json.decoder.JSONDecodeError as e: log("ERROR: json.decoder.JSONDecodeError: %s" % e) log("DEBUG: info['body'] = %s" % info["body"]) log("DEBUG: Traceback = %s" % traceback.format_exc())