diff --git a/.copier-answers.yml b/.copier-answers.yml
new file mode 100644
index 00000000..d5274ba8
--- /dev/null
+++ b/.copier-answers.yml
@@ -0,0 +1,23 @@
+# Autogenerated. Do not edit this by hand, use `copier update`.
+---
+_commit: 0.2.6
+_src_path: https://github.com/lkubb/salt-extension-copier
+author: EITR Technologies, LLC
+author_email: devops@eitr.tech
+docs_url: ''
+license: apache
+loaders:
+ - module
+ - returner
+ - runner
+max_salt_version: 3006
+no_saltext_namespace: false
+package_name: mattermost
+project_name: mattermost
+python_requires: '3.8'
+salt_version: '3005'
+source_url: https://github.com/salt-extensions/saltext-mattermost
+ssh_fixtures: false
+summary: Salt Extension for interacting with Mattermost
+tracker_url: https://github.com/salt-extensions/saltext-mattermost/issues
+url: https://github.com/salt-extensions/saltext-mattermost
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 00000000..879568ea
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,11 @@
+### Description of Issue
+
+
+### Setup
+(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)
+
+### Steps to Reproduce Issue
+(Include debug logs if possible and relevant.)
+
+### Versions Report
+(Provided by running `salt --versions-report`. Please also mention any differences in master/minion versions.)
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 00000000..b232a42e
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,48 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: "[BUG]"
+labels: bug, needs-triage
+assignees: ''
+
+---
+
+**Description**
+A clear and concise description of what the bug is.
+
+**Setup**
+(Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
+
+Please be as specific as possible and give set-up details.
+
+- [ ] on-prem machine
+- [ ] VM (Virtualbox, KVM, etc. please specify)
+- [ ] VM running on a cloud service, please be explicit and add details
+- [ ] container (Kubernetes, Docker, containerd, etc. please specify)
+- [ ] or a combination, please be explicit
+- [ ] jails if it is FreeBSD
+- [ ] classic packaging
+- [ ] onedir packaging
+- [ ] used bootstrap to install
+
+
+**Steps to Reproduce the behavior**
+(Include debug logs if possible and relevant)
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Versions Report**
+salt --versions-report
+(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
+
+```yaml
+PASTE HERE
+```
+
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 00000000..4cf0d285
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,14 @@
+blank_issues_enabled: true
+contact_links:
+ - name: Salt Community Slack
+ url: https://saltstackcommunity.slack.com/
+ about: Please ask and answer questions here.
+ - name: Salt-Users Forum
+ url: https://groups.google.com/forum/#!forum/salt-users
+ about: Please ask and answer questions here.
+ - name: Salt on LiberaChat
+ url: https://web.libera.chat/#salt
+ about: Please ask and answer questions here.
+ - name: Security vulnerabilities
+ email: saltproject-security.pdl@broadcom.com
+ about: Please report security vulnerabilities here.
diff --git a/.github/ISSUE_TEMPLATE/docs.md b/.github/ISSUE_TEMPLATE/docs.md
new file mode 100644
index 00000000..59af749e
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/docs.md
@@ -0,0 +1,23 @@
+---
+name: Docs
+about: Issue related to Salt Documentation
+title: "[DOCS]"
+labels: documentation, needs-triage
+assignees: ''
+
+---
+
+**Description**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Suggested Fix**
+What did you expect to see in the documentation that is missing or needs updating?
+
+**Type of documentation**
+This could be module documentation or a guide.
+
+**Location or format of documentation**
+Insert page URL if applicable.
+
+**Additional context**
+Add any other context or screenshots here.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 00000000..0e0a390d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: "[FEATURE REQUEST]"
+labels: feature, needs-triage
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/.github/ISSUE_TEMPLATE/tech-debt.md b/.github/ISSUE_TEMPLATE/tech-debt.md
new file mode 100644
index 00000000..5a546c67
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/tech-debt.md
@@ -0,0 +1,13 @@
+---
+name: Tech Debt
+about: Issue is related to tech debt. This includes compatibility changes for newer versions of software and OSes that salt interacts with.
+title: "[TECH DEBT]"
+labels: tech-debt
+assignees: ''
+
+---
+
+### Description of the tech debt to be addressed, include links and screenshots
+
+### Versions Report
+(Provided by running `salt --versions-report`. Please also mention any differences in master/minion versions.)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 00000000..7d63a7c6
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,24 @@
+### What does this PR do?
+
+### What issues does this PR fix or reference?
+Fixes:
+
+### Previous Behavior
+Remove this section if not relevant
+
+### New Behavior
+Remove this section if not relevant
+
+### Merge requirements satisfied?
+**[NOTICE] Bug fixes or features added to Salt require tests.**
+
+- [ ] Docs
+- [ ] Changelog - https://docs.saltproject.io/en/master/topics/development/changelog.html
+- [ ] Tests written/updated
+
+### Commits signed with GPG?
+Yes/No
+
+Please review [Salt's Contributing Guide](https://docs.saltproject.io/en/master/topics/development/contributing.html) for best practices.
+
+See GitHub's [page on GPG signing](https://help.github.com/articles/signing-commits-using-gpg/) for more information about signing commits with GPG.
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
new file mode 100644
index 00000000..c612d7a8
--- /dev/null
+++ b/.github/workflows/pr.yml
@@ -0,0 +1,11 @@
+name: Pull Request or Push
+
+on: [push, pull_request]
+
+jobs:
+ ci:
+ name: CI
+ uses: salt-extensions/central-artifacts/.github/workflows/ci.yml@main
+ permissions:
+ contents: write
+ pull-requests: read
diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml
new file mode 100644
index 00000000..9f86b4e7
--- /dev/null
+++ b/.github/workflows/tag.yml
@@ -0,0 +1,26 @@
+name: Tagged Releases
+
+on:
+ push:
+ tags:
+ - "v*"
+
+jobs:
+ ci:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Extract tag name
+ id: get_version
+ run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/v})" >> $GITHUB_ENV
+
+ - name: CI
+ uses: salt-extensions/central-artifacts/.github/workflows/ci.yml@main
+ with:
+ release: true
+ version: ${{ env.VERSION }}
+ permissions:
+ contents: write
+ pull-requests: read
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
deleted file mode 100644
index 6e535cb6..00000000
--- a/.github/workflows/test.yml
+++ /dev/null
@@ -1,417 +0,0 @@
-
-name: Testing
-
-on: [push, pull_request]
-
-jobs:
- Pre-Commit:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - name: Set up Python
- uses: actions/setup-python@v1
- with:
- python-version: 3.7
- - name: Set Cache Key
- run: echo "PY=$(python --version --version | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- - name: Install System Deps
- run: |
- sudo apt-get update
- sudo apt-get install -y libxml2 libxml2-dev libxslt-dev
- - uses: actions/cache@v1
- with:
- path: ~/.cache/pre-commit
- key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- - uses: pre-commit/action@v1.0.1
-
- Docs:
- runs-on: ubuntu-latest
- needs: Pre-Commit
-
- timeout-minutes: 10
-
- steps:
- - uses: actions/checkout@v2
-
- - name: Set up Python 3.7 For Nox
- uses: actions/setup-python@v1
- with:
- python-version: 3.7
-
- - name: Install Nox
- run: |
- python -m pip install --upgrade pip
- pip install nox
-
- - name: Install Doc Requirements
- run: |
- nox --force-color -e docs --install-only
-
- - name: Build Docs
- env:
- SKIP_REQUIREMENTS_INSTALL: YES
- run: |
- nox --force-color -e docs
-
- Linux:
- runs-on: ubuntu-latest
- needs: Pre-Commit
-
- timeout-minutes: 15
-
- strategy:
- fail-fast: false
- max-parallel: 4
- matrix:
- python-version:
- - 3.6
- - 3.7
- - 3.8
- salt-version:
- - 3003
-
- steps:
- - uses: actions/checkout@v2
-
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v1
- with:
- python-version: ${{ matrix.python-version }}
-
- - name: Install Nox
- run: |
- python -m pip install --upgrade pip
- pip install nox
-
- - name: Install Test Requirements
- env:
- SALT_REQUIREMENT: salt==${{ matrix.salt-version }}
- run: |
- nox --force-color -e tests-3 --install-only
-
- - name: Test
- env:
- SALT_REQUIREMENT: salt==${{ matrix.salt-version }}
- SKIP_REQUIREMENTS_INSTALL: YES
- run: |
- nox --force-color -e tests-3 -- -vv tests/
-
- - name: Create CodeCov Flags
- if: always()
- id: codecov-flags
- run: |
- echo ::set-output name=flags::$(python -c "import sys; print('{},{},salt_{}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info), '_'.join(str(v) for v in '${{ matrix.salt-version }}'.replace('==', '_').split('.'))))")
-
- - name: Upload Project Code Coverage
- if: always()
- shell: bash
- env:
- CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},project
- REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-project
- REPORT_PATH: artifacts/coverage-project.xml
- run: |
- if [ ! -f codecov.sh ]; then
- n=0
- until [ "$n" -ge 5 ]
- do
- if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then
- break
- fi
- n=$((n+1))
- sleep 15
- done
- fi
- if [ -f codecov.sh ]; then
- n=0
- until [ "$n" -ge 5 ]
- do
- if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
- break
- fi
- n=$((n+1))
- sleep 15
- done
- fi
-
- - name: Upload Tests Code Coverage
- if: always()
- shell: bash
- env:
- CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests
- REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-tests
- REPORT_PATH: artifacts/coverage-tests.xml
- run: |
- if [ ! -f codecov.sh ]; then
- n=0
- until [ "$n" -ge 5 ]
- do
- if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then
- break
- fi
- n=$((n+1))
- sleep 15
- done
- fi
- if [ -f codecov.sh ]; then
- n=0
- until [ "$n" -ge 5 ]
- do
- if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
- break
- fi
- n=$((n+1))
- sleep 15
- done
- fi
-
- - name: Upload Logs
- if: always()
- uses: actions/upload-artifact@main
- with:
- name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}.log
- path: artifacts/runtests-*.log
-
- Windows:
- runs-on: windows-latest
- needs: Pre-Commit
-
- timeout-minutes: 40
-
- strategy:
- fail-fast: false
- max-parallel: 3
- matrix:
- python-version:
- - 3.6
- - 3.7
- salt-version:
- - 3003
-
- steps:
- - uses: actions/checkout@v2
-
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v1
- with:
- python-version: ${{ matrix.python-version }}
-
- - name: Install Nox
- run: |
- python -m pip install --upgrade pip
- pip install nox
-
- - name: Install Test Requirements
- shell: bash
- env:
- SALT_REQUIREMENT: salt==${{ matrix.salt-version }}
- EXTRA_REQUIREMENTS_INSTALL: Cython
- run: |
- export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH"
- nox --force-color -e tests-3 --install-only
-
- - name: Test
- shell: bash
- env:
- SALT_REQUIREMENT: salt==${{ matrix.salt-version }}
- SKIP_REQUIREMENTS_INSTALL: YES
- run: |
- export PATH="/C/Program Files (x86)/Windows Kits/10/bin/10.0.18362.0/x64;$PATH"
- nox --force-color -e tests-3 -- -vv tests/
-
- - name: Create CodeCov Flags
- if: always()
- id: codecov-flags
- run: |
- echo ::set-output name=flags::$(python -c "import sys; print('{},{},salt_{}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info), '_'.join(str(v) for v in '${{ matrix.salt-version }}'.replace('==', '_').split('.'))))")
-
- - name: Upload Project Code Coverage
- if: always()
- shell: bash
- env:
- CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},project
- REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-project
- REPORT_PATH: artifacts/coverage-project.xml
- run: |
- if [ ! -f codecov.sh ]; then
- n=0
- until [ "$n" -ge 5 ]
- do
- if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then
- break
- fi
- n=$((n+1))
- sleep 15
- done
- fi
- if [ -f codecov.sh ]; then
- n=0
- until [ "$n" -ge 5 ]
- do
- if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
- break
- fi
- n=$((n+1))
- sleep 15
- done
- fi
-
- - name: Upload Tests Code Coverage
- if: always()
- shell: bash
- env:
- CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests
- REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-tests
- REPORT_PATH: artifacts/coverage-tests.xml
- run: |
- if [ ! -f codecov.sh ]; then
- n=0
- until [ "$n" -ge 5 ]
- do
- if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then
- break
- fi
- n=$((n+1))
- sleep 15
- done
- fi
- if [ -f codecov.sh ]; then
- n=0
- until [ "$n" -ge 5 ]
- do
- if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
- break
- fi
- n=$((n+1))
- sleep 15
- done
- fi
-
- - name: Upload Logs
- if: always()
- uses: actions/upload-artifact@main
- with:
- name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}.log
- path: artifacts/runtests-*.log
-
- macOS:
- runs-on: macOS-latest
- needs: Pre-Commit
-
- timeout-minutes: 40
-
- strategy:
- fail-fast: false
- max-parallel: 3
- matrix:
- python-version:
- - 3.6
- - 3.7
- salt-version:
- - 3003
-
- steps:
- - uses: actions/checkout@v2
-
- - name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v1
- with:
- python-version: ${{ matrix.python-version }}
-
- - name: Install Nox
- run: |
- python -m pip install --upgrade pip
- pip install nox
-
- - name: Install Test Requirements
- env:
- SALT_REQUIREMENT: salt==${{ matrix.salt-version }}
- run: |
- nox --force-color -e tests-3 --install-only
-
- - name: Test
- env:
- SALT_REQUIREMENT: salt==${{ matrix.salt-version }}
- SKIP_REQUIREMENTS_INSTALL: YES
- run: |
- nox --force-color -e tests-3 -- -vv tests/
-
- - name: Create CodeCov Flags
- if: always()
- id: codecov-flags
- run: |
- echo ::set-output name=flags::$(python -c "import sys; print('{},{},salt_{}'.format('${{ runner.os }}'.replace('-latest', ''), 'py{}{}'.format(*sys.version_info), '_'.join(str(v) for v in '${{ matrix.salt-version }}'.replace('==', '_').split('.'))))")
-
- - name: Upload Project Code Coverage
- if: always()
- shell: bash
- env:
- CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},project
- REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-project
- REPORT_PATH: artifacts/coverage-project.xml
- run: |
- if [ ! -f codecov.sh ]; then
- n=0
- until [ "$n" -ge 5 ]
- do
- if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then
- break
- fi
- n=$((n+1))
- sleep 15
- done
- fi
- if [ -f codecov.sh ]; then
- n=0
- until [ "$n" -ge 5 ]
- do
- if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
- break
- fi
- n=$((n+1))
- sleep 15
- done
- fi
-
- - name: Upload Tests Code Coverage
- if: always()
- shell: bash
- env:
- CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- REPORT_FLAGS: ${{ steps.codecov-flags.outputs.flags }},tests
- REPORT_NAME: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-tests
- REPORT_PATH: artifacts/coverage-tests.xml
- run: |
- if [ ! -f codecov.sh ]; then
- n=0
- until [ "$n" -ge 5 ]
- do
- if curl --max-time 30 -L https://codecov.io/bash --output codecov.sh; then
- break
- fi
- n=$((n+1))
- sleep 15
- done
- fi
- if [ -f codecov.sh ]; then
- n=0
- until [ "$n" -ge 5 ]
- do
- if bash codecov.sh -R $(pwd) -n "${REPORT_NAME}" -f "${REPORT_PATH}" -F "${REPORT_FLAGS}"; then
- break
- fi
- n=$((n+1))
- sleep 15
- done
- fi
-
- - name: Upload Logs
- if: always()
- uses: actions/upload-artifact@main
- with:
- name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}.log
- path: artifacts/runtests-*.log
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
old mode 100644
new mode 100755
index 91b1142b..e510b547
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -2,7 +2,7 @@
minimum_pre_commit_version: 2.4.0
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.0.1
+ rev: v4.4.0
hooks:
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: trailing-whitespace # Trims trailing whitespace.
@@ -37,7 +37,7 @@ repos:
- repo: https://github.com/s0undt3ch/salt-rewrite
# Automatically rewrite code with known rules
- rev: 1.3.3
+ rev: 2.5.2
hooks:
- id: salt-rewrite
alias: rewrite-docstrings
@@ -47,7 +47,7 @@ repos:
- repo: https://github.com/s0undt3ch/salt-rewrite
# Automatically rewrite code with known rules
- rev: 1.3.3
+ rev: 2.5.2
hooks:
- id: salt-rewrite
alias: rewrite-tests
@@ -59,18 +59,18 @@ repos:
rev: v2.37.2
hooks:
- id: pyupgrade
- name: Rewrite Code to be Py3.6+
+ name: Rewrite Code to be Py3.8+
args: [
- --py36-plus
+ --py38-plus
]
exclude: src/saltext/mattermost/version.py
- repo: https://github.com/asottile/reorder_python_imports
- rev: v2.6.0
+ rev: v3.10.0
hooks:
- id: reorder-python-imports
args: [
- --py3-plus,
+ --py38-plus,
]
exclude: src/saltext/mattermost/version.py
@@ -80,10 +80,8 @@ repos:
- id: black
args: [-l 100]
exclude: src/saltext/mattermost/version.py
- additional_dependencies:
- - click<8.1.0
- - repo: https://github.com/asottile/blacken-docs
+ - repo: https://github.com/adamchainz/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
@@ -91,12 +89,11 @@ repos:
files: ^(docs/.*\.rst|src/saltext/mattermost/.*\.py)$
additional_dependencies:
- black==22.6.0
- - click<8.1.0
# <---- Formatting -----------------------------------------------------------------------------
# ----- Security ------------------------------------------------------------------------------>
- repo: https://github.com/PyCQA/bandit
- rev: "1.7.0"
+ rev: "1.7.4"
hooks:
- id: bandit
alias: bandit-salt
@@ -104,7 +101,7 @@ repos:
args: [--silent, -lll, --skip, B701]
exclude: src/saltext/mattermost/version.py
- repo: https://github.com/PyCQA/bandit
- rev: "1.7.0"
+ rev: "1.7.4"
hooks:
- id: bandit
alias: bandit-tests
@@ -121,6 +118,7 @@ repos:
alias: lint-src
name: Lint Source Code
files: ^((setup|noxfile)|src/.*)\.py$
+ require_serial: true
args:
- -e
- lint-code-pre-commit
@@ -133,149 +131,9 @@ repos:
alias: lint-tests
name: Lint Tests
files: ^tests/.*\.py$
+ require_serial: true
args:
- -e
- lint-tests-pre-commit
- --
# <---- Code Analysis --------------------------------------------------------------------------
-
- # ----- Static Test Requirements -------------------------------------------------------------->
- - repo: https://github.com/saltstack/pip-tools-compile-impersonate
- rev: '4.1'
- hooks:
- - id: pip-tools-compile
- alias: compile-3.6-test-requirements
- name: Py3.6 Test Requirements
- files: ^requirements/tests.in$
- pass_filenames: false
- args:
- - -v
- - --py-version=3.6
- - --platform=linux
- - requirements/tests.in
-
- - id: pip-tools-compile
- alias: compile-3.7-test-requirements
- name: Py3.7 Test Requirements
- files: ^requirements/tests.in$
- pass_filenames: false
- args:
- - -v
- - --py-version=3.7
- - --platform=linux
- - requirements/tests.in
-
- - id: pip-tools-compile
- alias: compile-3.8-test-requirements
- name: Py3.8 Test Requirements
- files: ^requirements/tests.in$
- pass_filenames: false
- args:
- - -v
- - --py-version=3.8
- - --platform=linux
- - requirements/tests.in
-
- - id: pip-tools-compile
- alias: compile-3.9-test-requirements
- name: Py3.9 Test Requirements
- files: ^requirements/tests.in$
- pass_filenames: false
- args:
- - -v
- - --py-version=3.9
- - --platform=linux
- - requirements/tests.in
- # <---- Static Test Requirements ---------------------------------------------------------------
-
- # ----- Static Lint Requirements -------------------------------------------------------------->
- - id: pip-tools-compile
- alias: compile-3.6-test-requirements
- name: Py3.6 Lint Requirements
- files: ^requirements/lint.in$
- pass_filenames: false
- args:
- - -v
- - --py-version=3.6
- - --platform=linux
- - requirements/lint.in
-
- - id: pip-tools-compile
- alias: compile-3.7-test-requirements
- name: Py3.7 Lint Requirements
- files: ^requirements/lint.in$
- pass_filenames: false
- args:
- - -v
- - --py-version=3.7
- - --platform=linux
- - requirements/lint.in
-
- - id: pip-tools-compile
- alias: compile-3.8-test-requirements
- name: Py3.8 Lint Requirements
- files: ^requirements/lint.in$
- pass_filenames: false
- args:
- - -v
- - --py-version=3.8
- - --platform=linux
- - requirements/lint.in
-
- - id: pip-tools-compile
- alias: compile-3.9-test-requirements
- name: Py3.9 Lint Requirements
- files: ^requirements/lint.in$
- pass_filenames: false
- args:
- - -v
- - --py-version=3.9
- - --platform=linux
- - requirements/lint.in
- # <---- Static Lint Requirements ---------------------------------------------------------------
-
- # ----- Static Docs Requirements -------------------------------------------------------------->
- - id: pip-tools-compile
- alias: compile-3.6-test-requirements
- name: Py3.6 Docs Requirements
- files: ^requirements/docs.in$
- pass_filenames: false
- args:
- - -v
- - --py-version=3.6
- - --platform=linux
- - requirements/docs.in
-
- - id: pip-tools-compile
- alias: compile-3.7-test-requirements
- name: Py3.7 Docs Requirements
- files: ^requirements/docs.in$
- pass_filenames: false
- args:
- - -v
- - --py-version=3.7
- - --platform=linux
- - requirements/docs.in
-
- - id: pip-tools-compile
- alias: compile-3.8-test-requirements
- name: Py3.8 Docs Requirements
- files: ^requirements/docs.in$
- pass_filenames: false
- args:
- - -v
- - --py-version=3.8
- - --platform=linux
- - requirements/docs.in
-
- - id: pip-tools-compile
- alias: compile-3.9-test-requirements
- name: Py3.9 Docs Requirements
- files: ^requirements/docs.in$
- pass_filenames: false
- args:
- - -v
- - --py-version=3.9
- - --platform=linux
- - requirements/docs.in
- # <---- Static Docs Requirements ---------------------------------------------------------------
diff --git a/.pre-commit-hooks/check-cli-examples.py b/.pre-commit-hooks/check-cli-examples.py
index 348b0b2b..089645fe 100644
--- a/.pre-commit-hooks/check-cli-examples.py
+++ b/.pre-commit-hooks/check-cli-examples.py
@@ -4,7 +4,7 @@
import sys
CODE_ROOT = pathlib.Path(__file__).resolve().parent.parent
-EXECUTION_MODULES_PATH = CODE_ROOT / "src" / "saltext" / " mattermost" / "modules"
+EXECUTION_MODULES_PATH = CODE_ROOT / "src" / "saltext" / "mattermost" / "modules"
def check_cli_examples(files):
diff --git a/.pre-commit-hooks/make-autodocs.py b/.pre-commit-hooks/make-autodocs.py
index 0ec25567..0902611e 100644
--- a/.pre-commit-hooks/make-autodocs.py
+++ b/.pre-commit-hooks/make-autodocs.py
@@ -1,59 +1,119 @@
+import ast
+import os.path
import subprocess
-import sys
-from enum import IntEnum
from pathlib import Path
repo_path = Path(subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).decode().strip())
-src_dir = repo_path / "src" / " saltext" / "mattermost"
+src_dir = repo_path / "src" / "saltext" / "mattermost"
doc_dir = repo_path / "docs"
docs_by_kind = {}
+changed_something = False
+
+
+def _find_virtualname(path):
+ tree = ast.parse(path.read_text())
+ for node in ast.walk(tree):
+ if isinstance(node, ast.Assign):
+ for target in node.targets:
+ if isinstance(target, ast.Name) and target.id == "__virtualname__":
+ if isinstance(node.value, ast.Str):
+ virtualname = node.value.s
+ break
+ else:
+ continue
+ break
+ else:
+ virtualname = path.with_suffix("").name
+ return virtualname
+
+
+def write_module(rst_path, path, use_virtualname=True):
+ if use_virtualname:
+ virtualname = "``" + _find_virtualname(path) + "``"
+ else:
+ virtualname = make_import_path(path)
+ module_contents = f"""\
+{virtualname}
+{'='*len(virtualname)}
+
+.. automodule:: {make_import_path(path)}
+ :members:
+"""
+ if not rst_path.exists() or rst_path.read_text() != module_contents:
+ print(rst_path)
+ rst_path.write_text(module_contents)
+ return True
+ return False
+
+
+def write_index(index_rst, import_paths, kind):
+ if kind == "utils":
+ header_text = "Utilities"
+ common_path = os.path.commonpath(tuple(x.replace(".", "/") for x in import_paths)).replace(
+ "/", "."
+ )
+ if any(x == common_path for x in import_paths):
+ common_path = common_path[: common_path.rfind(".")]
+ else:
+ header_text = (
+ "execution modules" if kind.lower() == "modules" else kind.rstrip("s") + " modules"
+ )
+ common_path = import_paths[0][: import_paths[0].rfind(".")]
+ header = f"{'_'*len(header_text)}\n{header_text.title()}\n{'_'*len(header_text)}"
+ index_contents = f"""\
+.. all-saltext.mattermost.{kind}:
+
+{header}
+
+.. currentmodule:: {common_path}
+
+.. autosummary::
+ :toctree:
+
+{chr(10).join(sorted(' '+p[len(common_path)+1:] for p in import_paths))}
+"""
+ if not index_rst.exists() or index_rst.read_text() != index_contents:
+ print(index_rst)
+ index_rst.write_text(index_contents)
+ return True
+ return False
def make_import_path(path):
- return ".".join(path.with_suffix("").parts[-4:])
+ if path.name == "__init__.py":
+ path = path.parent
+ return ".".join(path.relative_to(repo_path / "src").with_suffix("").parts)
-for path in Path(__file__).parent.parent.joinpath("src/saltext/mattermost/").glob("*/*.py"):
+for path in src_dir.glob("*/*.py"):
if path.name != "__init__.py":
kind = path.parent.name
- docs_by_kind.setdefault(kind, set()).add(path)
+ if kind != "utils":
+ docs_by_kind.setdefault(kind, set()).add(path)
+
+# Utils can have subdirectories, treat them separately
+for path in (src_dir / "utils").rglob("*.py"):
+ if path.name == "__init__.py" and not path.read_text():
+ continue
+ docs_by_kind.setdefault("utils", set()).add(path)
for kind in docs_by_kind:
kind_path = doc_dir / "ref" / kind
- all_rst = kind_path / "all.rst"
+ index_rst = kind_path / "index.rst"
import_paths = []
for path in sorted(docs_by_kind[kind]):
import_path = make_import_path(path)
import_paths.append(import_path)
- rst_path = kind_path.joinpath(import_path).with_suffix(".rst")
- print(rst_path)
+ rst_path = kind_path / (import_path + ".rst")
rst_path.parent.mkdir(parents=True, exist_ok=True)
- rst_path.write_text(
- f"""
-{import_path}
-{'='*len(import_path)}
-
-.. automodule:: {import_path}
- :members:
-"""
- )
+ change = write_module(rst_path, path, use_virtualname=kind != "utils")
+ changed_something = changed_something or change
- header_text = (
- "execution modules" if kind.lower() == "modules" else kind.rstrip("s") + " modules"
- )
- header = f"{'_'*len(header_text)}\n{header_text.title()}\n{'_'*len(header_text)}"
+ write_index(index_rst, import_paths, kind)
- all_rst.write_text(
- f"""
-.. all-saltext.mattermost.{kind}:
-
-{header}
-.. autosummary::
- :toctree:
-
-{chr(10).join(sorted(' '+p for p in import_paths))}
-"""
- )
+# Ensure pre-commit realizes we did something
+if changed_something:
+ exit(2)
diff --git a/.pylintrc b/.pylintrc
old mode 100644
new mode 100755
index 7fb0a22f..5692f3b0
--- a/.pylintrc
+++ b/.pylintrc
@@ -72,7 +72,7 @@ ignored-modules=
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
# number of processors available to use, and will cap the count on Windows to
# avoid hangs.
-jobs=1
+jobs=0
# Control the amount of potential inferred values when inferring a single
# object. This can help the performance when dealing with large functions or
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 00000000..aec33636
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,5 @@
+The changelog format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+
+This project uses [Semantic Versioning](https://semver.org/) - MAJOR.MINOR.PATCH
+
+# Changelog
diff --git a/LICENSE b/LICENSE
index a92dcb5b..cbfdcf2c 100644
--- a/LICENSE
+++ b/LICENSE
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright 2023 EITR Technologies
+ Copyright 2024 EITR Technologies, LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README.md b/README.md
index 3e756a8d..595f76cb 100644
--- a/README.md
+++ b/README.md
@@ -1,33 +1,86 @@
-# mattermost
+# Salt Extension for Mattermost
Salt Extension for interacting with Mattermost
-## Quickstart
+## Security
-To get started with your new project:
+If you think you've found a security vulnerability, see
+[Salt's security guide][security].
- # Create a new venv
- python3 -m venv env --prompt mattermost
- source env/bin/activate
+## User Documentation
- # On mac, you may need to upgrade pip
- python -m pip install --upgrade pip
+This README is for people aiming to contribute to the project.
+If you just want to get started with the extension, check out the
+module docstrings (for now, documentation is coming!).
- # On WSL or some flavors of linux you may need to install the `enchant`
- # library in order to build the docs
- sudo apt-get install -y enchant
+## Contributing
- # Install extension + test/dev/doc dependencies into your environment
- python -m pip install -e .[tests,dev,docs]
+The saltext-mattermost project team welcomes contributions from the community.
- # Run tests!
- python -m nox -e tests-3
+The [Salt Contributing guide][salt-contributing] has a lot of relevant
+information, but if you'd like to jump right in here's how to get started:
- # skip requirements install for next time
- export SKIP_REQUIREMENTS_INSTALL=1
- # Build the docs, serve, and view in your web browser:
- python -m nox -e docs && (cd docs/_build/html; python -m webbrowser localhost:8000; python -m http.server; cd -)
+```bash
+# Clone the repo
+git clone --origin salt git@github.com:salt-extensions/saltext-mattermost.git
- # Run the example function
- salt-call --local mattermost.example_function text="Happy Hacking!"
+# Change to the repo dir
+cd saltext-mattermost
+
+# Create a new venv
+python3 -m venv env --prompt saltext-mattermost
+source env/bin/activate
+
+# On mac, you may need to upgrade pip
+python -m pip install --upgrade pip
+
+# On WSL or some flavors of linux you may need to install the `enchant`
+# library in order to build the docs
+sudo apt-get install -y enchant
+
+# Install extension + test/dev/doc dependencies into your environment
+python -m pip install -e '.[tests,dev,docs]'
+
+# Run tests!
+python -m nox -e tests-3
+
+# skip requirements install for next time
+export SKIP_REQUIREMENTS_INSTALL=1
+
+# Build the docs, serve, and view in your web browser:
+python -m nox -e docs && (cd docs/_build/html; python -m webbrowser localhost:8000; python -m http.server; cd -)
+```
+
+Writing code isn't the only way to contribute! We value contributions in any of
+these areas:
+
+* Documentation - especially examples of how to use this module to solve
+ specific problems.
+* Triaging [issues][issues] and participating in [discussions][discussions]
+* Reviewing [Pull Requests][PRs] (we really like
+ [Conventional Comments][comments]!)
+
+You could also contribute in other ways:
+
+* Writing blog posts
+* Posting on social media about how you used Salt+Mattermost to solve your
+ problems, including videos
+* Giving talks at conferences
+* Publishing videos
+* Asking/answering questions in IRC, Slack, or email groups
+
+Any of these things are super valuable to our community, and we sincerely
+appreciate every contribution!
+
+
+For more information, build the docs and head over to http://localhost:8000/ —
+that's where you'll find the rest of the documentation.
+
+
+[security]: https://github.com/saltstack/salt/blob/master/SECURITY.md
+[salt-contributing]: https://docs.saltproject.io/en/master/topics/development/contributing.html
+[issues]: https://github.com/salt-extensions/saltext-mattermost/issues
+[PRs]: https://github.com/salt-extensions/saltext-mattermost/pulls
+[discussions]: https://github.com/salt-extensions/saltext-mattermost/discussions
+[comments]: https://conventionalcomments.org/
diff --git a/changelog/.template.jinja b/changelog/.template.jinja
new file mode 100644
index 00000000..0cf429a3
--- /dev/null
+++ b/changelog/.template.jinja
@@ -0,0 +1,15 @@
+{% if sections[""] %}
+{% for category, val in definitions.items() if category in sections[""] %}
+
+### {{ definitions[category]['name'] }}
+
+{% for text, values in sections[""][category].items() %}
+- {{ text }} {{ values|join(', ') }}
+{% endfor %}
+
+{% endfor %}
+{% else %}
+No significant changes.
+
+
+{% endif %}
diff --git a/docs/all.rst b/docs/all.rst
deleted file mode 100644
index b064a8f5..00000000
--- a/docs/all.rst
+++ /dev/null
@@ -1,16 +0,0 @@
-.. _all the states/modules:
-
-Complete List of mattermost
-===========================
-
-
-.. toctree::
- :maxdepth: 2
-
- ref/modules.rst
-
-
-.. toctree::
- :maxdepth: 2
-
- ref/states.rst
diff --git a/docs/changelog.md b/docs/changelog.md
new file mode 100644
index 00000000..2f5367b2
--- /dev/null
+++ b/docs/changelog.md
@@ -0,0 +1,12 @@
+# Changelog
+
+The changelog format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+
+This project uses [Semantic Versioning](https://semver.org/) - MAJOR.MINOR.PATCH
+
+```{towncrier-draft-entries}
+```
+
+```{include} ../CHANGELOG.md
+:start-after: '# Changelog'
+```
diff --git a/docs/conf.py b/docs/conf.py
old mode 100644
new mode 100755
index c36a1ccc..857cfff8
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -9,8 +9,10 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import datetime
+import email.policy
import os
import sys
+from pathlib import Path
try:
from importlib_metadata import distribution
@@ -25,6 +27,8 @@
# assume we're in the doc/ directory
docs_basepath = os.path.abspath(os.path.dirname("."))
+PROJECT_ROOT_DIR = Path(docs_basepath).parent
+
addtl_paths = (
os.path.join(os.pardir, "src"), # saltext.mattermost itself (for autodoc)
"_ext", # custom Sphinx extensions
@@ -44,6 +48,19 @@
copyright_year = f"2021 - {this_year}"
project = dist.metadata["Summary"]
author = dist.metadata["Author"]
+
+if author is None:
+ # Core metadata is serialized differently with pyproject.toml:
+ # https://packaging.python.org/en/latest/specifications/pyproject-toml/#authors-maintainers
+ author_email = dist.metadata["Author-email"]
+ em = email.message_from_string(
+ f"To: {author_email}",
+ policy=email.policy.default,
+ )
+ if em["To"].addresses and em["To"].addresses[0]:
+ author = em["To"].addresses[0].display_name
+ author = author or ""
+
copyright = f"{copyright_year}, {author}"
# The full version, including alpha/beta/rc tags
@@ -75,6 +92,15 @@
"sphinx.ext.coverage",
"sphinx_copybutton",
"sphinxcontrib.spelling",
+ "sphinxcontrib.towncrier.ext",
+ "myst_parser",
+ "sphinx_inline_tabs",
+]
+
+myst_enable_extensions = [
+ "colon_fence",
+ "deflist",
+ "tasklist",
]
# Add any paths that contain templates here, relative to this directory.
@@ -95,7 +121,7 @@
"sitevars.rst",
]
-autosummary_generate = True
+autosummary_generate = False
# -- Options for HTML output -------------------------------------------------
@@ -136,7 +162,7 @@
# ----- Intersphinx Config ---------------------------------------------------------------------------------------->
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
- "pytest": ("https://pytest.readthedocs.io/en/stable", None),
+ "pytest": ("https://docs.pytest.org/en/stable", None),
"salt": ("https://docs.saltproject.io/en/latest", None),
}
# <---- Intersphinx Config -----------------------------------------------------------------------------------------
@@ -146,6 +172,11 @@
autodoc_mock_imports = ["salt"]
# <---- Autodoc Config -----------------------------------------------------------------------------------------------
+# Towncrier draft config
+towncrier_draft_autoversion_mode = "sphinx-release"
+towncrier_draft_include_empty = True
+towncrier_draft_working_directory = str(PROJECT_ROOT_DIR)
+
def setup(app):
app.add_crossref_type(
diff --git a/docs/index.rst b/docs/index.rst
index 53934fbb..e4e82724 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,11 +1,32 @@
-Welcome to mattermost Documentation!
-====================================
+``saltext-mattermost``: Integrate Salt with Mattermost
+======================================================
+
+Salt Extension for interacting with Mattermost
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Guides
+ :hidden:
+
+ topics/installation
.. toctree::
:maxdepth: 2
- :caption: Contents:
+ :caption: Provided Modules
+ :hidden:
+
+ ref/modules/index
+ ref/returners/index
+ ref/runners/index
+ ref/utils/index
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Reference
+ :hidden:
+
+ changelog
- all.rst
Indices and tables
==================
diff --git a/docs/ref/modules/all/salt.modules.mattermost.rst b/docs/ref/modules/all/salt.modules.mattermost.rst
deleted file mode 100644
index cf82a81d..00000000
--- a/docs/ref/modules/all/salt.modules.mattermost.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-salt.modules.mattermost
-=======================
-
-.. automodule:: salt.modules.mattermost
- :members:
- :undoc-members:
diff --git a/docs/ref/modules/index.rst b/docs/ref/modules/index.rst
new file mode 100644
index 00000000..f94a48f2
--- /dev/null
+++ b/docs/ref/modules/index.rst
@@ -0,0 +1,12 @@
+.. all-saltext.mattermost.modules:
+
+_________________
+Execution Modules
+_________________
+
+.. currentmodule:: saltext.mattermost.modules
+
+.. autosummary::
+ :toctree:
+
+ mattermost
diff --git a/docs/ref/modules/saltext.mattermost.modules.mattermost.rst b/docs/ref/modules/saltext.mattermost.modules.mattermost.rst
new file mode 100644
index 00000000..f97aa1ea
--- /dev/null
+++ b/docs/ref/modules/saltext.mattermost.modules.mattermost.rst
@@ -0,0 +1,5 @@
+``mattermost``
+==============
+
+.. automodule:: saltext.mattermost.modules.mattermost
+ :members:
diff --git a/docs/ref/returners/all/salt.returners.mattermost_returner.rst b/docs/ref/returners/all/salt.returners.mattermost_returner.rst
deleted file mode 100644
index d2c74d7c..00000000
--- a/docs/ref/returners/all/salt.returners.mattermost_returner.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-salt.returners.mattermost_returner
-==================================
-
-.. automodule:: salt.returners.mattermost_returner
- :members:
- :undoc-members:
diff --git a/docs/ref/returners/index.rst b/docs/ref/returners/index.rst
new file mode 100644
index 00000000..902e3622
--- /dev/null
+++ b/docs/ref/returners/index.rst
@@ -0,0 +1,12 @@
+.. all-saltext.mattermost.returners:
+
+________________
+Returner Modules
+________________
+
+.. currentmodule:: saltext.mattermost.returners
+
+.. autosummary::
+ :toctree:
+
+ mattermost_returner
diff --git a/docs/ref/returners/saltext.mattermost.returners.mattermost_returner.rst b/docs/ref/returners/saltext.mattermost.returners.mattermost_returner.rst
new file mode 100644
index 00000000..b2c9e3e8
--- /dev/null
+++ b/docs/ref/returners/saltext.mattermost.returners.mattermost_returner.rst
@@ -0,0 +1,5 @@
+``mattermost``
+==============
+
+.. automodule:: saltext.mattermost.returners.mattermost_returner
+ :members:
diff --git a/docs/ref/runners/all/salt.runners.mattermost.rst b/docs/ref/runners/all/salt.runners.mattermost.rst
deleted file mode 100644
index 869745ff..00000000
--- a/docs/ref/runners/all/salt.runners.mattermost.rst
+++ /dev/null
@@ -1,12 +0,0 @@
-salt.runners.mattermost
-=======================
-
-**Note for 2017.7 releases!**
-
-Due to the `salt.runners.config `_ module not being available in this release series, importing the `salt.runners.config `_ module from the |repo_primary_branch| branch is required to make this module work.
-
-Ref: `Mattermost runner failing to retrieve config values due to unavailable config runner #43479 `_
-
-.. automodule:: salt.runners.mattermost
- :members:
- :undoc-members:
diff --git a/docs/ref/runners/index.rst b/docs/ref/runners/index.rst
new file mode 100644
index 00000000..1133f1a2
--- /dev/null
+++ b/docs/ref/runners/index.rst
@@ -0,0 +1,12 @@
+.. all-saltext.mattermost.runners:
+
+______________
+Runner Modules
+______________
+
+.. currentmodule:: saltext.mattermost.runners
+
+.. autosummary::
+ :toctree:
+
+ mattermost
diff --git a/docs/ref/runners/saltext.mattermost.runners.mattermost.rst b/docs/ref/runners/saltext.mattermost.runners.mattermost.rst
new file mode 100644
index 00000000..2ef1a082
--- /dev/null
+++ b/docs/ref/runners/saltext.mattermost.runners.mattermost.rst
@@ -0,0 +1,5 @@
+``mattermost``
+==============
+
+.. automodule:: saltext.mattermost.runners.mattermost
+ :members:
diff --git a/docs/ref/utils/index.rst b/docs/ref/utils/index.rst
new file mode 100644
index 00000000..c4543a3f
--- /dev/null
+++ b/docs/ref/utils/index.rst
@@ -0,0 +1,13 @@
+.. all-saltext.mattermost.utils:
+
+_________
+Utilities
+_________
+
+.. currentmodule:: saltext.mattermost
+
+.. autosummary::
+ :toctree:
+
+ utils
+ utils.mattermost
diff --git a/docs/ref/utils/saltext.mattermost.utils.mattermost.rst b/docs/ref/utils/saltext.mattermost.utils.mattermost.rst
new file mode 100644
index 00000000..8a3471c8
--- /dev/null
+++ b/docs/ref/utils/saltext.mattermost.utils.mattermost.rst
@@ -0,0 +1,5 @@
+saltext.mattermost.utils.mattermost
+===================================
+
+.. automodule:: saltext.mattermost.utils.mattermost
+ :members:
diff --git a/docs/ref/utils/saltext.mattermost.utils.rst b/docs/ref/utils/saltext.mattermost.utils.rst
new file mode 100644
index 00000000..148264ed
--- /dev/null
+++ b/docs/ref/utils/saltext.mattermost.utils.rst
@@ -0,0 +1,5 @@
+saltext.mattermost.utils
+========================
+
+.. automodule:: saltext.mattermost.utils
+ :members:
diff --git a/docs/topics/installation.md b/docs/topics/installation.md
new file mode 100644
index 00000000..40f89026
--- /dev/null
+++ b/docs/topics/installation.md
@@ -0,0 +1,36 @@
+# Installation
+
+Generally, extensions need to be installed into the same Python environment Salt uses.
+
+:::{tab} State
+```yaml
+Install Salt Mattermost extension:
+ pip.installed:
+ - name: saltext-mattermost
+```
+:::
+
+:::{tab} Onedir installation
+```bash
+salt-pip install saltext-mattermost
+```
+:::
+
+:::{tab} Regular installation
+```bash
+pip install saltext-mattermost
+```
+:::
+
+:::{important}
+Currently, there is [an issue][issue-second-saltext] where the installation of a Saltext fails silently
+if the environment already has another one installed. You can workaround this by
+removing all Saltexts and reinstalling them in one transaction.
+:::
+
+:::{hint}
+Saltexts are not distributed automatically via the fileserver like custom modules, they need to be installed
+on each node you want them to be available on.
+:::
+
+[issue-second-saltext]: https://github.com/saltstack/salt/issues/65433
diff --git a/noxfile.py b/noxfile.py
old mode 100644
new mode 100755
index 8befd1cd..099e2fc9
--- a/noxfile.py
+++ b/noxfile.py
@@ -19,7 +19,7 @@
nox.options.error_on_missing_interpreters = False
# Python versions to test against
-PYTHON_VERSIONS = ("3", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10")
+PYTHON_VERSIONS = ("3", "3.8", "3.9", "3.10")
# Be verbose when running under a CI context
CI_RUN = (
os.environ.get("JENKINS_URL") or os.environ.get("CI") or os.environ.get("DRONE") is not None
@@ -29,7 +29,7 @@
EXTRA_REQUIREMENTS_INSTALL = os.environ.get("EXTRA_REQUIREMENTS_INSTALL")
COVERAGE_VERSION_REQUIREMENT = "coverage==5.2"
-SALT_REQUIREMENT = os.environ.get("SALT_REQUIREMENT") or "salt>=3003"
+SALT_REQUIREMENT = os.environ.get("SALT_REQUIREMENT") or "salt>=3005"
if SALT_REQUIREMENT == "salt==master":
SALT_REQUIREMENT = "git+https://github.com/saltstack/salt.git@master"
@@ -70,8 +70,8 @@ def _get_session_python_version_info(session):
def _get_pydir(session):
version_info = _get_session_python_version_info(session)
- if version_info < (3, 5):
- session.error("Only Python >= 3.5 is supported")
+ if version_info < (3, 8):
+ session.error("Only Python >= 3.8 is supported")
return f"py{version_info[0]}.{version_info[1]}"
diff --git a/pyproject.toml b/pyproject.toml
index 07920ca7..58affb95 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,10 +1,144 @@
[build-system]
-requires = ["setuptools>=50.3.2", "wheel", "setuptools-declarative-requirements", "setuptools_scm[toml]>=3.4"]
+requires = [
+ "wheel",
+ "setuptools>=50.3.2",
+ "setuptools_scm[toml]>=3.4",
+]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
write_to = "src/saltext/mattermost/version.py"
write_to_template = "__version__ = \"{version}\""
+[project]
+name = "saltext.mattermost"
+description = "Salt Extension for interacting with Mattermost"
+authors = [
+ {name = "EITR Technologies, LLC", email = "devops@eitr.tech"},
+]
+keywords = [
+ "salt-extension",
+]
+license = {text = "Apache Software License"}
+classifiers = [
+ "Programming Language :: Python",
+ "Programming Language :: Cython",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3 :: Only",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Development Status :: 4 - Beta",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: Apache Software License",
+]
+requires-python = ">= 3.8"
+dynamic = ["version"]
+dependencies = [
+ "salt>=3005",
+]
+
+[project.readme]
+file = "README.md"
+content-type = "text/markdown"
+
+[project.urls]
+Homepage = "https://github.com/salt-extensions/saltext-mattermost"
+Source = "https://github.com/salt-extensions/saltext-mattermost"
+Tracker = "https://github.com/salt-extensions/saltext-mattermost/issues"
+
+[project.optional-dependencies]
+changelog = ["towncrier==22.12.0"]
+dev = [
+ "nox",
+ "pre-commit>=2.4.0",
+ "pylint",
+ "saltpylint",
+]
+docs = [
+ "sphinx",
+ "sphinx-prompt",
+ "sphinxcontrib-spelling",
+ "sphinx-copybutton",
+ "towncrier==22.12.0",
+ "sphinxcontrib-towncrier",
+ "myst_parser",
+ "furo",
+ "sphinx-inline-tabs",
+]
+docsauto = ["sphinx-autobuild"]
+lint = [
+ "pylint",
+ "saltpylint",
+]
+tests = [
+ "pytest>=6.1.0",
+ "pytest-salt-factories>=1.0.0rc19",
+]
+
+[project.entry-points."salt.loader"]
+"saltext.mattermost" = "saltext.mattermost"
+
+[tool.setuptools]
+zip-safe = false
+include-package-data = true
+platforms = ["any"]
+
+[tool.setuptools.packages.find]
+where = ["src"]
+exclude = ["tests"]
+
+[tool.distutils.bdist_wheel]
+# Use this option if your package is pure-python
+universal = 1
+
+[tool.distutils.sdist]
+owner = "root"
+group = "root"
+
+[tool.build_sphinx]
+source_dir = "docs"
+build_dir = "build/sphinx"
+
[tool.black]
line-length = 100
+
+[tool.towncrier]
+ package = "saltext.mattermost"
+ filename = "CHANGELOG.md"
+ template = "changelog/.template.jinja"
+ directory = "changelog/"
+ start_string = "# Changelog\n"
+ underlines = ["", "", ""]
+ title_format = "## {version} ({project_date})"
+ issue_format = "[#{issue}](https://github.com/salt-extensions/saltext-mattermost/issues/{issue})"
+
+ [[tool.towncrier.type]]
+ directory = "removed"
+ name = "Removed"
+ showcontent = true
+
+ [[tool.towncrier.type]]
+ directory = "deprecated"
+ name = "Deprecated"
+ showcontent = true
+
+ [[tool.towncrier.type]]
+ directory = "changed"
+ name = "Changed"
+ showcontent = true
+
+ [[tool.towncrier.type]]
+ directory = "fixed"
+ name = "Fixed"
+ showcontent = true
+
+ [[tool.towncrier.type]]
+ directory = "added"
+ name = "Added"
+ showcontent = true
+
+ [[tool.towncrier.type]]
+ directory = "security"
+ name = "Security"
+ showcontent = true
diff --git a/requirements/base.txt b/requirements/base.txt
deleted file mode 100644
index bcd4f131..00000000
--- a/requirements/base.txt
+++ /dev/null
@@ -1 +0,0 @@
-salt>=3003
diff --git a/requirements/docs.in b/requirements/docs.in
deleted file mode 100644
index 15427319..00000000
--- a/requirements/docs.in
+++ /dev/null
@@ -1,5 +0,0 @@
-sphinx
-sphinx-material-saltstack
-sphinx-prompt
-sphinxcontrib-spelling
-importlib_metadata; python_version < "3.8"
diff --git a/requirements/lint.in b/requirements/lint.in
deleted file mode 100644
index 911de932..00000000
--- a/requirements/lint.in
+++ /dev/null
@@ -1,2 +0,0 @@
-pylint
-saltpylint
diff --git a/requirements/py3.5/tests.txt b/requirements/py3.5/tests.txt
deleted file mode 100644
index e69de29b..00000000
diff --git a/requirements/py3.6/docs.txt b/requirements/py3.6/docs.txt
deleted file mode 100644
index 273b81d4..00000000
--- a/requirements/py3.6/docs.txt
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-# pip-compile --output-file=requirements/py3.6/docs.txt requirements/docs.in
-#
-alabaster==0.7.13
- # via sphinx
-babel==2.11.0
- # via sphinx
-beautifulsoup4==4.9.1
- # via sphinx-material-saltstack
-certifi==2023.11.17
- # via requests
-charset-normalizer==2.0.12
- # via requests
-css-html-js-minify==2.5.5
- # via sphinx-material-saltstack
-docutils==0.18.1
- # via sphinx
-idna==3.6
- # via requests
-imagesize==1.4.1
- # via sphinx
-importlib-metadata==4.8.3 ; python_version < "3.8"
- # via
- # -r requirements/docs.in
- # sphinx
- # sphinxcontrib-spelling
-jinja2==3.0.3
- # via sphinx
-lxml==4.5.2
- # via sphinx-material-saltstack
-markupsafe==2.0.1
- # via jinja2
-packaging==21.3
- # via sphinx
-pyenchant==3.2.2
- # via sphinxcontrib-spelling
-pygments==2.14.0
- # via
- # sphinx
- # sphinx-prompt
-pyparsing==3.0.7
- # via packaging
-python-slugify[unidecode]==4.0.1
- # via sphinx-material-saltstack
-pytz==2023.3.post1
- # via babel
-requests==2.27.1
- # via sphinx
-snowballstemmer==2.2.0
- # via sphinx
-soupsieve==2.3.2.post1
- # via beautifulsoup4
-sphinx-material-saltstack==1.0.5
- # via -r requirements/docs.in
-sphinx-prompt==1.5.0
- # via -r requirements/docs.in
-sphinx==5.3.0
- # via
- # -r requirements/docs.in
- # sphinx-material-saltstack
- # sphinx-prompt
- # sphinxcontrib-spelling
-sphinxcontrib-applehelp==1.0.2
- # via sphinx
-sphinxcontrib-devhelp==1.0.2
- # via sphinx
-sphinxcontrib-htmlhelp==2.0.0
- # via sphinx
-sphinxcontrib-jsmath==1.0.1
- # via sphinx
-sphinxcontrib-qthelp==1.0.3
- # via sphinx
-sphinxcontrib-serializinghtml==1.1.5
- # via sphinx
-sphinxcontrib-spelling==7.7.0
- # via -r requirements/docs.in
-text-unidecode==1.3
- # via python-slugify
-typing-extensions==4.1.1
- # via importlib-metadata
-unidecode==1.3.7
- # via python-slugify
-urllib3==1.26.18
- # via requests
-zipp==3.6.0
- # via importlib-metadata
diff --git a/requirements/py3.6/lint.txt b/requirements/py3.6/lint.txt
deleted file mode 100644
index 4ae2428b..00000000
--- a/requirements/py3.6/lint.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-# pip-compile --output-file=requirements/py3.6/lint.txt requirements/lint.in
-#
-astroid==2.11.7
- # via pylint
-dill==0.3.4
- # via pylint
-isort==5.10.1
- # via pylint
-lazy-object-proxy==1.7.1
- # via astroid
-mccabe==0.7.0
- # via pylint
-modernize==0.5
- # via saltpylint
-platformdirs==2.4.0
- # via pylint
-pycodestyle==2.10.0
- # via saltpylint
-pylint==2.13.9
- # via
- # -r requirements/lint.in
- # saltpylint
-saltpylint==2023.8.3
- # via -r requirements/lint.in
-tomli==1.2.3
- # via pylint
-typed-ast==1.5.5
- # via astroid
-typing-extensions==4.1.1
- # via
- # astroid
- # pylint
-wrapt==1.16.0
- # via astroid
-
-# The following packages are considered to be unsafe in a requirements file:
-# setuptools
diff --git a/requirements/py3.6/tests.txt b/requirements/py3.6/tests.txt
deleted file mode 100644
index b8f37d41..00000000
--- a/requirements/py3.6/tests.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-# pip-compile --output-file=requirements/py3.6/tests.txt requirements/tests.in
-#
-attrs==22.2.0
- # via
- # pytest
- # pytest-salt-factories
- # pytest-skip-markers
-distlib==0.3.8
- # via virtualenv
-distro==1.8.0
- # via pytest-skip-markers
-filelock==3.4.1
- # via virtualenv
-importlib-metadata==4.8.3
- # via
- # pluggy
- # pytest
- # virtualenv
-importlib-resources==5.4.0
- # via virtualenv
-iniconfig==1.1.1
- # via pytest
-msgpack==1.0.5
- # via pytest-salt-factories
-packaging==21.3
- # via pytest
-platformdirs==2.4.0
- # via virtualenv
-pluggy==1.0.0
- # via pytest
-psutil==5.9.6
- # via pytest-salt-factories
-py==1.11.0
- # via pytest
-pyparsing==3.0.7
- # via packaging
-pytest-helpers-namespace==2021.12.29
- # via pytest-salt-factories
-pytest-salt-factories==0.912.2
- # via -r requirements/tests.in
-pytest-skip-markers==1.3.0
- # via pytest-salt-factories
-pytest-tempdir==2019.10.12
- # via pytest-salt-factories
-pytest==7.0.1
- # via
- # -r requirements/tests.in
- # pytest-helpers-namespace
- # pytest-salt-factories
- # pytest-skip-markers
- # pytest-tempdir
-pyzmq==25.1.2
- # via pytest-salt-factories
-tomli==1.2.3
- # via pytest
-typing-extensions==4.1.1
- # via importlib-metadata
-virtualenv==20.17.1
- # via pytest-salt-factories
-zipp==3.6.0
- # via
- # importlib-metadata
- # importlib-resources
diff --git a/requirements/py3.7/docs.txt b/requirements/py3.7/docs.txt
deleted file mode 100644
index eb87713b..00000000
--- a/requirements/py3.7/docs.txt
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-# pip-compile --output-file=requirements/py3.7/docs.txt requirements/docs.in
-#
-alabaster==0.7.13
- # via sphinx
-babel==2.14.0
- # via sphinx
-beautifulsoup4==4.9.1
- # via sphinx-material-saltstack
-certifi==2023.11.17
- # via requests
-charset-normalizer==3.3.2
- # via requests
-css-html-js-minify==2.5.5
- # via sphinx-material-saltstack
-docutils==0.19
- # via sphinx
-idna==3.6
- # via requests
-imagesize==1.4.1
- # via sphinx
-importlib-metadata==6.7.0 ; python_version < "3.8"
- # via
- # -r requirements/docs.in
- # sphinx
- # sphinxcontrib-spelling
-jinja2==3.1.2
- # via sphinx
-lxml==4.5.2
- # via sphinx-material-saltstack
-markupsafe==2.1.3
- # via jinja2
-packaging==23.2
- # via sphinx
-pyenchant==3.2.2
- # via sphinxcontrib-spelling
-pygments==2.17.2
- # via
- # sphinx
- # sphinx-prompt
-python-slugify[unidecode]==4.0.1
- # via sphinx-material-saltstack
-pytz==2023.3.post1
- # via babel
-requests==2.31.0
- # via sphinx
-snowballstemmer==2.2.0
- # via sphinx
-soupsieve==2.4.1
- # via beautifulsoup4
-sphinx-material-saltstack==1.0.5
- # via -r requirements/docs.in
-sphinx-prompt==1.5.0
- # via -r requirements/docs.in
-sphinx==5.3.0
- # via
- # -r requirements/docs.in
- # sphinx-material-saltstack
- # sphinx-prompt
- # sphinxcontrib-spelling
-sphinxcontrib-applehelp==1.0.2
- # via sphinx
-sphinxcontrib-devhelp==1.0.2
- # via sphinx
-sphinxcontrib-htmlhelp==2.0.0
- # via sphinx
-sphinxcontrib-jsmath==1.0.1
- # via sphinx
-sphinxcontrib-qthelp==1.0.3
- # via sphinx
-sphinxcontrib-serializinghtml==1.1.5
- # via sphinx
-sphinxcontrib-spelling==8.0.0
- # via -r requirements/docs.in
-text-unidecode==1.3
- # via python-slugify
-typing-extensions==4.7.1
- # via importlib-metadata
-unidecode==1.3.7
- # via python-slugify
-urllib3==2.0.7
- # via requests
-zipp==3.15.0
- # via importlib-metadata
diff --git a/requirements/py3.7/lint.txt b/requirements/py3.7/lint.txt
deleted file mode 100644
index 4eda0b42..00000000
--- a/requirements/py3.7/lint.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-# pip-compile --output-file=requirements/py3.7/lint.txt requirements/lint.in
-#
-astroid==2.15.8
- # via pylint
-dill==0.3.7
- # via pylint
-isort==5.11.5
- # via pylint
-lazy-object-proxy==1.9.0
- # via astroid
-mccabe==0.7.0
- # via pylint
-modernize==0.5
- # via saltpylint
-platformdirs==4.0.0
- # via pylint
-pycodestyle==2.10.0
- # via saltpylint
-pylint==2.17.7
- # via
- # -r requirements/lint.in
- # saltpylint
-saltpylint==2023.8.3
- # via -r requirements/lint.in
-tomli==2.0.1
- # via pylint
-tomlkit==0.12.3
- # via pylint
-typed-ast==1.5.5
- # via astroid
-typing-extensions==4.7.1
- # via
- # astroid
- # platformdirs
- # pylint
-wrapt==1.16.0
- # via astroid
diff --git a/requirements/py3.7/tests.txt b/requirements/py3.7/tests.txt
deleted file mode 100644
index 5648b102..00000000
--- a/requirements/py3.7/tests.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-# pip-compile --output-file=requirements/py3.7/tests.txt requirements/tests.in
-#
-attrs==23.1.0
- # via
- # pytest-salt-factories
- # pytest-skip-markers
-distlib==0.3.8
- # via virtualenv
-distro==1.8.0
- # via pytest-skip-markers
-exceptiongroup==1.2.0
- # via pytest
-filelock==3.12.2
- # via virtualenv
-importlib-metadata==6.7.0
- # via
- # attrs
- # pluggy
- # pytest
- # virtualenv
-iniconfig==2.0.0
- # via pytest
-msgpack==1.0.5
- # via pytest-salt-factories
-packaging==23.2
- # via pytest
-platformdirs==4.0.0
- # via virtualenv
-pluggy==1.2.0
- # via pytest
-psutil==5.9.6
- # via pytest-salt-factories
-pytest-helpers-namespace==2021.12.29
- # via pytest-salt-factories
-pytest-salt-factories==0.912.2
- # via -r requirements/tests.in
-pytest-skip-markers==1.5.0
- # via pytest-salt-factories
-pytest-tempdir==2019.10.12
- # via pytest-salt-factories
-pytest==7.4.3
- # via
- # -r requirements/tests.in
- # pytest-helpers-namespace
- # pytest-salt-factories
- # pytest-skip-markers
- # pytest-tempdir
-pyzmq==25.1.2
- # via pytest-salt-factories
-tomli==2.0.1
- # via pytest
-typing-extensions==4.7.1
- # via
- # importlib-metadata
- # platformdirs
-virtualenv==20.25.0
- # via pytest-salt-factories
-zipp==3.15.0
- # via importlib-metadata
diff --git a/requirements/py3.8/docs.txt b/requirements/py3.8/docs.txt
deleted file mode 100644
index 0cc6eedc..00000000
--- a/requirements/py3.8/docs.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-# pip-compile --output-file=requirements/py3.8/docs.txt requirements/docs.in
-#
-alabaster==0.7.13
- # via sphinx
-babel==2.14.0
- # via sphinx
-beautifulsoup4==4.9.1
- # via sphinx-material-saltstack
-certifi==2023.11.17
- # via requests
-charset-normalizer==3.3.2
- # via requests
-css-html-js-minify==2.5.5
- # via sphinx-material-saltstack
-docutils==0.20.1
- # via
- # sphinx
- # sphinx-prompt
-idna==3.6
- # via requests
-imagesize==1.4.1
- # via sphinx
-importlib-metadata==7.0.0
- # via sphinx
-jinja2==3.1.2
- # via sphinx
-lxml==4.5.2
- # via sphinx-material-saltstack
-markupsafe==2.1.3
- # via jinja2
-packaging==23.2
- # via sphinx
-pyenchant==3.2.2
- # via sphinxcontrib-spelling
-pygments==2.17.2
- # via
- # sphinx
- # sphinx-prompt
-python-slugify[unidecode]==4.0.1
- # via sphinx-material-saltstack
-pytz==2023.3.post1
- # via babel
-requests==2.31.0
- # via sphinx
-snowballstemmer==2.2.0
- # via sphinx
-soupsieve==2.5
- # via beautifulsoup4
-sphinx-material-saltstack==1.0.5
- # via -r requirements/docs.in
-sphinx-prompt==1.7.0
- # via -r requirements/docs.in
-sphinx==7.1.2
- # via
- # -r requirements/docs.in
- # sphinx-material-saltstack
- # sphinx-prompt
- # sphinxcontrib-spelling
-sphinxcontrib-applehelp==1.0.4
- # via sphinx
-sphinxcontrib-devhelp==1.0.2
- # via sphinx
-sphinxcontrib-htmlhelp==2.0.1
- # via sphinx
-sphinxcontrib-jsmath==1.0.1
- # via sphinx
-sphinxcontrib-qthelp==1.0.3
- # via sphinx
-sphinxcontrib-serializinghtml==1.1.5
- # via sphinx
-sphinxcontrib-spelling==8.0.0
- # via -r requirements/docs.in
-text-unidecode==1.3
- # via python-slugify
-unidecode==1.3.7
- # via python-slugify
-urllib3==2.1.0
- # via requests
-zipp==3.17.0
- # via importlib-metadata
diff --git a/requirements/py3.8/lint.txt b/requirements/py3.8/lint.txt
deleted file mode 100644
index d4f14963..00000000
--- a/requirements/py3.8/lint.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-# pip-compile --output-file=requirements/py3.8/lint.txt requirements/lint.in
-#
-astroid==3.0.2
- # via pylint
-dill==0.3.7
- # via pylint
-isort==5.13.2
- # via pylint
-mccabe==0.7.0
- # via pylint
-modernize==0.5
- # via saltpylint
-platformdirs==4.1.0
- # via pylint
-pycodestyle==2.11.1
- # via saltpylint
-pylint==3.0.3
- # via
- # -r requirements/lint.in
- # saltpylint
-saltpylint==2023.8.3
- # via -r requirements/lint.in
-tomli==2.0.1
- # via pylint
-tomlkit==0.12.3
- # via pylint
-typing-extensions==4.9.0
- # via
- # astroid
- # pylint
diff --git a/requirements/py3.8/tests.txt b/requirements/py3.8/tests.txt
deleted file mode 100644
index 24d4d192..00000000
--- a/requirements/py3.8/tests.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-# pip-compile --output-file=requirements/py3.8/tests.txt requirements/tests.in
-#
-attrs==23.1.0
- # via
- # pytest-salt-factories
- # pytest-skip-markers
-distlib==0.3.8
- # via virtualenv
-distro==1.8.0
- # via pytest-skip-markers
-exceptiongroup==1.2.0
- # via pytest
-filelock==3.13.1
- # via virtualenv
-iniconfig==2.0.0
- # via pytest
-msgpack==1.0.7
- # via pytest-salt-factories
-packaging==23.2
- # via pytest
-platformdirs==4.1.0
- # via virtualenv
-pluggy==1.3.0
- # via pytest
-psutil==5.9.6
- # via pytest-salt-factories
-pytest-helpers-namespace==2021.12.29
- # via pytest-salt-factories
-pytest-salt-factories==0.912.2
- # via -r requirements/tests.in
-pytest-skip-markers==1.5.0
- # via pytest-salt-factories
-pytest-tempdir==2019.10.12
- # via pytest-salt-factories
-pytest==7.4.3
- # via
- # -r requirements/tests.in
- # pytest-helpers-namespace
- # pytest-salt-factories
- # pytest-skip-markers
- # pytest-tempdir
-pyzmq==25.1.2
- # via pytest-salt-factories
-tomli==2.0.1
- # via pytest
-virtualenv==20.25.0
- # via pytest-salt-factories
diff --git a/requirements/py3.9/docs.txt b/requirements/py3.9/docs.txt
deleted file mode 100644
index 8aab136d..00000000
--- a/requirements/py3.9/docs.txt
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-# pip-compile --output-file=requirements/py3.9/docs.txt requirements/docs.in
-#
-alabaster==0.7.13
- # via sphinx
-babel==2.14.0
- # via sphinx
-beautifulsoup4==4.9.1
- # via sphinx-material-saltstack
-certifi==2023.11.17
- # via requests
-charset-normalizer==3.3.2
- # via requests
-css-html-js-minify==2.5.5
- # via sphinx-material-saltstack
-docutils==0.20.1
- # via
- # sphinx
- # sphinx-prompt
-idna==3.6
- # via requests
-imagesize==1.4.1
- # via sphinx
-importlib-metadata==7.0.0
- # via sphinx
-jinja2==3.1.2
- # via sphinx
-lxml==4.5.2
- # via sphinx-material-saltstack
-markupsafe==2.1.3
- # via jinja2
-packaging==23.2
- # via sphinx
-pyenchant==3.2.2
- # via sphinxcontrib-spelling
-pygments==2.17.2
- # via
- # sphinx
- # sphinx-prompt
-python-slugify[unidecode]==4.0.1
- # via sphinx-material-saltstack
-requests==2.31.0
- # via sphinx
-snowballstemmer==2.2.0
- # via sphinx
-soupsieve==2.5
- # via beautifulsoup4
-sphinx-material-saltstack==1.0.5
- # via -r requirements/docs.in
-sphinx-prompt==1.8.0
- # via -r requirements/docs.in
-sphinx==7.2.6
- # via
- # -r requirements/docs.in
- # sphinx-material-saltstack
- # sphinx-prompt
- # sphinxcontrib-applehelp
- # sphinxcontrib-devhelp
- # sphinxcontrib-htmlhelp
- # sphinxcontrib-qthelp
- # sphinxcontrib-serializinghtml
- # sphinxcontrib-spelling
-sphinxcontrib-applehelp==1.0.7
- # via sphinx
-sphinxcontrib-devhelp==1.0.5
- # via sphinx
-sphinxcontrib-htmlhelp==2.0.4
- # via sphinx
-sphinxcontrib-jsmath==1.0.1
- # via sphinx
-sphinxcontrib-qthelp==1.0.6
- # via sphinx
-sphinxcontrib-serializinghtml==1.1.9
- # via sphinx
-sphinxcontrib-spelling==8.0.0
- # via -r requirements/docs.in
-text-unidecode==1.3
- # via python-slugify
-unidecode==1.3.7
- # via python-slugify
-urllib3==2.1.0
- # via requests
-zipp==3.17.0
- # via importlib-metadata
diff --git a/requirements/py3.9/lint.txt b/requirements/py3.9/lint.txt
deleted file mode 100644
index 5cfdc7c4..00000000
--- a/requirements/py3.9/lint.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-# pip-compile --output-file=requirements/py3.9/lint.txt requirements/lint.in
-#
-astroid==3.0.2
- # via pylint
-dill==0.3.7
- # via pylint
-isort==5.13.2
- # via pylint
-mccabe==0.7.0
- # via pylint
-modernize==0.5
- # via saltpylint
-platformdirs==4.1.0
- # via pylint
-pycodestyle==2.11.1
- # via saltpylint
-pylint==3.0.3
- # via
- # -r requirements/lint.in
- # saltpylint
-saltpylint==2023.8.3
- # via -r requirements/lint.in
-tomli==2.0.1
- # via pylint
-tomlkit==0.12.3
- # via pylint
-typing-extensions==4.9.0
- # via
- # astroid
- # pylint
diff --git a/requirements/py3.9/tests.txt b/requirements/py3.9/tests.txt
deleted file mode 100644
index 321c23c3..00000000
--- a/requirements/py3.9/tests.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# This file is autogenerated by pip-compile
-# To update, run:
-#
-# pip-compile --output-file=requirements/py3.9/tests.txt requirements/tests.in
-#
-attrs==23.1.0
- # via
- # pytest-salt-factories
- # pytest-skip-markers
-distlib==0.3.8
- # via virtualenv
-distro==1.8.0
- # via pytest-skip-markers
-exceptiongroup==1.2.0
- # via pytest
-filelock==3.13.1
- # via virtualenv
-iniconfig==2.0.0
- # via pytest
-msgpack==1.0.7
- # via pytest-salt-factories
-packaging==23.2
- # via pytest
-platformdirs==4.1.0
- # via virtualenv
-pluggy==1.3.0
- # via pytest
-psutil==5.9.6
- # via pytest-salt-factories
-pytest-helpers-namespace==2021.12.29
- # via pytest-salt-factories
-pytest-salt-factories==0.912.2
- # via -r requirements/tests.in
-pytest-skip-markers==1.5.0
- # via pytest-salt-factories
-pytest-tempdir==2019.10.12
- # via pytest-salt-factories
-pytest==7.4.3
- # via
- # -r requirements/tests.in
- # pytest-helpers-namespace
- # pytest-salt-factories
- # pytest-skip-markers
- # pytest-tempdir
-pyzmq==25.1.2
- # via pytest-salt-factories
-tomli==2.0.1
- # via pytest
-virtualenv==20.25.0
- # via pytest-salt-factories
diff --git a/requirements/tests.in b/requirements/tests.in
deleted file mode 100644
index 9f292157..00000000
--- a/requirements/tests.in
+++ /dev/null
@@ -1,2 +0,0 @@
-pytest >= 6.1.0
-pytest-salt-factories >= 0.130.0
diff --git a/requirements/tests.txt b/requirements/tests.txt
deleted file mode 100644
index e69de29b..00000000
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 9a3fb7bc..00000000
--- a/setup.cfg
+++ /dev/null
@@ -1,79 +0,0 @@
-[metadata]
-name = saltext.mattermost
-description = Salt Extension for interacting with Mattermost
-long_description = file: README.md
-long_description_content_type = text/markdown
-author = EITR Technologies
-author_email = devops@eitr.tech
-keywords = salt-extension
-url = https://github.com/salt-extensions/saltext-mattermost
-project_urls =
- Source=https://github.com/salt-extensions/saltext-mattermost
- Tracker=https://github.com/salt-extensions/saltext-mattermost/issues
-license = Apache Software License
-classifiers =
- Programming Language :: Python
- Programming Language :: Cython
- Programming Language :: Python :: 3
- Programming Language :: Python :: 3 :: Only
- Programming Language :: Python :: 3.5
- Programming Language :: Python :: 3.6
- Programming Language :: Python :: 3.7
- Programming Language :: Python :: 3.8
- Programming Language :: Python :: 3.9
- Development Status :: 4 - Beta
- Intended Audience :: Developers
- License :: OSI Approved :: Apache Software License
-platforms = any
-
-[options]
-zip_safe = False
-include_package_data = True
-package_dir =
- =src
-packages = find_namespace:
-python_requires = >= 3.5
-setup_requires =
- wheel
- setuptools>=50.3.2
- setuptools_scm[toml]>=3.4
- setuptools-declarative-requirements
-install_requires =
- salt>=3003
- # Add other module install requirements above this line
-
-[options.packages.find]
-where = src
-exclude =
- tests
-
-# When targetting Salt < 3003, you can remove the other 'options.entry_points' section and use this one
-#[options.entry_points]
-#salt.loader=
-#
-
-[options.entry_points]
-salt.loader=
- saltext.mattermost = saltext.mattermost
-
-[requirements-files]
-install_requires = requirements/base.txt
-tests_require = requirements/tests.txt
-extras_require =
- dev = requirements/dev.txt
- tests = requirements/tests.txt
- docs = requirements/docs.txt
- docsauto = requirements/docs-auto.txt
- changelog = requirements/changelog.txt
-
-[bdist_wheel]
-# Use this option if your package is pure-python
-universal = 1
-
-[build_sphinx]
-source_dir = docs
-build_dir = build/sphinx
-
-[sdist]
-owner = root
-group = root
diff --git a/src/saltext/mattermost/loader.py b/src/saltext/mattermost/loader.py
deleted file mode 100644
index 5d2e0b65..00000000
--- a/src/saltext/mattermost/loader.py
+++ /dev/null
@@ -1,5 +0,0 @@
-"""
-Define the required entry-points functions in order for Salt to know
-what and from where it should load this extension's loaders
-"""
-from . import PACKAGE_ROOT # pylint: disable=unused-import
diff --git a/src/saltext/mattermost/modules/mattermost.py b/src/saltext/mattermost/modules/mattermost.py
index adb3cb7b..313a16f7 100644
--- a/src/saltext/mattermost/modules/mattermost.py
+++ b/src/saltext/mattermost/modules/mattermost.py
@@ -13,8 +13,6 @@
hook: peWcBiMOS9HrZG15peWcBiMOS9HrZG15
api_url: https://example.com
"""
-
-
import logging
import salt.utils.json
@@ -41,9 +39,7 @@ def _get_hook():
:return: String: the hook string
"""
- hook = __salt__["config.get"]("mattermost.hook") or __salt__["config.get"](
- "mattermost:hook"
- )
+ hook = __salt__["config.get"]("mattermost.hook") or __salt__["config.get"]("mattermost:hook")
if not hook:
raise SaltInvocationError("No Mattermost Hook found")
@@ -130,9 +126,9 @@ def post_message(message, channel=None, username=None, api_url=None, hook=None):
parameters["username"] = username
parameters["text"] = "```" + message + "```" # pre-formatted, fixed-width text
log.debug("Parameters: %s", parameters)
- data = "payload={}".format(
+ data = "payload={}".format( # pylint: disable=consider-using-f-string
salt.utils.json.dumps(parameters)
- ) # pylint: disable=blacklisted-function
+ )
result = salt.utils.mattermost.query(api_url=api_url, hook=hook, data=data)
return bool(result)
diff --git a/src/saltext/mattermost/returners/__init__.py b/src/saltext/mattermost/returners/__init__.py
index 5ad44a7f..27f7fc79 100644
--- a/src/saltext/mattermost/returners/__init__.py
+++ b/src/saltext/mattermost/returners/__init__.py
@@ -4,7 +4,6 @@
:func:`get_returner_options` is a general purpose function that returners may
use to fetch their configuration options.
"""
-
import logging
log = logging.getLogger(__name__)
@@ -83,9 +82,7 @@ def get_returner_options(virtualname=None, ret=None, attrs=None, **kwargs):
# override some values with relevant profile options
_options.update(
- _fetch_profile_opts(
- cfg, virtualname, __salt__, _options, profile_attr, profile_attrs
- )
+ _fetch_profile_opts(cfg, virtualname, __salt__, _options, profile_attr, profile_attrs)
)
# override some values with relevant options from
@@ -120,9 +117,9 @@ def _fetch_option(cfg, ret_config, virtualname, attr_name):
if isinstance(cfg, dict):
c_cfg = cfg
else:
- c_cfg = cfg("{}".format(virtualname), {})
+ c_cfg = cfg(f"{virtualname}", {})
- default_cfg_key = "{}.{}".format(virtualname, attr_name)
+ default_cfg_key = f"{virtualname}.{attr_name}"
if not ret_config:
# Using the default configuration key
if isinstance(cfg, dict):
@@ -134,9 +131,9 @@ def _fetch_option(cfg, ret_config, virtualname, attr_name):
return c_cfg.get(attr_name, cfg(default_cfg_key))
# Using ret_config to override the default configuration key
- ret_cfg = cfg("{}.{}".format(ret_config, virtualname), {})
+ ret_cfg = cfg(f"{ret_config}.{virtualname}", {})
- override_default_cfg_key = "{}.{}.{}".format(
+ override_default_cfg_key = "{}.{}.{}".format( # pylint: disable=consider-using-f-string
ret_config,
virtualname,
attr_name,
@@ -179,9 +176,7 @@ def _options_browser(cfg, ret_config, defaults, virtualname, options):
continue
-def _fetch_profile_opts(
- cfg, virtualname, __salt__, _options, profile_attr, profile_attrs
-):
+def _fetch_profile_opts(cfg, virtualname, __salt__, _options, profile_attr, profile_attrs):
"""
Fetches profile specific options if applicable
@@ -208,7 +203,4 @@ def _fetch_profile_opts(
if not creds:
return {}
- return {
- pattr: creds.get("{}.{}".format(virtualname, profile_attrs[pattr]))
- for pattr in profile_attrs
- }
+ return {pattr: creds.get(f"{virtualname}.{profile_attrs[pattr]}") for pattr in profile_attrs}
diff --git a/src/saltext/mattermost/returners/mattermost_returner.py b/src/saltext/mattermost/returners/mattermost_returner.py
index fae03a02..3042dbea 100644
--- a/src/saltext/mattermost/returners/mattermost_returner.py
+++ b/src/saltext/mattermost/returners/mattermost_returner.py
@@ -42,7 +42,6 @@
salt '*' test.ping --return mattermost --return_kwargs '{'channel': '#random'}'
"""
-
import logging
import salt.returners
@@ -100,7 +99,7 @@ def returner(ret):
returns = ret.get("return")
- message = "id: {}\r\nfunction: {}\r\nfunction args: {}\r\njid: {}\r\nreturn: {}\r\n".format(
+ message = "id: {}\r\nfunction: {}\r\nfunction args: {}\r\njid: {}\r\nreturn: {}\r\n".format( # pylint: disable=consider-using-f-string
ret.get("id"), ret.get("fun"), ret.get("fun_args"), ret.get("jid"), returns
)
@@ -126,9 +125,9 @@ def event_return(events):
for event in events:
log.debug("Event: %s", event)
log.debug("Event data: %s", event["data"])
- message = "tag: {}\r\n".format(event["tag"])
+ message = "tag: {}\r\n".format(event["tag"]) # pylint: disable=consider-using-f-string
for key, value in event["data"].items():
- message += "{}: {}\r\n".format(key, value)
+ message += f"{key}: {value}\r\n"
result = post_message(channel, message, username, api_url, hook)
if not result:
is_ok = False
@@ -157,7 +156,7 @@ def post_message(channel, message, username, api_url, hook):
result = salt.utils.mattermost.query(
api_url=api_url,
hook=hook,
- data="payload={}".format(salt.utils.json.dumps(parameters)),
+ data=f"payload={salt.utils.json.dumps(parameters)}",
)
log.debug("result %s", result)
diff --git a/src/saltext/mattermost/runners/mattermost.py b/src/saltext/mattermost/runners/mattermost.py
index 40309f62..f3778da5 100644
--- a/src/saltext/mattermost/runners/mattermost.py
+++ b/src/saltext/mattermost/runners/mattermost.py
@@ -13,17 +13,14 @@
hook: peWcBiMOS9HrZG15peWcBiMOS9HrZG15
api_url: https://example.com
"""
-
-
import logging
import salt.utils.json
-
-# pylint: disable=import-error,no-name-in-module,redefined-builtin
import salt.utils.mattermost
+from salt.exceptions import SaltInvocationError
+# pylint: disable=import-error,no-name-in-module,redefined-builtin
# pylint: enable=import-error,no-name-in-module
-from salt.exceptions import SaltInvocationError
log = logging.getLogger(__name__)
@@ -43,9 +40,7 @@ def _get_hook():
Retrieves and return the Mattermost's configured hook
:return: String: the hook string
"""
- hook = __salt__["config.get"]("mattermost.hook") or __salt__["config.get"](
- "mattermost:hook"
- )
+ hook = __salt__["config.get"]("mattermost.hook") or __salt__["config.get"]("mattermost:hook")
if not hook:
raise SaltInvocationError("No Mattermost Hook found")
@@ -129,9 +124,7 @@ def post_message(message, channel=None, username=None, api_url=None, hook=None):
parameters["text"] = "```" + message + "```" # pre-formatted, fixed-width text
log.debug("Parameters: %s", parameters)
data = salt.utils.json.dumps(parameters)
- result = salt.utils.mattermost.query(
- api_url=api_url, hook=hook, data="payload={}".format(data)
- )
+ result = salt.utils.mattermost.query(api_url=api_url, hook=hook, data=f"payload={data}")
if result:
return True
@@ -166,10 +159,8 @@ def post_event(event, channel=None, username=None, api_url=None, hook=None):
log.debug("Event: %s", event)
log.debug("Event data: %s", event["data"])
- message = "tag: {}\r\n".format(event["tag"])
+ message = "tag: {}\r\n".format(event["tag"]) # pylint: disable=consider-using-f-string
for key, value in event["data"].items():
- message += "{}: {}\r\n".format(key, value)
- result = post_message(
- message, channel=channel, username=username, api_url=api_url, hook=hook
- )
+ message += f"{key}: {value}\r\n"
+ result = post_message(message, channel=channel, username=username, api_url=api_url, hook=hook)
return bool(result)
diff --git a/src/saltext/mattermost/utils/mattermost.py b/src/saltext/mattermost/utils/mattermost.py
index b8b49c32..2921fec0 100644
--- a/src/saltext/mattermost/utils/mattermost.py
+++ b/src/saltext/mattermost/utils/mattermost.py
@@ -1,16 +1,18 @@
"""
Library for interacting with Mattermost Incoming Webhooks
-:configuration: This module can be used by specifying the name of a
- configuration profile in the minion config, minion pillar, or master
- config.
+
+ :configuration: This module can be used by specifying the name of a
+ configuration profile in the minion config, minion pillar, or master
+ config.
+
For example:
+
.. code-block:: yaml
mattermost:
hook: 3tdgo8restnxiykdx88wqtxryr
api_url: https://example.com
"""
-
import http.client
import logging
import urllib.parse
@@ -39,7 +41,7 @@ def query(hook=None, api_url=None, data=None):
result = salt.utils.http.query(url, method, data=data, decode=True, status=True)
if result.get("status", None) == http.client.OK:
- ret["message"] = "Message posted {} correctly".format(data)
+ ret["message"] = f"Message posted {data} correctly"
return ret
elif result.get("status", None) == http.client.NO_CONTENT:
return True
diff --git a/requirements/changelog.txt b/tests/functional/__init__.py
similarity index 100%
rename from requirements/changelog.txt
rename to tests/functional/__init__.py
diff --git a/tests/pytests/functional/conftest.py b/tests/functional/conftest.py
similarity index 91%
rename from tests/pytests/functional/conftest.py
rename to tests/functional/conftest.py
index 2fb2246b..2c7c84a3 100644
--- a/tests/pytests/functional/conftest.py
+++ b/tests/functional/conftest.py
@@ -33,8 +33,8 @@ def state_tree_prod(tmp_path_factory):
@pytest.fixture(scope="module")
def minion_config_defaults():
"""
- Functional test modules can provide this fixture to tweak the default configuration dictionary
- passed to the minion factory
+ Functional test modules can provide this fixture to tweak the default
+ configuration dictionary passed to the minion factory
"""
return {}
@@ -81,8 +81,8 @@ def minion_opts(
@pytest.fixture(scope="module")
def master_config_defaults():
"""
- Functional test modules can provide this fixture to tweak the default configuration dictionary
- passed to the master factory
+ Functional test modules can provide this fixture to tweak the default
+ configuration dictionary passed to the master factory
"""
return {}
@@ -138,3 +138,13 @@ def reset_loaders_state(loaders):
finally:
# Reset the loaders state
loaders.reset_state()
+
+
+@pytest.fixture(scope="module")
+def modules(loaders):
+ return loaders.modules
+
+
+@pytest.fixture(scope="module")
+def states(loaders):
+ return loaders.states
diff --git a/requirements/dev.txt b/tests/functional/modules/__init__.py
similarity index 100%
rename from requirements/dev.txt
rename to tests/functional/modules/__init__.py
diff --git a/requirements/docs-auto.txt b/tests/functional/states/__init__.py
similarity index 100%
rename from requirements/docs-auto.txt
rename to tests/functional/states/__init__.py
diff --git a/requirements/docs.txt b/tests/integration/modules/__init__.py
similarity index 100%
rename from requirements/docs.txt
rename to tests/integration/modules/__init__.py
diff --git a/requirements/lint.txt b/tests/integration/states/__init__.py
similarity index 100%
rename from requirements/lint.txt
rename to tests/integration/states/__init__.py
diff --git a/tests/pytests/integration/conftest.py b/tests/pytests/integration/conftest.py
deleted file mode 100644
index de99d98b..00000000
--- a/tests/pytests/integration/conftest.py
+++ /dev/null
@@ -1,109 +0,0 @@
-"""
- tests.pytests.integration.conftest
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- PyTest fixtures
-"""
-
-import logging
-
-import pytest
-
-log = logging.getLogger(__name__)
-
-
-@pytest.fixture(scope="package")
-def salt_master(salt_master_factory):
- """
- A running salt-master fixture
- """
- with salt_master_factory.started():
- yield salt_master_factory
-
-
-@pytest.fixture(scope="package")
-def salt_minion(salt_master, salt_minion_factory):
- """
- A running salt-minion fixture
- """
- assert salt_master.is_running()
- with salt_minion_factory.started():
- # Sync All
- salt_call_cli = salt_minion_factory.salt_call_cli()
- ret = salt_call_cli.run("saltutil.sync_all", _timeout=120)
- assert ret.returncode == 0, ret
- yield salt_minion_factory
-
-
-@pytest.fixture(scope="module")
-def salt_sub_minion(salt_master, salt_sub_minion_factory):
- """
- A second running salt-minion fixture
- """
- assert salt_master.is_running()
- with salt_sub_minion_factory.started():
- # Sync All
- salt_call_cli = salt_sub_minion_factory.salt_call_cli()
- ret = salt_call_cli.run("saltutil.sync_all", _timeout=120)
- assert ret.returncode == 0, ret
- yield salt_sub_minion_factory
-
-
-@pytest.fixture(scope="package")
-def salt_cli(salt_master):
- """
- The ``salt`` CLI as a fixture against the running master
- """
- assert salt_master.is_running()
- return salt_master.salt_cli(timeout=30)
-
-
-@pytest.fixture(scope="package")
-def salt_call_cli(salt_minion):
- """
- The ``salt-call`` CLI as a fixture against the running minion
- """
- assert salt_minion.is_running()
- return salt_minion.salt_call_cli(timeout=30)
-
-
-@pytest.fixture(scope="package")
-def salt_cp_cli(salt_master):
- """
- The ``salt-cp`` CLI as a fixture against the running master
- """
- assert salt_master.is_running()
- return salt_master.salt_cp_cli(timeout=30)
-
-
-@pytest.fixture(scope="package")
-def salt_key_cli(salt_master):
- """
- The ``salt-key`` CLI as a fixture against the running master
- """
- assert salt_master.is_running()
- return salt_master.salt_key_cli(timeout=30)
-
-
-@pytest.fixture(scope="package")
-def salt_run_cli(salt_master):
- """
- The ``salt-run`` CLI as a fixture against the running master
- """
- assert salt_master.is_running()
- return salt_master.salt_run_cli(timeout=30)
-
-
-@pytest.fixture(scope="module")
-def salt_ssh_cli(salt_master, salt_ssh_roster_file, sshd_config_dir):
- """
- The ``salt-ssh`` CLI as a fixture against the running master
- """
- assert salt_master.is_running()
- return salt_master.salt_ssh_cli(
- timeout=180,
- roster_file=salt_ssh_roster_file,
- target_host="localhost",
- client_key=str(sshd_config_dir / "client_key"),
- base_script_args=["--ignore-host-keys"],
- )
diff --git a/tests/pytests/unit/conftest.py b/tests/unit/conftest.py
similarity index 71%
rename from tests/pytests/unit/conftest.py
rename to tests/unit/conftest.py
index f3e28f90..3e3fa4aa 100644
--- a/tests/pytests/unit/conftest.py
+++ b/tests/unit/conftest.py
@@ -1,24 +1,17 @@
-import asyncio
-
import pytest
-
import salt.config
-import salt.transport.tcp
-from tests.support.mock import MagicMock, patch
@pytest.fixture
def minion_opts(tmp_path):
"""
- Default minion configuration with relative temporary paths to not require root permissions.
+ Default minion configuration with relative temporary paths to not
+ require root permissions.
"""
root_dir = tmp_path / "minion"
opts = salt.config.DEFAULT_MINION_OPTS.copy()
opts["__role"] = "minion"
opts["root_dir"] = str(root_dir)
- opts["master_uri"] = "tcp://{ip}:{port}".format(
- ip="127.0.0.1", port=opts["master_port"]
- )
for name in ("cachedir", "pki_dir", "sock_dir", "conf_dir"):
dirpath = root_dir / name
dirpath.mkdir(parents=True)
@@ -30,7 +23,8 @@ def minion_opts(tmp_path):
@pytest.fixture
def master_opts(tmp_path):
"""
- Default master configuration with relative temporary paths to not require root permissions.
+ Default master configuration with relative temporary paths to not
+ require root permissions.
"""
root_dir = tmp_path / "master"
opts = salt.config.master_config(None)
@@ -47,7 +41,8 @@ def master_opts(tmp_path):
@pytest.fixture
def syndic_opts(tmp_path):
"""
- Default master configuration with relative temporary paths to not require root permissions.
+ Default master configuration with relative temporary paths to not
+ require root permissions.
"""
root_dir = tmp_path / "syndic"
opts = salt.config.DEFAULT_MINION_OPTS.copy()
@@ -60,14 +55,3 @@ def syndic_opts(tmp_path):
opts[name] = str(dirpath)
opts["log_file"] = "logs/syndic.log"
return opts
-
-
-@pytest.fixture
-def mocked_tcp_pub_client():
- transport = MagicMock(spec=salt.transport.tcp.TCPPubClient)
- transport.connect = MagicMock()
- future = asyncio.Future()
- transport.connect.return_value = future
- future.set_result(True)
- with patch("salt.transport.tcp.TCPPubClient", transport):
- yield
diff --git a/requirements/py3.5/docs.txt b/tests/unit/modules/__init__.py
similarity index 100%
rename from requirements/py3.5/docs.txt
rename to tests/unit/modules/__init__.py
diff --git a/tests/unit/modules/test_mattermost.py b/tests/unit/modules/test_mattermost.py
new file mode 100644
index 00000000..1c458b2e
--- /dev/null
+++ b/tests/unit/modules/test_mattermost.py
@@ -0,0 +1,14 @@
+import pytest
+import saltext.mattermost.modules.mattermost as mattermost_module
+
+
+@pytest.fixture
+def configure_loader_modules():
+ module_globals = {}
+ return {
+ mattermost_module: module_globals,
+ }
+
+
+def test_replace_this_this_with_something_meaningful():
+ assert True
diff --git a/requirements/py3.5/lint.txt b/tests/unit/states/__init__.py
similarity index 100%
rename from requirements/py3.5/lint.txt
rename to tests/unit/states/__init__.py