diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index c86e434b..ac7dc4c6 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -13,7 +13,7 @@ jobs: auto-merge: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ahmadnassri/action-dependabot-auto-merge@v2.6 if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' with: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6d4a2ea7..9886d498 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # We must fetch at least the immediate parents so that if this is # a pull request then we can checkout the head. @@ -44,14 +44,14 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -65,4 +65,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index 1678fc5f..1f0943b8 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -12,7 +12,7 @@ jobs: greeting: runs-on: ubuntu-latest steps: - - uses: actions/first-interaction@v1.1.1 + - uses: actions/first-interaction@v1.3.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} issue-message: 'Thank you for raising this issue' diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index f28bab7b..18de9f48 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -15,14 +15,14 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-python@v5 + - uses: actions/setup-go@v5 with: go-version: '>=1.18' - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/.cache/pre-commit @@ -30,6 +30,6 @@ jobs: restore-keys: | ${{ runner.os }}-precommit- - - uses: pre-commit/action@v3.0.0 + - uses: pre-commit/action@v3.0.1 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 0041aab3..9b74415f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -23,13 +23,13 @@ jobs: python-version: [3.x] # No longer compatible , 2.x] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }} @@ -55,7 +55,7 @@ jobs: pytest --cov-report=xml --cov=risuclient --cov=maguiclient - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3.1.4 + uses: codecov/codecov-action@v4.5.0 with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.xml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 60b25e98..75f5c544 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -19,9 +19,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies @@ -43,7 +43,7 @@ jobs: RELEASE_VERSION: ${{ steps.branch_name.outputs.SOURCE_TAG }} - name: Publish distribution to PyPI - uses: pypa/gh-action-pypi-publish@v1.8.10 + uses: pypa/gh-action-pypi-publish@v1.9.0 with: user: __token__ password: ${{ secrets.PYPI_PASSWORD }} diff --git a/.github/workflows/refresh-authors.yml b/.github/workflows/refresh-authors.yml index f35b7a9c..e8891431 100644 --- a/.github/workflows/refresh-authors.yml +++ b/.github/workflows/refresh-authors.yml @@ -18,13 +18,13 @@ jobs: runs-on: ubuntu-latest # windows-latest | macos-latest name: Test changed-files steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. - name: Get changed files in the checks folder id: changed-files-specific - uses: tj-actions/changed-files@v38 + uses: tj-actions/changed-files@v44 with: files: | **/*.py @@ -46,7 +46,7 @@ jobs: - name: Commit back the updated files to the repository if: steps.changed-files-specific.outputs.any_changed == 'true' - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@v5 with: # Optional. Commit message for the created commit. # Defaults to "Apply automatic changes" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d17e041e..86067648 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,10 +20,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - - uses: actions/cache@v3 + uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - uses: actions/cache@v4 with: path: | ~/.cache/pre-commit @@ -31,14 +30,14 @@ jobs: restore-keys: | ${{ runner.os }}-precommit- - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: ">=1.18" @@ -49,11 +48,15 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi + - uses: actions/setup-node@v4 + with: + node-version: '14' + - name: Semantic Release - uses: cycjimmy/semantic-release-action@v3 + uses: cycjimmy/semantic-release-action@v4 id: semantic with: - semantic_version: 19.0.5 + semantic_version: 18.0.0 extra_plugins: | @semantic-release/git @semantic-release/changelog diff --git a/.github/workflows/shiftleft-analysis.yml b/.github/workflows/shiftleft-analysis.yml index 445e9a71..bfacc1fc 100644 --- a/.github/workflows/shiftleft-analysis.yml +++ b/.github/workflows/shiftleft-analysis.yml @@ -17,7 +17,7 @@ jobs: # Scan runs on ubuntu, mac and windows runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Instructions # 1. Setup JDK, Node.js, Python etc depending on your project type # 2. Compile or build the project before invoking scan @@ -37,6 +37,6 @@ jobs: # type: python - name: Upload report - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: reports diff --git a/.github/workflows/size.yaml b/.github/workflows/size.yaml index 3f77516a..a962dad0 100644 --- a/.github/workflows/size.yaml +++ b/.github/workflows/size.yaml @@ -9,7 +9,7 @@ jobs: update_labels: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions-ecosystem/action-size@v2 id: size diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 997697ec..fe2a5d5c 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -13,7 +13,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v8 + - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed diff --git a/.github/workflows/update_semver.yml b/.github/workflows/update_semver.yml index 617692de..11c35eaa 100644 --- a/.github/workflows/update_semver.yml +++ b/.github/workflows/update_semver.yml @@ -18,7 +18,7 @@ jobs: update-semver: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: haya14busa/action-update-semver@v1.2.1 with: major_version_tag_only: false # (optional, default is "false") diff --git a/.isort.cfg b/.isort.cfg index e5b69282..e0679482 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -4,4 +4,4 @@ include_trailing_comma=True force_grid_wrap=0 use_parentheses=True line_length=88 -known_third_party = pytest,setuptools +known_third_party = imp,pytest,setuptools diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8cb7a45f..ae23aa08 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: stages: - commit-msg repo: https://github.com/commitizen-tools/commitizen - rev: 3.6.0 + rev: v3.29.0 - hooks: - id: check-useless-excludes repo: meta @@ -14,7 +14,7 @@ repos: - files: \.(css|js|md|markdown|json) id: prettier repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.2 + rev: v4.0.0-alpha.8 - hooks: - id: seed-isort-config repo: https://github.com/asottile/seed-isort-config @@ -26,7 +26,7 @@ repos: - hooks: - id: black repo: https://github.com/python/black - rev: 23.7.0 + rev: 24.8.0 - hooks: - id: check-added-large-files - id: check-ast @@ -55,13 +55,13 @@ repos: - id: check-byte-order-marker - id: check-docstring-first repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.6.0 - hooks: - id: flake8 repo: https://github.com/pycqa/flake8 - rev: 6.1.0 + rev: 7.1.1 - repo: https://github.com/scop/pre-commit-shfmt - rev: v3.7.0-1 + rev: v3.8.0-1 hooks: # Choose one of: - id: shfmt # native (requires/installs Go to build) @@ -76,7 +76,7 @@ repos: - hooks: - id: blacken-docs repo: https://github.com/asottile/blacken-docs - rev: 1.16.0 + rev: 1.18.0 # - repo: https://github.com/asottile/pyupgrade # rev: v2.38.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 2aba9e87..24926048 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [1.14.3](https://github.com/risuorg/risu/compare/1.14.2...1.14.3) (2023-09-04) + +### Bug Fixes + +- move egrep -> grep -E ([fcdab4d](https://github.com/risuorg/risu/commit/fcdab4de5afb2c11e8f37a174ff2e04ac078860f)) + ## [1.14.2](https://github.com/risuorg/risu/compare/1.14.1...1.14.2) (2023-02-15) ### Bug Fixes diff --git a/requirements.txt b/requirements.txt index f2293605..509c2c0b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,3 @@ requests +urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability +zombie-imp diff --git a/risuclient/plugins/core/informative/linux16.sh b/risuclient/plugins/core/informative/linux16.sh new file mode 100755 index 00000000..ba5c7c4d --- /dev/null +++ b/risuclient/plugins/core/informative/linux16.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Copyright (C) 2024 Pablo Iranzo Gómez + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# long_name: Detects if system is using linux16 and/or initd16 instead of regular descriptions +# description: Reports if system is using linux16 or initrd16 +# priority: 100 +# kb: + +# Load common functions +[[ -f "${RISU_BASE}/common-functions.sh" ]] && . "${RISU_BASE}/common-functions.sh" + +MYFILE="${RISU_ROOT}/etc/grub2.cfg" + +is_required_file ${MYFILE} + +RC=${RC_OKAY} + +if is_lineinfile ^linux16.* ${MYFILE}; then + RC=${RC_INFO} + echo "linux16 entry detected in ${MYFILE}" >&2 +fi +if is_lineinfile ^initrd16.* ${MYFILE}; then + RC=${RC_INFO} + echo "initrd16 entry detected in ${MYFILE}" >&2 +fi +exit ${RC} diff --git a/risuclient/plugins/core/network/interface-errors.sh b/risuclient/plugins/core/network/interface-errors.sh index 80ef20f3..a412facc 100755 --- a/risuclient/plugins/core/network/interface-errors.sh +++ b/risuclient/plugins/core/network/interface-errors.sh @@ -38,7 +38,7 @@ IFACES_IN_SYSTEM=$(grep -i "state UP" ${IP_ADDRESS_FILE} | cut -f2 -d ":" | tr - # Check all interfaces for iface in ${IFACES_IN_SYSTEM}; do - IFACEPATH=$(find ${RISU_ROOT}/sys | grep net | grep ${iface} | grep errors) + IFACEPATH=$(find ${RISU_ROOT}/sys | grep net | grep ${iface} | grep -E 'errors|dropped|carrier_changes') for file in ${IFACEPATH}; do CONTENT=$(cat ${file}) diff --git a/risuclient/shell.py b/risuclient/shell.py index c29cce3d..2c263750 100755 --- a/risuclient/shell.py +++ b/risuclient/shell.py @@ -4,9 +4,12 @@ # Description: Runs set of scripts against system or snapshot to # detect common pitfalls in configuration/status # +# Copyright (C) 2024 # Copyright (C) 2017, 2018 Robin Černín # Copyright (C) 2017 Lars Kellogg-Stedman -# Copyright (C) 2017-2023 Pablo Iranzo Gómez +# Copyright (C) 2024 +# Copyright (C) 2017-2024 Pablo Iranzo Gómez +# Copyright (C) 2024 # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,13 +31,14 @@ import datetime import gettext import hashlib -import imp import json import logging import os import re import tempfile +import imp + # Do not require everyone to use requests try: import requests diff --git a/test-requirements.txt b/test-requirements.txt index 4b3108a9..a9930ba3 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,5 +6,7 @@ pytest>=3.2.0 # MIT pytest-cov>=2.5.1 # MIT PyYAML requests -setuptools>=30 +setuptools>=70.0.0 tox +urllib3>=2.2.2 # not directly required, pinned by Snyk to avoid a vulnerability +zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability