Skip to content
Commits on Source (2)
......@@ -6,7 +6,7 @@ include:
file: templates/python.yml
variables:
SKIP_PYPI_UPLOAD: !!str true
SKIP_PYPI_UPLOAD: 'true'
build-wheel:
extends: .python3-build
......@@ -88,7 +88,7 @@ release:
image: registry.gitlab.com/gitlab-org/release-cli:latest
tags: [host01.shore.co.il]
script:
- !!str true
- 'true'
only:
- tags
needs:
......
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.0.1
hooks:
- id: check-executables-have-shebangs
- id: check-added-large-files
- id: check-merge-conflict
- id: check-toml
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
exclude: \.diff$
- repo: https://github.com/Yelp/detect-secrets
- repo: https://github.com/codespell-project/codespell.git
rev: v2.1.0
hooks:
- id: codespell
- repo: https://github.com/Yelp/detect-secrets.git
rev: v1.1.0
hooks:
- id: detect-secrets
- repo: https://github.com/codespell-project/codespell.git
rev: v2.1.0
- repo: https://gitlab.com/devopshq/gitlab-ci-linter.git
rev: v1.0.2
hooks:
- id: codespell
- id: gitlab-ci-linter
args:
- "--server"
- https://git.shore.co.il
- repo: https://github.com/adrienverge/yamllint
rev: v1.26.1
- repo: https://git.shore.co.il/nimrod/yamltool.git
rev: v0.1.2
hooks:
- id: yamltool
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.26.3
hooks:
- id: yamllint
- repo: https://github.com/ambv/black
rev: 21.6b0
- repo: https://git.shore.co.il/nimrod/pre-commit-hooks.git
rev: v0.2.0
hooks:
- id: black
args:
- |
--line-length=79
- id: poetry-check
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup.git
rev: v1.0.1
hooks:
- id: rst-linter
- repo: https://github.com/myint/rstcheck.git
rev: 3f92957478422df87bd730abde66f089cc1ee19b # pragma: allowlist secret
rev: master
hooks:
- id: rstcheck
- repo: https://github.com/PyCQA/prospector
rev: 1.3.1
- repo: https://github.com/ambv/black.git
rev: 21.10b0
hooks:
- id: black
args:
- |
--line-length=79
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
args: ["--filter-files", "--profile", "black"]
- repo: https://github.com/PyCQA/prospector.git
rev: 1.6.0
hooks:
- id: prospector
args:
......@@ -67,7 +94,7 @@ repos:
additional_dependencies:
- bandit
- pyroma
exclude: ^tests/.*
exclude: tests
- repo: https://gitlab.com/pycqa/flake8.git
rev: 3.9.2
......@@ -79,36 +106,7 @@ repos:
additional_dependencies:
- flake8-bugbear
- repo: https://gitlab.com/devopshq/gitlab-ci-linter
rev: v1.0.3
hooks:
- id: gitlab-ci-linter
args:
- "--server"
- https://git.shore.co.il
- repo: https://github.com/timothycrosley/isort
rev: 5.9.1
hooks:
- id: isort
additional_dependencies:
- toml
- repo: https://github.com/asottile/pyupgrade
rev: v2.23.2
hooks:
- id: pyupgrade
- repo: local
hooks:
- id: poetry check
name: poetry check
language: system
entry: poetry
args: [check]
description: Checks pyproject.toml
always_run: true
pass_filenames: false
types: [toml]
files: pyproject\.toml
......@@ -104,7 +104,7 @@ def main(): # noqa: MC0001
check.run(args.timeout)
except Exception as ex: # pylint: disable=broad-except
if args.errors and not args.dry_run:
notify(f"[HOSTNAME] Check {args.command} failed: {ex}.")
notify(f"[{HOSTNAME}] Check {args.command} failed: {ex}.")
parser.error(str(ex))
if check.ExitCode == nagios.NagiosCode.OK:
......@@ -126,7 +126,7 @@ def main(): # noqa: MC0001
f"Check status is invalid for a Nagios plugin ({check.ExitCode})."
)
if args.errors:
notify(f"[HOSTNAME] Check {args.command} status is invalid.")
notify(f"[{HOSTNAME}] Check {args.command} status is invalid.")
if args.chain:
print(check._stdout) # pylint: disable=protected-access
......
......@@ -158,10 +158,10 @@ class Check:
timeout=timeout,
universal_newlines=True,
)
except FileNotFoundError:
raise RuntimeError(f"Command {self.Command} not found.")
except subprocess.TimeoutExpired:
raise RuntimeError("Timeout exceeded.")
except FileNotFoundError as ex:
raise RuntimeError(f"Command {self.Command} not found.") from ex
except subprocess.TimeoutExpired as ex:
raise RuntimeError("Timeout exceeded.") from ex
self.ExitCode = proc.returncode
logging.info(f"Exit code is {self.ExitCode}.")
self._stdout = proc.stdout
......