From 73fb592231e542e59f2642371ba145d13a6d10f5 Mon Sep 17 00:00:00 2001 From: nicholasmhughes Date: Sun, 31 Dec 2023 23:12:32 -0500 Subject: [PATCH 1/9] copier profile 0.2.6 --- .copier-answers.yml | 20 + .github/ISSUE_TEMPLATE/bug_report.md | 7 +- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/ISSUE_TEMPLATE/docs.md | 6 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/ISSUE_TEMPLATE/tech-debt.md | 13 + .gitignore | 20 +- .pre-commit-config.yaml | 191 +--- .pre-commit-hooks/check-cli-examples.py | 2 +- .pre-commit-hooks/make-autodocs.py | 145 ++- .pylintrc | 837 ++++++++++++------ README.md | 47 +- changelog/.gitignore | 1 - changelog/.template.jinja | 15 + docs/changelog.md | 12 + docs/conf.py | 33 +- docs/index.rst | 23 +- docs/ref/clouds/index.rst | 12 + .../clouds/saltext.azurerm.clouds.azurerm.rst | 57 +- docs/ref/fileserver/index.rst | 12 + .../saltext.azurerm.fileserver.azurefs.rst | 5 + docs/ref/modules/index.rst | 24 + ...altext.azurerm.modules.azurerm_compute.rst | 46 +- ...dules.azurerm_compute_availability_set.rst | 33 +- ...t.azurerm.modules.azurerm_compute_disk.rst | 34 +- ....azurerm.modules.azurerm_compute_image.rst | 33 +- ...odules.azurerm_compute_virtual_machine.rst | 51 +- ...rerm_compute_virtual_machine_extension.rst | 33 +- ....azurerm_compute_virtual_machine_image.rst | 34 +- .../saltext.azurerm.modules.azurerm_dns.rst | 39 +- ...t.azurerm.modules.azurerm_keyvault_key.rst | 45 +- ...zurerm.modules.azurerm_keyvault_secret.rst | 42 +- ...azurerm.modules.azurerm_keyvault_vault.rst | 9 +- ...altext.azurerm.modules.azurerm_network.rst | 90 +- ...ltext.azurerm.modules.azurerm_resource.rst | 57 +- docs/ref/states/index.rst | 20 + ...saltext.azurerm.states.azurerm_compute.rst | 31 +- ...tates.azurerm_compute_availability_set.rst | 18 +- ...states.azurerm_compute_virtual_machine.rst | 18 +- .../saltext.azurerm.states.azurerm_dns.rst | 33 +- ...xt.azurerm.states.azurerm_keyvault_key.rst | 30 +- ...azurerm.states.azurerm_keyvault_secret.rst | 30 +- ....azurerm.states.azurerm_keyvault_vault.rst | 9 +- ...saltext.azurerm.states.azurerm_network.rst | 47 +- ...altext.azurerm.states.azurerm_resource.rst | 35 +- docs/ref/utils/index.rst | 13 + .../utils/saltext.azurerm.utils.azurerm.rst | 32 +- docs/ref/utils/saltext.azurerm.utils.rst | 5 + docs/topics/authentication.rst | 61 +- docs/topics/installation.md | 36 + noxfile.py | 37 +- pyproject.toml | 130 ++- setup.cfg | 126 --- setup.py | 16 +- src/saltext/azurerm/clouds/azurerm.py | 53 +- src/saltext/azurerm/fileserver/azurefs.py | 6 +- .../azurerm_compute_availability_set.py | 4 +- .../azurerm/modules/azurerm_compute_image.py | 6 +- .../azurerm_compute_virtual_machine.py | 12 +- ...urerm_compute_virtual_machine_extension.py | 2 +- src/saltext/azurerm/modules/azurerm_dns.py | 10 +- .../azurerm/modules/azurerm_keyvault_key.py | 7 +- .../modules/azurerm_keyvault_secret.py | 5 + .../azurerm/modules/azurerm_keyvault_vault.py | 6 +- .../azurerm/modules/azurerm_network.py | 64 +- .../azurerm/modules/azurerm_resource.py | 28 +- .../azurerm_compute_availability_set.py | 26 +- .../states/azurerm_compute_virtual_machine.py | 18 +- src/saltext/azurerm/states/azurerm_dns.py | 67 +- .../azurerm/states/azurerm_keyvault_key.py | 18 +- .../azurerm/states/azurerm_keyvault_secret.py | 12 +- .../azurerm/states/azurerm_keyvault_vault.py | 20 +- src/saltext/azurerm/states/azurerm_network.py | 294 +++--- .../azurerm/states/azurerm_resource.py | 88 +- src/saltext/azurerm/utils/azurerm.py | 4 +- src/saltext/azurerm/version.py | 2 - tests/conftest.py | 12 + tests/functional/__init__.py | 0 tests/functional/conftest.py | 150 ++++ tests/integration/conftest.py | 4 +- tests/unit/conftest.py | 57 ++ 81 files changed, 1873 insertions(+), 1861 deletions(-) create mode 100644 .copier-answers.yml create mode 100644 .github/ISSUE_TEMPLATE/tech-debt.md mode change 100644 => 100755 .pre-commit-config.yaml mode change 100644 => 100755 .pylintrc delete mode 100644 changelog/.gitignore create mode 100644 changelog/.template.jinja create mode 100644 docs/changelog.md mode change 100644 => 100755 docs/conf.py create mode 100644 docs/ref/clouds/index.rst create mode 100644 docs/ref/fileserver/index.rst create mode 100644 docs/ref/fileserver/saltext.azurerm.fileserver.azurefs.rst create mode 100644 docs/ref/modules/index.rst create mode 100644 docs/ref/states/index.rst create mode 100644 docs/ref/utils/index.rst create mode 100644 docs/ref/utils/saltext.azurerm.utils.rst create mode 100644 docs/topics/installation.md mode change 100644 => 100755 noxfile.py delete mode 100644 setup.cfg delete mode 100644 src/saltext/azurerm/version.py create mode 100644 tests/functional/__init__.py create mode 100644 tests/functional/conftest.py create mode 100644 tests/unit/conftest.py diff --git a/.copier-answers.yml b/.copier-answers.yml new file mode 100644 index 0000000..9e94ced --- /dev/null +++ b/.copier-answers.yml @@ -0,0 +1,20 @@ +# 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: [] +max_salt_version: 3006 +no_saltext_namespace: false +package_name: azurerm +project_name: azurerm +python_requires: '3.8' +salt_version: '3005' +source_url: https://github.com/salt-extensions/saltext-azurerm +ssh_fixtures: false +summary: Salt Extension for interacting with Microsoft Azure +tracker_url: https://github.com/salt-extensions/saltext-azurerm/issues +url: https://github.com/salt-extensions/saltext-azurerm diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c1d1e78..b232a42 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Bug report about: Create a report to help us improve title: "[BUG]" -labels: bug, needs triage +labels: bug, needs-triage assignees: '' --- @@ -21,6 +21,9 @@ Please be as specific as possible and give set-up 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** @@ -36,7 +39,7 @@ If applicable, add screenshots to help explain your problem.
salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) -``` +```yaml PASTE HERE ```
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index dfec2ac..4cf0d28 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -10,5 +10,5 @@ contact_links: url: https://web.libera.chat/#salt about: Please ask and answer questions here. - name: Security vulnerabilities - email: security@saltstack.com + 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 index d36b0c9..59af749 100644 --- a/.github/ISSUE_TEMPLATE/docs.md +++ b/.github/ISSUE_TEMPLATE/docs.md @@ -2,7 +2,7 @@ name: Docs about: Issue related to Salt Documentation title: "[DOCS]" -labels: documentation, needs triage +labels: documentation, needs-triage assignees: '' --- @@ -14,10 +14,10 @@ A clear and concise description of what the problem is. Ex. I'm always frustrate What did you expect to see in the documentation that is missing or needs updating? **Type of documentation** -This could be Salt modules or tutorital topics. +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 about the feature request here. +Add any other context or screenshots here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index cb2ac2d..0e0a390 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,7 +2,7 @@ name: Feature request about: Suggest an idea for this project title: "[FEATURE REQUEST]" -labels: enhancement, needs triage +labels: feature, needs-triage assignees: '' --- diff --git a/.github/ISSUE_TEMPLATE/tech-debt.md b/.github/ISSUE_TEMPLATE/tech-debt.md new file mode 100644 index 0000000..5a546c6 --- /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/.gitignore b/.gitignore index 737a78f..45bf30e 100644 --- a/.gitignore +++ b/.gitignore @@ -110,12 +110,6 @@ ENV/ env.bak/ venv.bak/ -# vscode -.vscode/ - -#salt env -Saltfile - # Spyder project settings .spyderproject .spyproject @@ -134,15 +128,17 @@ dmypy.json # Pyre type checker .pyre/ +# Ignore the setuptools_scm auto-generated version module +src/saltext/azurerm/version.py + # Ignore CI generated artifacts artifacts/ -# Just a dir for local whatever -local/ - +# IDE +.vscode/ .DS_Store .idea/ -src/.DS_Store -src/saltext/.DS_Store -.vscode/ *.swp + +#salt env +Saltfile diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml old mode 100644 new mode 100755 index 735e706..e039c42 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,16 +2,14 @@ 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. - exclude: ^(docs/.*\.rst)$ args: [--markdown-linebreak-ext=md] - id: mixed-line-ending # Replaces or checks mixed line ending. args: [--fix=lf] - id: end-of-file-fixer # Makes sure files end in a newline and only a newline. - exclude: ^(docs/.*\.rst)$ - id: check-merge-conflict # Check for files that contain merge conflict strings. - id: check-ast # Simply check whether files parse as valid python. @@ -39,13 +37,18 @@ 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 name: Salt extensions docstrings auto-fixes files: ^src/saltext/azurerm/.*\.py$ args: [--silent] + + - repo: https://github.com/s0undt3ch/salt-rewrite + # Automatically rewrite code with known rules + rev: 2.5.2 + hooks: - id: salt-rewrite alias: rewrite-tests name: Rewrite the test suite @@ -53,49 +56,53 @@ repos: args: [--silent, -E, fix_docstrings] - repo: https://github.com/asottile/pyupgrade - rev: v2.38.4 + rev: v2.37.2 hooks: - id: pyupgrade - name: Rewrite Code to be Py3+ + name: Rewrite Code to be Py3.8+ args: [ - --py3-plus + --py38-plus ] exclude: src/saltext/azurerm/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/azurerm/version.py - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 22.6.0 hooks: - id: black args: [-l 100] exclude: src/saltext/azurerm/version.py - - repo: https://github.com/asottile/blacken-docs - rev: v1.10.0 + - repo: https://github.com/adamchainz/blacken-docs + rev: v1.12.1 hooks: - id: blacken-docs args: [--skip-errors] files: ^(docs/.*\.rst|src/saltext/azurerm/.*\.py)$ - additional_dependencies: [black==21.7b0] + additional_dependencies: + - black==22.6.0 # <---- Formatting ----------------------------------------------------------------------------- # ----- Security ------------------------------------------------------------------------------> - repo: https://github.com/PyCQA/bandit - rev: "1.7.0" + rev: "1.7.4" hooks: - id: bandit alias: bandit-salt name: Run bandit against the code base args: [--silent, -lll, --skip, B701] exclude: src/saltext/azurerm/version.py + - repo: https://github.com/PyCQA/bandit + rev: "1.7.4" + hooks: - id: bandit alias: bandit-tests name: Run bandit against the test suite @@ -116,6 +123,10 @@ repos: - -e - lint-code-pre-commit - -- + + - repo: https://github.com/saltstack/mirrors-nox + rev: v2021.6.12 + hooks: - id: nox alias: lint-tests name: Lint Tests @@ -126,155 +137,3 @@ repos: - 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.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 - - - id: pip-tools-compile - alias: compile-3.10-test-requirements - name: Py3.10 Test Requirements - files: ^requirements/tests.in$ - pass_filenames: false - args: - - -v - - --py-version=3.10 - - --platform=linux - - requirements/tests.in - # <---- Static Test Requirements --------------------------------------------------------------- - - # ----- Static Lint Requirements --------------------------------------------------------------> - - 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 - - - id: pip-tools-compile - alias: compile-3.10-test-requirements - name: Py3.10 Lint Requirements - files: ^requirements/lint.in$ - pass_filenames: false - args: - - -v - - --py-version=3.10 - - --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 - - - id: pip-tools-compile - alias: compile-3.10-test-requirements - name: Py3.10 Docs Requirements - files: ^requirements/docs.in$ - pass_filenames: false - args: - - -v - - --py-version=3.10 - - --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 3ccaac4..281b4da 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" / " azurerm" / "modules" +EXECUTION_MODULES_PATH = CODE_ROOT / "src" / "saltext" / "azurerm" / "modules" def check_cli_examples(files): diff --git a/.pre-commit-hooks/make-autodocs.py b/.pre-commit-hooks/make-autodocs.py index b7a7e19..a5d4b62 100644 --- a/.pre-commit-hooks/make-autodocs.py +++ b/.pre-commit-hooks/make-autodocs.py @@ -1,60 +1,119 @@ +import ast +import os.path +import subprocess from pathlib import Path -autodocs = {} +repo_path = Path(subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).decode().strip()) +src_dir = repo_path / "src" / "saltext" / "azurerm" +doc_dir = repo_path / "docs" -loader_dirs = ( - "engines", - "modules", - "returners", - "states", -) +docs_by_kind = {} +changed_something = False -for ldir in loader_dirs: - autodocs[ldir] = [] -trans = str.maketrans({"_": r"\_"}) -docs_path = Path("docs") -ref_path = docs_path / "ref" +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 -for path in Path("src").glob("**/*.py"): - if path.name == "__init__.py": - continue - kind = path.parent.name - if kind in loader_dirs: - import_path = ".".join(path.with_suffix("").parts[1:]) - autodocs[kind].append(import_path) - rst_path = ref_path / kind / (import_path + ".rst") - if rst_path.is_file(): - continue - rst_path.parent.mkdir(parents=True, exist_ok=True) - rst_path.write_text( - f"""{import_path.translate(trans)} -{'='*len(import_path.translate(trans))} -.. currentmodule:: {'.'.join(import_path.split('.')[:-1])} +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 + -.. autodata:: {import_path.split('.')[-1]}""" +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.azurerm.{kind}: -for ldir in autodocs: - if not autodocs[ldir]: - continue - all_rst = ref_path / ldir / "all.rst" - if all_rst.is_file(): - continue - all_rst.parent.mkdir(parents=True, exist_ok=True) - all_rst.write_text( - f""" -.. all-saltext.azurerm.{ldir}: +{header} -{'-'*len(ldir)}-------- -{ldir.title()} Modules -{'-'*len(ldir)}-------- +.. currentmodule:: {common_path} .. autosummary:: :toctree: -{chr(10).join(sorted(' '+mod for mod in autodocs[ldir]))} +{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): + if path.name == "__init__.py": + path = path.parent + return ".".join(path.relative_to(repo_path / "src").with_suffix("").parts) + + +for path in src_dir.glob("*/*.py"): + if path.name != "__init__.py": + kind = path.parent.name + 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 + 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 / (import_path + ".rst") + rst_path.parent.mkdir(parents=True, exist_ok=True) + change = write_module(rst_path, path, use_virtualname=kind != "utils") + changed_something = changed_something or change + + write_index(index_rst, import_paths, kind) + + +# 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 4826282..5692f3b --- a/.pylintrc +++ b/.pylintrc @@ -1,412 +1,681 @@ -[MASTER] +[MAIN] -# Specify a configuration file. -#rcfile= +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=no + +# Clear in-memory caches upon conclusion of linting. Useful if running pylint +# in a server-like mode. +clear-cache-post-run=no + +# Load and enable all available extensions. Use --list-extensions to see a list +# all available extensions. +#enable-all-extensions= + +# In error mode, messages with a category besides ERROR or FATAL are +# suppressed, and no reports are done by default. Error mode is compatible with +# disabling specific errors. +#errors-only= + +# Always return a 0 (non-error) status code, even if lint errors are found. +# This is primarily useful in continuous integration scripts. +#exit-zero= + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code. +extension-pkg-allow-list= + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code. (This is an alternative name to extension-pkg-allow-list +# for backward compatibility.) +extension-pkg-whitelist= + +# Return non-zero exit code if any of these messages/categories are detected, +# even if score is above --fail-under value. Syntax same as enable. Messages +# specified are enabled, while categories only check already-enabled messages. +fail-on= + +# Specify a score threshold under which the program will exit with error. +fail-under=10 + +# Interpret the stdin as a python script, whose filename needs to be passed as +# the module_or_package argument. +#from-stdin= + +# Files or directories to be skipped. They should be base names, not paths. +ignore=CVS + +# Add files or directories matching the regular expressions patterns to the +# ignore-list. The regex matches against paths and can be in Posix or Windows +# format. Because '\\' represents the directory delimiter on Windows systems, +# it can't be used as an escape character. +ignore-paths= + +# Files or directories matching the regular expression patterns are skipped. +# The regex matches against base names, not paths. The default value ignores +# Emacs file locks +ignore-patterns=^\.# + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis). It +# supports qualified module names, as well as Unix pattern matching. +ignored-modules= # Python code to execute, usually for sys.path manipulation such as # pygtk.require(). #init-hook= -# Profiled execution. -profile=no +# 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=0 -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS,_version.py,noxfile.py +# Control the amount of potential inferred values when inferring a single +# object. This can help the performance when dealing with large functions or +# complex, nested conditions. +limit-inference-results=100 + +# List of plugins (as comma separated values of python module names) to load, +# usually to register additional checkers. +load-plugins= # Pickle collected data for later comparisons. persistent=yes -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins=saltpylint.pep8, - saltpylint.strings +# Minimum Python version to use for version dependent checks. Will default to +# the version used to run pylint. +py-version=3.10 -# Use multiple processes to speed up Pylint. -jobs=1 +# Discover python modules and packages in the file system subtree. +recursive=no + +# Add paths to the list of the source roots. Supports globbing patterns. The +# source root is an absolute path or a path relative to the current working +# directory used to determine a package namespace for modules located under the +# source root. +source-roots= + +# When enabled, pylint would attempt to guess common misconfiguration and emit +# user-friendly hints instead of false-positive error messages. +suggestion-mode=yes # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code -extension-pkg-whitelist= +# In verbose mode, extra non-checker-related info will be displayed. +#verbose= -[MESSAGES CONTROL] -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED -confidence= +[BASIC] -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time. See also the "--disable" option for examples. -#enable= +# Naming style matching correct argument names. +argument-naming-style=snake_case -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once).You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use"--disable=all --enable=classes -# --disable=W" -#disable= -disable=R, - I0011, - I0012, - I0013, - C0330, - E8116, - E812, - too-many-lines, - ungrouped-imports, - whitespace-before-colon, - wrong-import-position, - wrong-import-order, - un-indexed-curly-braces-error, - consider-using-f-string, - fixme - -# Disabled: -# R* [refactoring suggestions & reports] -# I0011 (locally-disabling) -# I0012 (locally-enabling) -# I0013 (file-ignored) -# C0330 (bad-continuation) Wrong hanging indentation before block (add 4 spaces). -# E8116 PEP8 E116: unexpected indentation (comment) -# E812* All PEP8 E12* - -[REPORTS] +# Regular expression matching correct argument names. Overrides argument- +# naming-style. If left empty, argument names will be checked with the set +# naming style. +#argument-rgx= -# Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html. You can also give a reporter class, eg -# mypackage.mymodule.MyReporterClass. -output-format=text +# Naming style matching correct attribute names. +attr-naming-style=snake_case -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no +# Regular expression matching correct attribute names. Overrides attr-naming- +# style. If left empty, attribute names will be checked with the set naming +# style. +#attr-rgx= -# Tells whether to display a full report or only the messages -reports=no +# Bad variable names which should always be refused, separated by a comma. +bad-names=foo, + bar, + baz, + toto, + tutu, + tata -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) +# Bad variable names regexes, separated by a comma. If names match any regex, +# they will always be refused +bad-names-rgxs= -# Add a comment according to your evaluation note. This is used by the global -# evaluation report (RP0004). -comment=no +# Naming style matching correct class attribute names. +class-attribute-naming-style=any -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details -#msg-template= +# Regular expression matching correct class attribute names. Overrides class- +# attribute-naming-style. If left empty, class attribute names will be checked +# with the set naming style. +#class-attribute-rgx= +# Naming style matching correct class constant names. +class-const-naming-style=UPPER_CASE -[LOGGING] +# Regular expression matching correct class constant names. Overrides class- +# const-naming-style. If left empty, class constant names will be checked with +# the set naming style. +#class-const-rgx= -# Logging modules to check that the string format arguments are in logging -# function parameter format -logging-modules=logging +# Naming style matching correct class names. +class-naming-style=PascalCase +# Regular expression matching correct class names. Overrides class-naming- +# style. If left empty, class names will be checked with the set naming style. +#class-rgx= -[SPELLING] +# Naming style matching correct constant names. +const-naming-style=UPPER_CASE -# Spelling dictionary name. Available dictionaries: none. To make it working -# install python-enchant package. -spelling-dict= +# Regular expression matching correct constant names. Overrides const-naming- +# style. If left empty, constant names will be checked with the set naming +# style. +#const-rgx= -# List of comma separated words that should not be checked. -spelling-ignore-words= +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 -# A path to a file that contains private dictionary; one word per line. -spelling-private-dict-file=.pylint-spelling-words +# Naming style matching correct function names. +function-naming-style=snake_case -# Tells whether to store unknown words to indicated private dictionary in -# --spelling-private-dict-file option instead of raising a message. -spelling-store-unknown-words=no +# Regular expression matching correct function names. Overrides function- +# naming-style. If left empty, function names will be checked with the set +# naming style. +#function-rgx= +# Good variable names which should always be accepted, separated by a comma. +good-names=i, + j, + k, + ex, + Run, + _ -[SIMILARITIES] +# Good variable names regexes, separated by a comma. If names match any regex, +# they will always be accepted +good-names-rgxs= -# Minimum lines number of a similarity. -min-similarity-lines=4 +# Include a hint for the correct naming format with invalid-name. +include-naming-hint=no -# Ignore comments when computing similarities. -ignore-comments=yes +# Naming style matching correct inline iteration names. +inlinevar-naming-style=any -# Ignore docstrings when computing similarities. -ignore-docstrings=yes +# Regular expression matching correct inline iteration names. Overrides +# inlinevar-naming-style. If left empty, inline iteration names will be checked +# with the set naming style. +#inlinevar-rgx= -# Ignore imports when computing similarities. -ignore-imports=no +# Naming style matching correct method names. +method-naming-style=snake_case +# Regular expression matching correct method names. Overrides method-naming- +# style. If left empty, method names will be checked with the set naming style. +#method-rgx= -[VARIABLES] +# Naming style matching correct module names. +module-naming-style=snake_case -# Tells whether we should check for unused import in __init__ files. -init-import=no +# Regular expression matching correct module names. Overrides module-naming- +# style. If left empty, module names will be checked with the set naming style. +#module-rgx= -# A regular expression matching the name of dummy variables (i.e. expectedly -# not used). -dummy-variables-rgx=_$|dummy +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins=__opts__, - __utils__, - __salt__, - __pillar__, - __grains__, - __context__, - __runner__, - __ret__, - __env__, - __low__, - __states__, - __lowstate__, - __running__, - __active_provider_name__, - __master_opts__, - __jid_event__, - __instance_id__, - __salt_system_encoding__, - __proxy__, - __serializers__, - __reg__, - __executors__, - __events__ +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=^_ -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_,_cb +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +# These decorators are taken in consideration only for invalid-name. +property-classes=abc.abstractproperty +# Regular expression matching correct type alias names. If left empty, type +# alias names will be checked with the set naming style. +#typealias-rgx= -[MISCELLANEOUS] +# Regular expression matching correct type variable names. If left empty, type +# variable names will be checked with the set naming style. +#typevar-rgx= -# List of note tags to take in consideration, separated by a comma. -notes=FIXME,XXX,TODO +# Naming style matching correct variable names. +variable-naming-style=snake_case +# Regular expression matching correct variable names. Overrides variable- +# naming-style. If left empty, variable names will be checked with the set +# naming style. +#variable-rgx= -[BASIC] -# List of builtins function names that should not be used, separated by a comma -bad-functions=map,filter,input +[CLASSES] -# Good variable names which should always be accepted, separated by a comma -good-names=i,j,k,ex,Run,_,log,pytest_plugins,__opts__,__context__ +# Warn about protected attribute access inside special methods +check-protected-access-in-special-methods=no -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__, + __new__, + setUp, + asyncSetUp, + __post_init__ -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit -# Include a hint for the correct naming format with invalid-name -include-naming-hint=no +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls -# Regular expression matching correct function names -function-rgx=[a-z_][a-z0-9_]{2,60}$ +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=mcs -# Naming hint for function names -function-name-hint=[a-z_][a-z0-9_]{2,60}$ -# Regular expression matching correct variable names -variable-rgx=[a-z_][a-z0-9_]{2,60}$ +[DESIGN] -# Naming hint for variable names -variable-name-hint=[a-z_][a-z0-9_]{2,60}$ +# List of regular expressions of class ancestor names to ignore when counting +# public methods (see R0903) +exclude-too-few-public-methods= -# Regular expression matching correct constant names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ +# List of qualified class names to ignore when counting class parents (see +# R0901) +ignored-parents= -# Naming hint for constant names -const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ +# Maximum number of arguments for function / method. +max-args=15 -# Regular expression matching correct attribute names -attr-rgx=[a-z_][a-z0-9_]{2,60}$ +# Maximum number of attributes for a class (see R0902). +max-attributes=7 -# Naming hint for attribute names -attr-name-hint=[a-z_][a-z0-9_]{2,60}$ +# Maximum number of boolean expressions in an if statement (see R0916). +max-bool-expr=5 -# Regular expression matching correct argument names -argument-rgx=[a-z_][a-z0-9_]{2,60}$ +# Maximum number of branch for function / method body. +max-branches=12 -# Naming hint for argument names -argument-name-hint=[a-z_][a-z0-9_]{2,60}$ +# Maximum number of locals for function / method body. +max-locals=15 -# Regular expression matching correct class attribute names -class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,60}|(__.*__))$ +# Maximum number of parents for a class (see R0901). +max-parents=7 -# Naming hint for class attribute names -class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,60}|(__.*__))$ +# Maximum number of public methods for a class (see R0904). +max-public-methods=25 -# Regular expression matching correct inline iteration names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ +# Maximum number of return / yield for function / method body. +max-returns=6 -# Naming hint for inline iteration names -inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ +# Maximum number of statements in function / method body. +max-statements=50 -# Regular expression matching correct class names -class-rgx=[A-Z_][a-zA-Z0-9]+$ +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 -# Naming hint for class names -class-name-hint=[A-Z_][a-zA-Z0-9]+$ -# Regular expression matching correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ +[EXCEPTIONS] -# Naming hint for module names -module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ +# Exceptions that will emit a warning when caught. +overgeneral-exceptions=builtins.BaseException,builtins.Exception -# Regular expression matching correct method names -method-rgx=[a-z_][a-z0-9_]{2,60}$ -# Naming hint for method names -method-name-hint=[a-z_][a-z0-9_]{2,60}$ +[FORMAT] -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=__.*__ +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 -[FORMAT] +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' # Maximum number of characters on a single line. -max-line-length=120 +max-line-length=100 -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^\s*(# )??$ +# Maximum number of lines in a module. +max-module-lines=2000 + +# Allow the body of a class to be on the same line as the declaration if body +# contains single statement. +single-line-class-stmt=no # Allow the body of an if to be on the same line as the test if there is no # else. single-line-if-stmt=no -# List of optional constructs for which whitespace checking is disabled -no-space-check=trailing-comma,dict-separator -# Maximum number of lines in a module -max-module-lines=1000 +[IMPORTS] -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' +# List of modules that can be imported at any level, not just the top level +# one. +allow-any-import-level= -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 +# Allow explicit reexports by alias from a package __init__. +allow-reexport-from-package=no -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format=LF +# Allow wildcard imports from modules that define __all__. +allow-wildcard-with-all=no +# Deprecated modules which should not be used, separated by a comma. +deprecated-modules= -[TYPECHECK] +# Output a graph (.gv or any supported image format) of external dependencies +# to the given file (report RP0402 must not be disabled). +ext-import-graph= -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes +# Output a graph (.gv or any supported image format) of all (i.e. internal and +# external) dependencies to the given file (report RP0402 must not be +# disabled). +import-graph= -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis -ignored-modules= +# Output a graph (.gv or any supported image format) of internal dependencies +# to the given file (report RP0402 must not be disabled). +int-import-graph= -# List of classes names for which member attributes should not be checked -# (useful for classes with attributes dynamically set). -ignored-classes= +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= -# When zope mode is activated, add a predefined set of Zope acquired attributes -# to generated-members. -zope=no +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E0201 when accessed. Python regular -# expressions are accepted. -generated-members= +# Couples of modules and preferred modules, separated by a comma. +preferred-modules= -[IMPORTS] +[LOGGING] -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub,TERMIOS,Bastion,rexec +# The type of string formatting that logging methods do. `old` means using % +# formatting, `new` is for `{}` formatting. +logging-format-style=old -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= +# Logging modules to check that the string format arguments are in logging +# function parameter format. +logging-modules=logging -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= +[MESSAGES CONTROL] +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, +# UNDEFINED. +confidence=HIGH, + CONTROL_FLOW, + INFERENCE, + INFERENCE_FAILURE, + UNDEFINED -[DESIGN] +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once). You can also use "--disable=all" to +# disable everything first and then re-enable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use "--disable=all --enable=classes +# --disable=W". +disable=R, + locally-disabled, + file-ignored, + unexpected-special-method-signature, + import-error, + no-member, + unsubscriptable-object, + blacklisted-name, + invalid-name, + missing-docstring, + empty-docstring, + unidiomatic-typecheck, + wrong-import-order, + ungrouped-imports, + wrong-import-position, + bad-mcs-method-argument, + bad-mcs-classmethod-argument, + line-too-long, + too-many-lines, + bad-continuation, + exec-used, + attribute-defined-outside-init, + protected-access, + reimported, + fixme, + global-statement, + unused-variable, + unused-argument, + redefined-outer-name, + redefined-builtin, + undefined-loop-variable, + logging-format-interpolation, + invalid-format-index, + line-too-long, + import-outside-toplevel, + deprecated-method, + keyword-arg-before-vararg, -# Maximum number of arguments for function / method -max-args=5 +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). See also the "--disable" option for examples. +enable=c-extension-no-member -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.* -# Maximum number of locals for function / method body -max-locals=15 +[METHOD_ARGS] -# Maximum number of return / yield for function / method body -max-returns=6 +# List of qualified names (i.e., library.method) which require a timeout +# parameter e.g. 'requests.api.get,requests.api.post' +timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request -# Maximum number of branch for function / method body -max-branches=12 -# Maximum number of statements in function / method body -max-statements=50 +[MISCELLANEOUS] -# Maximum number of parents for a class (see R0901). -max-parents=7 +# List of note tags to take in consideration, separated by a comma. +notes=FIXME, + XXX, + TODO -# Maximum number of attributes for a class (see R0902). -max-attributes=7 +# Regular expression of note tags to take in consideration. +notes-rgx= -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 +[REFACTORING] +# Maximum number of nested blocks for function / method body +max-nested-blocks=5 -[CLASSES] +# Complete name of functions that never returns. When checking for +# inconsistent-return-statements if a never returning function is called then +# it will be considered as an explicit return statement and no message will be +# printed. +never-returning-functions=sys.exit,argparse.parse_error -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls +[REPORTS] -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs +# Python expression which should return a score less than or equal to 10. You +# have access to the variables 'fatal', 'error', 'warning', 'refactor', +# 'convention', and 'info' which contain the number of messages in each +# category, as well as 'statement' which is the total number of statements +# analyzed. This score is used by the global evaluation report (RP0004). +evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)) -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict,_fields,_replace,_source,_make +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details. +msg-template= +# Set the output format. Available formats are text, parseable, colorized, json +# and msvs (visual studio). You can also give a reporter class, e.g. +# mypackage.mymodule.MyReporterClass. +#output-format= -[EXCEPTIONS] +# Tells whether to display a full report or only the messages. +reports=no + +# Activate the evaluation score. +score=yes + + +[SIMILARITIES] + +# Comments are removed from the similarity computation +ignore-comments=yes + +# Docstrings are removed from the similarity computation +ignore-docstrings=yes + +# Imports are removed from the similarity computation +ignore-imports=yes + +# Signatures are removed from the similarity computation +ignore-signatures=yes + +# Minimum lines number of a similarity. +min-similarity-lines=4 + + +[SPELLING] + +# Limits count of emitted suggestions for spelling mistakes. +max-spelling-suggestions=4 + +# Spelling dictionary name. No available dictionaries : You need to install the +# system dependency for enchant to work.. +spelling-dict= + +# List of comma separated words that should be considered directives if they +# appear at the beginning of a comment and should not be checked. +spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy: + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains the private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to the private dictionary (see the +# --spelling-private-dict-file option) instead of raising a message. +spelling-store-unknown-words=no + + +[STRING] + +# This flag controls whether inconsistent-quotes generates a warning when the +# character used as a quote delimiter is used inconsistently within a module. +check-quote-consistency=no + +# This flag controls whether the implicit-str-concat should generate a warning +# on implicit string concatenation in sequences defined over several lines. +check-str-concat-over-line-jumps=no + + +[TYPECHECK] + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members= + +# Tells whether to warn about missing members when the owner of the attribute +# is inferred to be None. +ignore-none=yes + +# This flag controls whether pylint should warn about no-member and similar +# checks whenever an opaque object is returned when inferring. The inference +# can return multiple potential results while evaluating a Python object, but +# some branches might not be evaluated, which results in partial inference. In +# that case, it might be useful to still emit no-member and other checks for +# the rest of the inferred objects. +ignore-on-opaque-inference=yes + +# List of symbolic message names to ignore for Mixin members. +ignored-checks-for-mixins=no-member, + not-async-context-manager, + not-context-manager, + attribute-defined-outside-init + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace + +# Show a hint with possible names when a member name was not found. The aspect +# of finding the hint is based on edit distance. +missing-member-hint=yes + +# The minimum edit distance a name should have in order to be considered a +# similar match for a missing member name. +missing-member-hint-distance=1 + +# The total number of similar names that should be taken in consideration when +# showing a hint for a missing member. +missing-member-max-choices=1 + +# Regex pattern to define which classes are considered mixins. +mixin-class-rgx=.*[Mm]ixin + +# List of decorators that change the signature of a decorated function. +signature-mutators= + + +[VARIABLES] + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid defining new builtins when possible. +additional-builtins=__opts__, + __salt__, + __pillar__, + __grains__, + __context__, + __runner__, + __ret__, + __env__, + __low__, + __states__, + __lowstate__, + __running__, + __active_provider_name__, + __master_opts__, + __jid_event__, + __instance_id__, + __salt_system_encoding__, + __proxy__, + __serializers__, + __reg__, + __executors__, + __events__ + +# Tells whether unused global variables should be treated as a violation. +allow-global-unused-variables=yes + +# List of names allowed to shadow builtins +allowed-redefined-builtins= + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_, + _cb + +# A regular expression matching the name of dummy variables (i.e. expected to +# not be used). +dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ + +# Argument names that match this expression will be ignored. +ignored-argument-names=_.*|^ignored_|^unused_ + +# Tells whether we should check for unused import in __init__ files. +init-import=no -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io diff --git a/README.md b/README.md index e14e064..82fa3cf 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Documentation Status](https://readthedocs.org/projects/saltext-azurerm/badge/?version=latest)](https://saltext-azurerm.readthedocs.io/en/latest/?badge=latest) -This is a collection of Salt extension modules for use with Microsoft Azure Resource Manager +Salt Extension for interacting with Microsoft Azure ## Security @@ -22,35 +22,36 @@ 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: - # Clone the repo - git clone --origin salt git@github.com:salt-extensions/saltext-azurerm.git +```bash +# Clone the repo +git clone --origin salt git@github.com:salt-extensions/saltext-azurerm.git - # Change to the repo dir - cd saltext-azurerm +# Change to the repo dir +cd saltext-azurerm - # Create a new venv - python3 -m venv env --prompt azurerm - source env/bin/activate +# Create a new venv +python3 -m venv env --prompt saltext-azurerm +source env/bin/activate - # On mac, you may need to upgrade pip - python -m pip install --upgrade pip +# 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 +# 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] +# 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 +# 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 -) +# 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: @@ -64,7 +65,7 @@ these areas: You could also contribute in other ways: * Writing blog posts -* Posting on social media about how you used Salt+Prometheus to solve your +* Posting on social media about how you used Salt+Azurerm to solve your problems, including videos * Giving talks at conferences * Publishing videos diff --git a/changelog/.gitignore b/changelog/.gitignore deleted file mode 100644 index f935021..0000000 --- a/changelog/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!.gitignore diff --git a/changelog/.template.jinja b/changelog/.template.jinja new file mode 100644 index 0000000..0cf429a --- /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/changelog.md b/docs/changelog.md new file mode 100644 index 0000000..2f5367b --- /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 e68ccc9..f54c4d7 --- 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.azurerm 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. @@ -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 7940e72..907055d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,11 +1,28 @@ -Welcome to Azure Resource Manager Documentation! +``saltext-azurerm``: Integrate Salt with Azurerm ================================================ +Salt Extension for interacting with Microsoft Azure + +.. toctree:: + :maxdepth: 2 + :caption: Guides + :hidden: + + topics/installation + .. toctree:: :maxdepth: 2 - :caption: Contents: + :caption: Provided Modules + :hidden: + + +.. toctree:: + :maxdepth: 2 + :caption: Reference + :hidden: + + changelog - all.rst Indices and tables ================== diff --git a/docs/ref/clouds/index.rst b/docs/ref/clouds/index.rst new file mode 100644 index 0000000..4977ef2 --- /dev/null +++ b/docs/ref/clouds/index.rst @@ -0,0 +1,12 @@ +.. all-saltext.azurerm.clouds: + +_____________ +Cloud Modules +_____________ + +.. currentmodule:: saltext.azurerm.clouds + +.. autosummary:: + :toctree: + + azurerm diff --git a/docs/ref/clouds/saltext.azurerm.clouds.azurerm.rst b/docs/ref/clouds/saltext.azurerm.clouds.azurerm.rst index 4ccd6de..608cdc9 100644 --- a/docs/ref/clouds/saltext.azurerm.clouds.azurerm.rst +++ b/docs/ref/clouds/saltext.azurerm.clouds.azurerm.rst @@ -1,56 +1,5 @@ -saltext.azurerm.clouds.azurerm -============================== +``azurerm`` +=========== .. automodule:: saltext.azurerm.clouds.azurerm - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - avail_images - avail_locations - avail_sizes - create - create_network_interface - create_or_update_vmextension - delete_blob - delete_interface - delete_managed_disk - destroy - get_api_versions - get_configured_provider - get_conn - get_conn_dict - get_dependencies - get_location - get_resource_by_id - list_blobs - list_nodes - list_nodes_full - list_resource_groups - list_storage_accounts - list_subnets - list_virtual_networks - request_instance - show_instance - start - stop - - - - - - - - - - - - - + :members: diff --git a/docs/ref/fileserver/index.rst b/docs/ref/fileserver/index.rst new file mode 100644 index 0000000..2960b6d --- /dev/null +++ b/docs/ref/fileserver/index.rst @@ -0,0 +1,12 @@ +.. all-saltext.azurerm.fileserver: + +__________________ +Fileserver Modules +__________________ + +.. currentmodule:: saltext.azurerm.fileserver + +.. autosummary:: + :toctree: + + azurefs diff --git a/docs/ref/fileserver/saltext.azurerm.fileserver.azurefs.rst b/docs/ref/fileserver/saltext.azurerm.fileserver.azurefs.rst new file mode 100644 index 0000000..8f10ca1 --- /dev/null +++ b/docs/ref/fileserver/saltext.azurerm.fileserver.azurefs.rst @@ -0,0 +1,5 @@ +``azurefs`` +=========== + +.. automodule:: saltext.azurerm.fileserver.azurefs + :members: diff --git a/docs/ref/modules/index.rst b/docs/ref/modules/index.rst new file mode 100644 index 0000000..833ab7f --- /dev/null +++ b/docs/ref/modules/index.rst @@ -0,0 +1,24 @@ +.. all-saltext.azurerm.modules: + +_________________ +Execution Modules +_________________ + +.. currentmodule:: saltext.azurerm.modules + +.. autosummary:: + :toctree: + + azurerm_compute + azurerm_compute_availability_set + azurerm_compute_disk + azurerm_compute_image + azurerm_compute_virtual_machine + azurerm_compute_virtual_machine_extension + azurerm_compute_virtual_machine_image + azurerm_dns + azurerm_keyvault_key + azurerm_keyvault_secret + azurerm_keyvault_vault + azurerm_network + azurerm_resource diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute.rst index fb0de28..eee5b6c 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute.rst @@ -1,45 +1,5 @@ -saltext.azurerm.modules.azurerm\_compute -======================================== +``azurerm_compute`` +=================== .. automodule:: saltext.azurerm.modules.azurerm_compute - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - availability_set_create_or_update - availability_set_delete - availability_set_get - availability_sets_list - availability_sets_list_available_sizes - virtual_machine_capture - virtual_machine_convert_to_managed_disks - virtual_machine_deallocate - virtual_machine_generalize - virtual_machine_get - virtual_machine_power_off - virtual_machine_redeploy - virtual_machine_restart - virtual_machine_start - virtual_machines_list - virtual_machines_list_all - virtual_machines_list_available_sizes - - - - - - - - - - - - - + :members: diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_availability_set.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_availability_set.rst index 73495b2..2ec65a3 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_availability_set.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_availability_set.rst @@ -1,32 +1,5 @@ -saltext.azurerm.modules.azurerm\_compute\_availability\_set -============================================================ +``azurerm_compute_availability_set`` +==================================== .. automodule:: saltext.azurerm.modules.azurerm_compute_availability_set - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - create_or_update - delete - get - list_ - list_available_sizes - - - - - - - - - - - - \ No newline at end of file + :members: diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_disk.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_disk.rst index 50f2376..64d583b 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_disk.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_disk.rst @@ -1,33 +1,5 @@ -saltext.azurerm.modules.azurerm\_compute\_disk -=============================================== +``azurerm_compute_disk`` +======================== .. automodule:: saltext.azurerm.modules.azurerm_compute_disk - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - get - delete - list_ - grant_access - revoke_access - - - - - - - - - - - - - + :members: diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_image.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_image.rst index cce6b95..b270b79 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_image.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_image.rst @@ -1,32 +1,5 @@ -saltext.azurerm.modules.azurerm\_compute\_image -================================================ +``azurerm_compute_image`` +========================= .. automodule:: saltext.azurerm.modules.azurerm_compute_image - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - create_or_update - delete - get - list_ - - - - - - - - - - - - - + :members: diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_virtual_machine.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_virtual_machine.rst index 0ac3bab..f6cccc3 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_virtual_machine.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_virtual_machine.rst @@ -1,50 +1,5 @@ -saltext.azurerm.modules.azurerm\_compute\_virtual\_machine -=========================================================== +``azurerm_compute_virtual_machine`` +=================================== .. automodule:: saltext.azurerm.modules.azurerm_compute_virtual_machine - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - create_or_update - delete - capture - get - assess_patches - convert_to_managed_disks - deallocate - generalize - list_ - virtual_machines_list_all - list_by_location - list_available_sizes - instance_view - perform_maintenance - power_off - reapply - reimage - restart - start - redeploy - retrieve_boot_diagnostics_data - simulate_eviction - - - - - - - - - - - - - + :members: diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_virtual_machine_extension.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_virtual_machine_extension.rst index 282a587..d38f12e 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_virtual_machine_extension.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_virtual_machine_extension.rst @@ -1,32 +1,5 @@ -saltext.azurerm.modules.azurerm\_compute\_virtual\_machine\_extension -====================================================================== +``azurerm_compute_virtual_machine_extension`` +============================================= .. automodule:: saltext.azurerm.modules.azurerm_compute_virtual_machine_extension - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - create_or_update - delete - get - list_ - - - - - - - - - - - - - + :members: diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_virtual_machine_image.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_virtual_machine_image.rst index b46f7df..82cfd9c 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_virtual_machine_image.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_compute_virtual_machine_image.rst @@ -1,33 +1,5 @@ -saltext.azurerm.modules.azurerm\_compute\_virtual\_machine\_image -================================================================== +``azurerm_compute_virtual_machine_image`` +========================================= .. automodule:: saltext.azurerm.modules.azurerm_compute_virtual_machine_image - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - get - list_ - list_offers - list_publishers - list_skus - - - - - - - - - - - - - + :members: diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_dns.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_dns.rst index 0d47ed9..fe7686d 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_dns.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_dns.rst @@ -1,38 +1,5 @@ -saltext.azurerm.modules.azurerm\_dns -==================================== +``azurerm_dns`` +=============== .. automodule:: saltext.azurerm.modules.azurerm_dns - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - record_set_create_or_update - record_set_delete - record_set_get - record_sets_list_by_dns_zone - record_sets_list_by_type - zone_create_or_update - zone_delete - zone_get - zones_list - zones_list_by_resource_group - - - - - - - - - - - - - + :members: diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_keyvault_key.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_keyvault_key.rst index f054066..7ae62b2 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_keyvault_key.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_keyvault_key.rst @@ -1,44 +1,5 @@ -saltext.azurerm.modules.azurerm\_keyvault\_key -============================================== +``azurerm_keyvault_key`` +======================== .. automodule:: saltext.azurerm.modules.azurerm_keyvault_key - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - backup_key - begin_delete_key - begin_recover_deleted_key - create_ec_key - create_key - create_rsa_key - get_deleted_key - get_key - get_key_client - import_key - list_ - list_deleted_keys - list_properties_of_key_versions - purge_deleted_key - restore_key_backup - update_key_properties - - - - - - - - - - - - - + :members: diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_keyvault_secret.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_keyvault_secret.rst index d91b4f6..84214c2 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_keyvault_secret.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_keyvault_secret.rst @@ -1,41 +1,5 @@ -saltext.azurerm.modules.azurerm\_keyvault\_secret -================================================= +``azurerm_keyvault_secret`` +=========================== .. automodule:: saltext.azurerm.modules.azurerm_keyvault_secret - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - backup_secret - delete_secret - get_deleted_secret - get_secret - get_secret_client - list_deleted_secrets - list_properties_of_secrets - list_properties_of_secret_versions - purge_deleted_secret - recover_deleted_secret - restore_secret_backup - set_secret - update_secret_properties - - - - - - - - - - - - - + :members: diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_keyvault_vault.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_keyvault_vault.rst index 606cb8e..b914ddd 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_keyvault_vault.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_keyvault_vault.rst @@ -1,6 +1,5 @@ -saltext.azurerm.modules.azurerm\_keyvault\_vault -================================================ +``azurerm_keyvault_vault`` +========================== -.. currentmodule:: saltext.azurerm.modules - -.. autodata:: azurerm_keyvault_vault \ No newline at end of file +.. automodule:: saltext.azurerm.modules.azurerm_keyvault_vault + :members: diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_network.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_network.rst index f387adf..e87be74 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_network.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_network.rst @@ -1,89 +1,5 @@ -saltext.azurerm.modules.azurerm\_network -======================================== +``azurerm_network`` +=================== .. automodule:: saltext.azurerm.modules.azurerm_network - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - check_dns_name_availability - check_ip_address_availability - default_security_rule_get - default_security_rules_list - get_virtual_machine_scale_set_network_interface - list_virtual_machine_scale_set_network_interfaces - list_virtual_machine_scale_set_vm_network_interfaces - load_balancer_create_or_update - load_balancer_delete - load_balancer_get - load_balancers_list - load_balancers_list_all - network_interface_create_or_update - network_interface_delete - network_interface_get - network_interface_get_effective_route_table - network_interface_list_effective_network_security_groups - network_interfaces_list - network_interfaces_list_all - network_security_group_create_or_update - network_security_group_delete - network_security_group_get - network_security_groups_list - network_security_groups_list_all - public_ip_address_create_or_update - public_ip_address_delete - public_ip_address_get - public_ip_addresses_list - public_ip_addresses_list_all - route_create_or_update - route_delete - route_filter_create_or_update - route_filter_delete - route_filter_get - route_filter_rule_create_or_update - route_filter_rule_delete - route_filter_rule_get - route_filter_rules_list - route_filters_list - route_filters_list_all - route_get - route_table_create_or_update - route_table_delete - route_table_get - route_tables_list - route_tables_list_all - routes_list - security_rule_create_or_update - security_rule_delete - security_rule_get - security_rules_list - subnet_create_or_update - subnet_delete - subnet_get - subnets_list - usages_list - virtual_network_create_or_update - virtual_network_delete - virtual_network_get - virtual_networks_list - virtual_networks_list_all - - - - - - - - - - - - - + :members: diff --git a/docs/ref/modules/saltext.azurerm.modules.azurerm_resource.rst b/docs/ref/modules/saltext.azurerm.modules.azurerm_resource.rst index 89a7ea8..b40cfbe 100644 --- a/docs/ref/modules/saltext.azurerm.modules.azurerm_resource.rst +++ b/docs/ref/modules/saltext.azurerm.modules.azurerm_resource.rst @@ -1,56 +1,5 @@ -saltext.azurerm.modules.azurerm\_resource -========================================= +``azurerm_resource`` +==================== .. automodule:: saltext.azurerm.modules.azurerm_resource - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - deployment_cancel - deployment_check_existence - deployment_create_or_update - deployment_delete - deployment_export_template - deployment_get - deployment_operation_get - deployment_operations_list - deployment_validate - deployments_list - policy_assignment_create - policy_assignment_delete - policy_assignment_get - policy_assignments_list - policy_assignments_list_for_resource_group - policy_definition_create_or_update - policy_definition_delete - policy_definition_get - policy_definitions_list - resource_group_check_existence - resource_group_create_or_update - resource_group_delete - resource_group_get - resource_groups_list - subscription_get - subscriptions_list - subscriptions_list_locations - tenants_list - - - - - - - - - - - - - + :members: diff --git a/docs/ref/states/index.rst b/docs/ref/states/index.rst new file mode 100644 index 0000000..e9c9f82 --- /dev/null +++ b/docs/ref/states/index.rst @@ -0,0 +1,20 @@ +.. all-saltext.azurerm.states: + +_____________ +State Modules +_____________ + +.. currentmodule:: saltext.azurerm.states + +.. autosummary:: + :toctree: + + azurerm_compute + azurerm_compute_availability_set + azurerm_compute_virtual_machine + azurerm_dns + azurerm_keyvault_key + azurerm_keyvault_secret + azurerm_keyvault_vault + azurerm_network + azurerm_resource diff --git a/docs/ref/states/saltext.azurerm.states.azurerm_compute.rst b/docs/ref/states/saltext.azurerm.states.azurerm_compute.rst index fa8d0a6..94dd037 100644 --- a/docs/ref/states/saltext.azurerm.states.azurerm_compute.rst +++ b/docs/ref/states/saltext.azurerm.states.azurerm_compute.rst @@ -1,30 +1,5 @@ -saltext.azurerm.states.azurerm\_compute -======================================= +``azurerm_compute`` +=================== .. automodule:: saltext.azurerm.states.azurerm_compute - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - availability_set_absent - availability_set_present - - - - - - - - - - - - - + :members: diff --git a/docs/ref/states/saltext.azurerm.states.azurerm_compute_availability_set.rst b/docs/ref/states/saltext.azurerm.states.azurerm_compute_availability_set.rst index 51741ab..3cbffdd 100644 --- a/docs/ref/states/saltext.azurerm.states.azurerm_compute_availability_set.rst +++ b/docs/ref/states/saltext.azurerm.states.azurerm_compute_availability_set.rst @@ -1,17 +1,5 @@ -saltext.azurerm.states.azurerm\_compute\_availability\_set -=========================================================== +``azurerm_compute_availability_set`` +==================================== .. automodule:: saltext.azurerm.states.azurerm_compute_availability_set - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - absent - present \ No newline at end of file + :members: diff --git a/docs/ref/states/saltext.azurerm.states.azurerm_compute_virtual_machine.rst b/docs/ref/states/saltext.azurerm.states.azurerm_compute_virtual_machine.rst index f0cc848..9cd7b60 100644 --- a/docs/ref/states/saltext.azurerm.states.azurerm_compute_virtual_machine.rst +++ b/docs/ref/states/saltext.azurerm.states.azurerm_compute_virtual_machine.rst @@ -1,17 +1,5 @@ -saltext.azurerm.states.azurerm\_compute\_virtual\_machine -========================================================== +``azurerm_compute_virtual_machine`` +=================================== .. automodule:: saltext.azurerm.states.azurerm_compute_virtual_machine - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - absent - present \ No newline at end of file + :members: diff --git a/docs/ref/states/saltext.azurerm.states.azurerm_dns.rst b/docs/ref/states/saltext.azurerm.states.azurerm_dns.rst index 20301c5..36e17c9 100644 --- a/docs/ref/states/saltext.azurerm.states.azurerm_dns.rst +++ b/docs/ref/states/saltext.azurerm.states.azurerm_dns.rst @@ -1,32 +1,5 @@ -saltext.azurerm.states.azurerm\_dns -=================================== +``azurerm_dns`` +=============== .. automodule:: saltext.azurerm.states.azurerm_dns - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - record_set_absent - record_set_present - zone_absent - zone_present - - - - - - - - - - - - - + :members: diff --git a/docs/ref/states/saltext.azurerm.states.azurerm_keyvault_key.rst b/docs/ref/states/saltext.azurerm.states.azurerm_keyvault_key.rst index b083d0a..7cef01b 100644 --- a/docs/ref/states/saltext.azurerm.states.azurerm_keyvault_key.rst +++ b/docs/ref/states/saltext.azurerm.states.azurerm_keyvault_key.rst @@ -1,29 +1,5 @@ -saltext.azurerm.states.azurerm\_keyvault\_key -============================================== +``azurerm_keyvault_key`` +======================== .. automodule:: saltext.azurerm.states.azurerm_keyvault_key - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - absent - present - - - - - - - - - - - - + :members: diff --git a/docs/ref/states/saltext.azurerm.states.azurerm_keyvault_secret.rst b/docs/ref/states/saltext.azurerm.states.azurerm_keyvault_secret.rst index fc4f173..be89ade 100644 --- a/docs/ref/states/saltext.azurerm.states.azurerm_keyvault_secret.rst +++ b/docs/ref/states/saltext.azurerm.states.azurerm_keyvault_secret.rst @@ -1,29 +1,5 @@ -saltext.azurerm.states.azurerm\_keyvault\_secret -================================================= +``azurerm_keyvault_secret`` +=========================== .. automodule:: saltext.azurerm.states.azurerm_keyvault_secret - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - absent - present - - - - - - - - - - - - + :members: diff --git a/docs/ref/states/saltext.azurerm.states.azurerm_keyvault_vault.rst b/docs/ref/states/saltext.azurerm.states.azurerm_keyvault_vault.rst index e34687b..904c80b 100644 --- a/docs/ref/states/saltext.azurerm.states.azurerm_keyvault_vault.rst +++ b/docs/ref/states/saltext.azurerm.states.azurerm_keyvault_vault.rst @@ -1,6 +1,5 @@ -saltext.azurerm.states.azurerm\_keyvault\_vault -=============================================== +``azurerm_keyvault_vault`` +========================== -.. currentmodule:: saltext.azurerm.states - -.. autodata:: azurerm_keyvault_vault \ No newline at end of file +.. automodule:: saltext.azurerm.states.azurerm_keyvault_vault + :members: diff --git a/docs/ref/states/saltext.azurerm.states.azurerm_network.rst b/docs/ref/states/saltext.azurerm.states.azurerm_network.rst index 7b77789..f711f7b 100644 --- a/docs/ref/states/saltext.azurerm.states.azurerm_network.rst +++ b/docs/ref/states/saltext.azurerm.states.azurerm_network.rst @@ -1,46 +1,5 @@ -saltext.azurerm.states.azurerm\_network -======================================= +``azurerm_network`` +=================== .. automodule:: saltext.azurerm.states.azurerm_network - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - load_balancer_absent - load_balancer_present - network_interface_absent - network_interface_present - network_security_group_absent - network_security_group_present - public_ip_address_absent - public_ip_address_present - route_absent - route_present - route_table_absent - route_table_present - security_rule_absent - security_rule_present - subnet_absent - subnet_present - virtual_network_absent - virtual_network_present - - - - - - - - - - - - - + :members: diff --git a/docs/ref/states/saltext.azurerm.states.azurerm_resource.rst b/docs/ref/states/saltext.azurerm.states.azurerm_resource.rst index c5a3bc5..97552ea 100644 --- a/docs/ref/states/saltext.azurerm.states.azurerm_resource.rst +++ b/docs/ref/states/saltext.azurerm.states.azurerm_resource.rst @@ -1,34 +1,5 @@ -saltext.azurerm.states.azurerm\_resource -======================================== +``azurerm_resource`` +==================== .. automodule:: saltext.azurerm.states.azurerm_resource - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - policy_assignment_absent - policy_assignment_present - policy_definition_absent - policy_definition_present - resource_group_absent - resource_group_present - - - - - - - - - - - - - + :members: diff --git a/docs/ref/utils/index.rst b/docs/ref/utils/index.rst new file mode 100644 index 0000000..0a0c486 --- /dev/null +++ b/docs/ref/utils/index.rst @@ -0,0 +1,13 @@ +.. all-saltext.azurerm.utils: + +_________ +Utilities +_________ + +.. currentmodule:: saltext.azurerm + +.. autosummary:: + :toctree: + + utils + utils.azurerm diff --git a/docs/ref/utils/saltext.azurerm.utils.azurerm.rst b/docs/ref/utils/saltext.azurerm.utils.azurerm.rst index 84146d9..91e51ac 100644 --- a/docs/ref/utils/saltext.azurerm.utils.azurerm.rst +++ b/docs/ref/utils/saltext.azurerm.utils.azurerm.rst @@ -1,33 +1,5 @@ -saltext.azurerm.utils.azurerm +saltext.azurerm.utils.azurerm ============================= .. automodule:: saltext.azurerm.utils.azurerm - - - - - - - - .. rubric:: Functions - - .. autosummary:: - - compare_list_of_dicts - create_object_model - get_client - log_cloud_error - paged_object_to_list - - - - - - - - - - - - - + :members: diff --git a/docs/ref/utils/saltext.azurerm.utils.rst b/docs/ref/utils/saltext.azurerm.utils.rst new file mode 100644 index 0000000..74b2a04 --- /dev/null +++ b/docs/ref/utils/saltext.azurerm.utils.rst @@ -0,0 +1,5 @@ +saltext.azurerm.utils +===================== + +.. automodule:: saltext.azurerm.utils + :members: diff --git a/docs/topics/authentication.rst b/docs/topics/authentication.rst index dceff15..af55970 100644 --- a/docs/topics/authentication.rst +++ b/docs/topics/authentication.rst @@ -2,29 +2,29 @@ Authentication Systems ====================== -This system has migrated from the older version management library (``msrestazure``) to +This system has migrated from the older version management library (``msrestazure``) to using the systems supported through ``azure-identity``. Azure Identity Authentication ============================= The `azure identity library `_ offers many different credentials to -generate for Azure SDK Clients. The different login mechanisms that are supported by this -code include ``ClientSecretCredential``, ``UsernamePasswordCredential``, and -``DefaultAzureCredential``, respectively. Based on the different parameters provided in -either the function call or the testing (``.sls``) file, the user can decide which +identity/azure.identity?view=azure-python>`_ offers many different credentials to +generate for Azure SDK Clients. The different login mechanisms that are supported by this +code include ``ClientSecretCredential``, ``UsernamePasswordCredential``, and +``DefaultAzureCredential``, respectively. Based on the different parameters provided in +either the function call or the testing (``.sls``) file, the user can decide which authentication mechanisms to activate. ClientSecretCredential ====================== -The ``ClientSecretCredential`` authenticates a service principal using a client secret. -This credential was updated from msrestazure's ``ServicePrincipalCredentials``, -maintaining the same functionality but allowing the code to be more adaptable to updated -dependencies. It is the first authentication option in the code, requiring the ``client -ID``, ``client secret``, ``tenant ID``, and ``subscription ID``. This type of -authentication is ideal for controlling which resources can be accessed and level of +The ``ClientSecretCredential`` authenticates a service principal using a client secret. +This credential was updated from msrestazure's ``ServicePrincipalCredentials``, +maintaining the same functionality but allowing the code to be more adaptable to updated +dependencies. It is the first authentication option in the code, requiring the ``client +ID``, ``client secret``, ``tenant ID``, and ``subscription ID``. This type of +authentication is ideal for controlling which resources can be accessed and level of access. The ``client secret`` is `generated `_ for App Registration. +directory/develop/quickstart-register-app#add-credentials>`_ for App Registration. This information is provided to salt through pillar in the ``test.sls`` file: .. code-block:: yaml @@ -53,15 +53,15 @@ When the actual state block is called, the pillar is referenced: UsernamePasswordCredential ========================== -The ``UsernamePasswordCredential`` authenticates a user using work and school accounts' -usernames and passwords (Microsoft accounts are not supported). This credential was -updated from msrestazure's ``UserPassCredentials``, also maintaining functionality while -being compatible with updated dependencies. This is the second authentication option in -the code and requires a ``username``, ``password``, and ``subscription ID``. This type of authentication -is not as recommended as the other types because it is not as secure or compatible with -other functionalities (such as multi-factor authentication and consent prompting). This -information can be provided to Salt through the testing file, similar to the example -above, but with changed variables. This information is also passed through Salt by pillar +The ``UsernamePasswordCredential`` authenticates a user using work and school accounts' +usernames and passwords (Microsoft accounts are not supported). This credential was +updated from msrestazure's ``UserPassCredentials``, also maintaining functionality while +being compatible with updated dependencies. This is the second authentication option in +the code and requires a ``username``, ``password``, and ``subscription ID``. This type of authentication +is not as recommended as the other types because it is not as secure or compatible with +other functionalities (such as multi-factor authentication and consent prompting). This +information can be provided to Salt through the testing file, similar to the example +above, but with changed variables. This information is also passed through Salt by pillar in the ``test.sls`` file: .. code-block:: yaml @@ -90,11 +90,11 @@ Similarly, the pillar is referenced: DefaultAzureCredential ====================== -The ``DefaultAzureCredential`` authenticates when no other specifications are provided. -This credential was updated from msrestazure's ``MSIAuthentication``, so it now allows -the user to get the access tokens rather than just setting them. This type of -authentication is the last and default authentication option. Based on different -situations, DefaultAzureCredential automatically goes through multiple different +The ``DefaultAzureCredential`` authenticates when no other specifications are provided. +This credential was updated from msrestazure's ``MSIAuthentication``, so it now allows +the user to get the access tokens rather than just setting them. This type of +authentication is the last and default authentication option. Based on different +situations, DefaultAzureCredential automatically goes through multiple different mechanisms and detects the best fit authentication method: #. Environment: Authenticates using `environment variables =3006.1" +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" @@ -44,9 +44,8 @@ ARTIFACTS_DIR = REPO_ROOT / "artifacts" # Make sure the artifacts directory exists ARTIFACTS_DIR.mkdir(parents=True, exist_ok=True) -RUNTESTS_LOGFILE = ARTIFACTS_DIR / "runtests-{}.log".format( - datetime.datetime.now().strftime("%Y%m%d%H%M%S.%f") -) +CUR_TIME = datetime.datetime.now().strftime("%Y%m%d%H%M%S.%f") +RUNTESTS_LOGFILE = ARTIFACTS_DIR / f"runtests-{CUR_TIME}.log" COVERAGE_REPORT_DB = REPO_ROOT / ".coverage" COVERAGE_REPORT_PROJECT = ARTIFACTS_DIR.relative_to(REPO_ROOT) / "coverage-project.xml" COVERAGE_REPORT_TESTS = ARTIFACTS_DIR.relative_to(REPO_ROOT) / "coverage-tests.xml" @@ -59,7 +58,8 @@ def _get_session_python_version_info(session): except AttributeError: session_py_version = session.run_always( "python", - "-c" 'import sys; sys.stdout.write("{}.{}.{}".format(*sys.version_info))', + "-c", + 'import sys; sys.stdout.write("{}.{}.{}".format(*sys.version_info))', silent=True, log=False, ) @@ -70,9 +70,9 @@ 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") - return "py{}.{}".format(*version_info) + if version_info < (3, 8): + session.error("Only Python >= 3.8 is supported") + return f"py{version_info[0]}.{version_info[1]}" def _install_requirements( @@ -290,9 +290,7 @@ def _lint(session, rcfile, flags, paths, tee_output=True): sys.stdout.flush() if pylint_report_path: # Write report - with open( # pylint: disable=unspecified-encoding - pylint_report_path, "w" - ) as wfh: + with open(pylint_report_path, "w", encoding="utf-8") as wfh: wfh.write(contents) session.log("Report file written to %r", pylint_report_path) stdout.close() @@ -307,9 +305,7 @@ def _lint_pre_commit(session, rcfile, flags, paths): if "pre-commit" not in os.environ["VIRTUAL_ENV"]: session.error( "This should be running from within a pre-commit virtualenv and " - "'VIRTUAL_ENV'({}) does not appear to be a pre-commit virtualenv.".format( - os.environ["VIRTUAL_ENV"] - ) + f"'VIRTUAL_ENV'({os.environ['VIRTUAL_ENV']}) does not appear to be a pre-commit virtualenv." ) # Let's patch nox to make it run inside the pre-commit virtualenv @@ -489,20 +485,15 @@ def docs_crosslink_info(session): log=False, ) ) + intersphinx_mapping_list = ", ".join(list(intersphinx_mapping)) try: mapping_entry = intersphinx_mapping[session.posargs[0]] except IndexError: session.error( - "You need to pass at least one argument whose value must be one of: {}".format( - ", ".join(list(intersphinx_mapping)) - ) + f"You need to pass at least one argument whose value must be one of: {intersphinx_mapping_list}" ) except KeyError: - session.error( - "Only acceptable values for first argument are: {}".format( - ", ".join(list(intersphinx_mapping)) - ) - ) + session.error(f"Only acceptable values for first argument are: {intersphinx_mapping_list}") session.run( "python", "-m", "sphinx.ext.intersphinx", mapping_entry[0].rstrip("/") + "/objects.inv" ) diff --git a/pyproject.toml b/pyproject.toml index 6bd9d51..3bbc2c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,15 +1,143 @@ [build-system] -requires = ["setuptools>=58.3.0,<67.0.0", "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/azurerm/version.py" +write_to_template = "__version__ = \"{version}\"" + +[project] +name = "saltext.azurerm" +description = "Salt Extension for interacting with Microsoft Azure" +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 = [ + "azure-batch==12.0.0", + "azure-common==1.1.28", + "azure-graphrbac==0.61.1", + "azure-keyvault==4.2.0", + "azure-identity==1.10.0", + "azure-core==1.24.2", + "azure-mgmt-authorization==2.0.0", + "azure-mgmt-batch==16.2.0", + "azure-mgmt-compute==27.1.0", + "azure-mgmt-dns==8.0.0", + "azure-mgmt-privatedns==1.0.0", + "azure-mgmt-keyvault==10.1.0", + "azure-mgmt-monitor==6.0.1", + "azure-mgmt-msi==6.0.1", + "azure-mgmt-network==20.0.0", + "azure-mgmt-resource==21.1.0", + "azure-mgmt-storage==21.0.0", + "azure-mgmt-subscription==3.0.0", + "azure-mgmt-web==6.1.0", + "azure-storage-blob==12.12.0", + "azure-storage-common==2.1.0", + "azure-storage-file==2.1.0", + "azure-storage-nspkg==3.1.0", + "azure-storage-queue==12.3.0", + "msrest==0.7.1", + "msrestazure==0.6.4", + "salt>=3005", +] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.urls] +Homepage = "https://github.com/salt-extensions/saltext-azurerm" +Source = "https://github.com/salt-extensions/saltext-azurerm" +Tracker = "https://github.com/salt-extensions/saltext-azurerm/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.azurerm" = "saltext.azurerm" + +[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.azurerm" 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-azurerm/issues/{issue})" [[tool.towncrier.type]] directory = "removed" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 05cdbb1..0000000 --- a/setup.cfg +++ /dev/null @@ -1,126 +0,0 @@ -[metadata] -name = saltext.azurerm -description = Salt Extension Modules for Azure Resource Manager -long_description = file: README.md -long_description_content_type = text/markdown -author = EITR Technologies, LLC -author_email = devops@eitr.tech -keywords = salt-extension, salt, azure, msazure, cloud, microsoft, azurerm -url = https://github.com/salt-extensions/saltext-azurerm -project_urls = - Source=https://github.com/salt-extensions/saltext-azurerm - Tracker=https://github.com/salt-extensions/saltext-azurerm/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.6 - Programming Language :: Python :: 3.7 - 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 -platforms = any - -[options] -zip_safe = False -include_package_data = True -package_dir = - =src -packages = find_namespace: -python_requires = >= 3.6 -setup_requires = - pyzmq==23.2.0 - setuptools>=58.3.0,<67.0.0 - setuptools-declarative-requirements - wheel -install_requires = - azure-batch==12.0.0 - azure-common==1.1.28 - azure-graphrbac==0.61.1 - azure-keyvault==4.2.0 - azure-identity==1.10.0 - azure-core==1.24.2 - azure-mgmt-authorization==2.0.0 - azure-mgmt-batch==16.2.0 - azure-mgmt-compute==27.1.0 - azure-mgmt-dns==8.0.0 - azure-mgmt-privatedns==1.0.0 - azure-mgmt-keyvault==10.1.0 - azure-mgmt-monitor==6.0.1 - azure-mgmt-msi==6.0.1 - azure-mgmt-network==20.0.0 - azure-mgmt-resource==21.1.0 - azure-mgmt-storage==21.0.0 - azure-mgmt-subscription==3.0.0 - azure-mgmt-web==6.1.0 - azure-storage-blob==12.12.0 - azure-storage-common==2.1.0 - azure-storage-file==2.1.0 - azure-storage-nspkg==3.1.0 - azure-storage-queue==12.3.0 - msrest==0.7.1 - msrestazure==0.6.4 - - # 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= -# -# states_dirs = saltext.azurerm.loader:get_states_dirs -# -# module_dirs = saltext.azurerm.loader:get_module_dirs -# -# cloud_dirs = saltext.azurerm.loader:get_cloud_dirs -# -# utils_dirs = saltext.azurerm.loader:get_utils_dirs -# - -[options.entry_points] -salt.loader= - saltext.azurerm = saltext.azurerm - - -[options.extras_require] -tests = - mock>=3.0.5 - pytest>=7.2.0 - pytest-salt-factories>=1.0.0rc23 - pytest-ordering - Jinja2 -dev = - nox==2022.1.7 - pre-commit==2.13.0 - pylint<2.14.0 - SaltPyLint -docs = - sphinx>=3.5.1 - Jinja2 - furo - sphinx-copybutton - sphinx-prompt - sphinxcontrib-spelling - importlib_metadata<=4.13.0 -docsauto = - sphinx-autobuild -release = - twine - wheel - -[bdist_wheel] -# Use this option if your package is pure-python -universal = 1 - -[build_sphinx] -source_dir = docs -build_dir = build/sphinx diff --git a/setup.py b/setup.py index 6ec7697..f999679 100644 --- a/setup.py +++ b/setup.py @@ -1,19 +1,5 @@ # pylint: disable=missing-module-docstring -from pathlib import Path - import setuptools -version_path = Path(__file__).parent / "src" / "saltext" / "azurerm" / "version.py" - -with version_path.open() as f: - for line in f: - if line.startswith("__version__"): - # We only want the bare string pls - version = line.partition("=")[-1].strip().strip('"').strip("'") - break - else: - version = "0.0.1dev1" # pylint: disable=invalid-name - - if __name__ == "__main__": - setuptools.setup(use_scm_version=True, version=version) + setuptools.setup(use_scm_version=True) diff --git a/src/saltext/azurerm/clouds/azurerm.py b/src/saltext/azurerm/clouds/azurerm.py index 1abc7ff..2e2d7e5 100644 --- a/src/saltext/azurerm/clouds/azurerm.py +++ b/src/saltext/azurerm/clouds/azurerm.py @@ -699,7 +699,9 @@ def create_network_interface(call=None, kwargs=None): ) if kwargs.get("iface_name") is None: - kwargs["iface_name"] = "{}-iface0".format(vm_["name"]) + kwargs["iface_name"] = "{}-iface0".format( # pylint: disable=consider-using-f-string + vm_["name"] + ) # Handle IP configuration based on provided parameters ip_kwargs = {} @@ -716,7 +718,9 @@ def create_network_interface(call=None, kwargs=None): ip_kwargs["private_ip_allocation_method"] = IPAllocationMethod.dynamic if kwargs.get("allocate_public_ip") is True: - pub_ip_name = "{}-ip".format(kwargs["iface_name"]) + pub_ip_name = "{}-ip".format( # pylint: disable=consider-using-f-string + kwargs["iface_name"] + ) pub_ip_data = __salt__["azurerm_network.public_ip_address_create_or_update"]( name=pub_ip_name, resource_group=kwargs["resource_group"], **conn_kwargs ) @@ -727,7 +731,9 @@ def create_network_interface(call=None, kwargs=None): ip_kwargs["name"] = pub_ip_name ip_configurations = [ip_kwargs] else: - priv_ip_name = "{}-ip".format(kwargs["iface_name"]) + priv_ip_name = "{}-ip".format( # pylint: disable=consider-using-f-string + kwargs["iface_name"] + ) ip_kwargs["name"] = priv_ip_name ip_configurations = [ip_kwargs] # pylint: disable=unused-variable @@ -737,7 +743,7 @@ def create_network_interface(call=None, kwargs=None): subnet=kwargs["subnet"], virtual_network=kwargs["network"], resource_group=kwargs["resource_group"], - **conn_kwargs + **conn_kwargs, ) return _get_network_interface(kwargs["iface_name"], kwargs["resource_group"]) @@ -804,7 +810,7 @@ def request_instance(vm_, kwargs=None): iface_data, public_ips, private_ips = create_network_interface(call="action", kwargs=vm_) vm_["iface_id"] = iface_data["id"] - disk_name = "{}-vol0".format(vm_["name"]) + disk_name = "{}-vol0".format(vm_["name"]) # pylint: disable=consider-using-f-string vm_username = config.get_cloud_config_value( "ssh_username", @@ -824,7 +830,7 @@ def request_instance(vm_, kwargs=None): ssh_publickeyfile_contents = spkc_.read() except Exception as exc: # pylint: disable=broad-except raise SaltCloudConfigError( # pylint: disable=raise-missing-from - "Failed to read ssh publickey file '{}': {}".format(ssh_publickeyfile, exc.args[-1]) + f"Failed to read ssh publickey file '{ssh_publickeyfile}': {exc.args[-1]}" ) disable_password_authentication = config.get_cloud_config_value( @@ -842,7 +848,7 @@ def request_instance(vm_, kwargs=None): if not win_installer and ssh_publickeyfile_contents is not None: sshpublickey = SshPublicKey( key_data=ssh_publickeyfile_contents, - path="/home/{}/.ssh/authorized_keys".format(vm_username), + path=f"/home/{vm_username}/.ssh/authorized_keys", ) sshconfiguration = SshConfiguration( public_keys=[sshpublickey], @@ -892,7 +898,7 @@ def request_instance(vm_, kwargs=None): ) if availability_set is not None and isinstance(availability_set, str): availability_set = { - "id": "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/availabilitySets/{}".format( + "id": "/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Compute/availabilitySets/{}".format( # pylint: disable=consider-using-f-string subscription_id, vm_["resource_group"], availability_set ) } @@ -924,7 +930,12 @@ def request_instance(vm_, kwargs=None): "name", volume.get( "name", - volume.get("name", "{}-datadisk{}".format(vm_["name"], str(lun))), + volume.get( + "name", + "{}-datadisk{}".format( # pylint: disable=consider-using-f-string + vm_["name"], str(lun) + ), + ), ), ) @@ -947,7 +958,7 @@ def request_instance(vm_, kwargs=None): del volume["media_link"] elif volume.get("vhd") == "unmanaged": volume["vhd"] = VirtualHardDisk( - uri="https://{}.blob.{}/vhds/{}-datadisk{}.vhd".format( + uri="https://{}.blob.{}/vhds/{}-datadisk{}.vhd".format( # pylint: disable=consider-using-f-string vm_["storage_account"], storage_endpoint_suffix, vm_["name"], @@ -990,7 +1001,7 @@ def request_instance(vm_, kwargs=None): create_option=DiskCreateOptionTypes.from_image, name=disk_name, vhd=VirtualHardDisk( - uri="https://{}.blob.{}/vhds/{}.vhd".format( + uri="https://{}.blob.{}/vhds/{}.vhd".format( # pylint: disable=consider-using-f-string vm_["storage_account"], storage_endpoint_suffix, disk_name, @@ -1112,7 +1123,7 @@ def request_instance(vm_, kwargs=None): salt.utils.cloud.fire_event( "event", "requesting instance", - "salt/cloud/{}/requesting".format(vm_["name"]), + "salt/cloud/{}/requesting".format(vm_["name"]), # pylint: disable=consider-using-f-string args=__utils__["cloud.filter_event"]( "requesting", vm_, ["name", "profile", "provider", "driver"] ), @@ -1164,7 +1175,7 @@ def create(vm_): salt.utils.cloud.fire_event( "event", "starting create", - "salt/cloud/{}/creating".format(vm_["name"]), + "salt/cloud/{}/creating".format(vm_["name"]), # pylint: disable=consider-using-f-string args=__utils__["cloud.filter_event"]( "creating", vm_, ["name", "profile", "provider", "driver"] ), @@ -1180,7 +1191,11 @@ def create(vm_): vm_request = request_instance(vm_=vm_) if not vm_request or "error" in vm_request: - err_message = "Error creating VM {}! ({})".format(vm_["name"], str(vm_request)) + err_message = ( + "Error creating VM {}! ({})".format( # pylint: disable=consider-using-f-string + vm_["name"], str(vm_request) + ) + ) log.error(err_message) raise SaltCloudSystemExit(err_message) @@ -1242,7 +1257,7 @@ def _query_node_data(name, bootstrap_interface): salt.utils.cloud.fire_event( "event", "created instance", - "salt/cloud/{}/created".format(vm_["name"]), + "salt/cloud/{}/created".format(vm_["name"]), # pylint: disable=consider-using-f-string args=__utils__["cloud.filter_event"]( "created", vm_, ["name", "profile", "provider", "driver"] ), @@ -1451,7 +1466,7 @@ def _get_cloud_environment(): cloud_env = getattr(cloud_env_module, cloud_environment or "AZURE_PUBLIC_CLOUD") except (AttributeError, ImportError): raise SaltCloudSystemExit( # pylint: disable=raise-missing-from - "The azure {} cloud environment is not available.".format(cloud_environment) + f"The azure {cloud_environment} cloud environment is not available." ) return cloud_env @@ -1708,7 +1723,7 @@ def create_or_update_vmextension(call=None, kwargs=None): # pylint: disable=unu settings=settings, auto_upgrade_minor_version=auto_upgrade_minor_version, protected_settings=protected_settings, - **conn_kwargs + **conn_kwargs, ) return ret @@ -1748,7 +1763,7 @@ def stop(name, call=None): continue if not ret or "error" in ret: - ret = {"error": "Unable to find virtual machine with name: {}".format(name)} + ret = {"error": f"Unable to find virtual machine with name: {name}"} else: ret = __salt__["azurerm_compute_virtual_machine.deallocate"]( name=name, resource_group=resource_group, **conn_kwargs @@ -1791,7 +1806,7 @@ def start(name, call=None): continue if not ret or "error" in ret: - ret = {"error": "Unable to find virtual machine with name: {}".format(name)} + ret = {"error": f"Unable to find virtual machine with name: {name}"} else: ret = __salt__["azurerm_compute_virtual_machine.start"]( name=name, resource_group=resource_group, **conn_kwargs diff --git a/src/saltext/azurerm/fileserver/azurefs.py b/src/saltext/azurerm/fileserver/azurefs.py index f0f8b0c..05953e7 100644 --- a/src/saltext/azurerm/fileserver/azurefs.py +++ b/src/saltext/azurerm/fileserver/azurefs.py @@ -272,7 +272,9 @@ def file_hash(load, fnd): hashdest = salt.utils.path.join( hash_cachedir, load["saltenv"], - "{}.hash.{}".format(relpath, __opts__["hash_type"]), + "{}.hash.{}".format( # pylint: disable=consider-using-f-string + relpath, __opts__["hash_type"] + ), ) if not os.path.isfile(hashdest): if not os.path.exists(os.path.dirname(hashdest)): @@ -336,7 +338,7 @@ def _get_container_path(container): and saltenv, separated by underscores """ root = os.path.join(__opts__["cachedir"], "azurefs") - container_dir = "{}_{}_{}".format( + container_dir = "{}_{}_{}".format( # pylint: disable=consider-using-f-string container.get("account_name", ""), container.get("container_name", ""), container.get("saltenv", "base"), diff --git a/src/saltext/azurerm/modules/azurerm_compute_availability_set.py b/src/saltext/azurerm/modules/azurerm_compute_availability_set.py index 5fac352..a03e410 100644 --- a/src/saltext/azurerm/modules/azurerm_compute_availability_set.py +++ b/src/saltext/azurerm/modules/azurerm_compute_availability_set.py @@ -101,7 +101,7 @@ def create_or_update(name, resource_group, **kwargs): "compute", "AvailabilitySet", **kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -116,7 +116,7 @@ def create_or_update(name, resource_group, **kwargs): saltext.azurerm.utils.azurerm.log_cloud_error("compute", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result diff --git a/src/saltext/azurerm/modules/azurerm_compute_image.py b/src/saltext/azurerm/modules/azurerm_compute_image.py index 7ac1285..e6bbb64 100644 --- a/src/saltext/azurerm/modules/azurerm_compute_image.py +++ b/src/saltext/azurerm/modules/azurerm_compute_image.py @@ -160,7 +160,7 @@ def create_or_update( **kwargs, ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -173,7 +173,7 @@ def create_or_update( **kwargs, ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -187,7 +187,7 @@ def create_or_update( saltext.azurerm.utils.azurerm.log_cloud_error("compute", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result diff --git a/src/saltext/azurerm/modules/azurerm_compute_virtual_machine.py b/src/saltext/azurerm/modules/azurerm_compute_virtual_machine.py index d90ae69..dc141f6 100644 --- a/src/saltext/azurerm/modules/azurerm_compute_virtual_machine.py +++ b/src/saltext/azurerm/modules/azurerm_compute_virtual_machine.py @@ -373,9 +373,7 @@ def create_or_update( try: ipc.update({"public_ip_address": {"id": pubip["id"]}}) except KeyError as exc: - result = { - "error": "The public IP address could not be created. ({})".format(str(exc)) - } + result = {"error": f"The public IP address could not be created. ({str(exc)})"} return result iface = __salt__["azurerm_network.network_interface_create_or_update"]( @@ -390,7 +388,7 @@ def create_or_update( try: nic = {"id": iface["id"]} except KeyError as exc: - result = {"error": "The network interface could not be created. ({})".format(str(exc))} + result = {"error": f"The network interface could not be created. ({str(exc)})"} return result network_interfaces.append(nic) @@ -640,7 +638,7 @@ def create_or_update( "compute", "VirtualMachine", **params ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -708,7 +706,7 @@ def create_or_update( if enable_disk_enc and provision_vm_agent and disk_enc_keyvault and disk_enc_volume_type: try: disk_enc_keyvault_name = (parse_resource_id(disk_enc_keyvault))["name"] - disk_enc_keyvault_url = "https://{}.vault.azure.net/".format(disk_enc_keyvault_name) + disk_enc_keyvault_url = f"https://{disk_enc_keyvault_name}.vault.azure.net/" extension_info = { "publisher": "Microsoft.Azure.Security", @@ -769,7 +767,7 @@ def create_or_update( saltext.azurerm.utils.azurerm.log_cloud_error("compute", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result diff --git a/src/saltext/azurerm/modules/azurerm_compute_virtual_machine_extension.py b/src/saltext/azurerm/modules/azurerm_compute_virtual_machine_extension.py index 28d672f..44bf771 100644 --- a/src/saltext/azurerm/modules/azurerm_compute_virtual_machine_extension.py +++ b/src/saltext/azurerm/modules/azurerm_compute_virtual_machine_extension.py @@ -119,7 +119,7 @@ def create_or_update( **kwargs, ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: diff --git a/src/saltext/azurerm/modules/azurerm_dns.py b/src/saltext/azurerm/modules/azurerm_dns.py index 924bb84..e12b362 100644 --- a/src/saltext/azurerm/modules/azurerm_dns.py +++ b/src/saltext/azurerm/modules/azurerm_dns.py @@ -111,7 +111,7 @@ def record_set_create_or_update( "dns", "RecordSet", **kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -140,7 +140,7 @@ def record_set_create_or_update( saltext.azurerm.utils.azurerm.log_cloud_error("dns", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -263,7 +263,7 @@ def record_sets_list_by_type( top=None, recordsetnamesuffix=None, zone_type="Public", - **kwargs + **kwargs, ): """ .. versionadded:: 3000 @@ -441,7 +441,7 @@ def zone_create_or_update(name, resource_group, zone_type="Public", **kwargs): try: zone_model = saltext.azurerm.utils.azurerm.create_object_model(client, obj, **kwargs) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -470,7 +470,7 @@ def zone_create_or_update(name, resource_group, zone_type="Public", **kwargs): saltext.azurerm.utils.azurerm.log_cloud_error("dns", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result diff --git a/src/saltext/azurerm/modules/azurerm_keyvault_key.py b/src/saltext/azurerm/modules/azurerm_keyvault_key.py index 6e661b7..8537c36 100644 --- a/src/saltext/azurerm/modules/azurerm_keyvault_key.py +++ b/src/saltext/azurerm/modules/azurerm_keyvault_key.py @@ -68,6 +68,11 @@ def get_key_client(vault_url, **kwargs): :param vault_url: The URL of the vault that the client will access. + CLI Example: + + .. code-block:: bash + + salt-call azurerm_keyvault_key.get_key_client https://myvault.vault.azure.net/ """ credential = saltext.azurerm.utils.azurerm.get_identity_credentials(**kwargs) key_client = KeyClient(vault_url=vault_url, credential=credential) @@ -581,7 +586,7 @@ def import_key( "keyvault-keys", "JsonWebKey", **kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: diff --git a/src/saltext/azurerm/modules/azurerm_keyvault_secret.py b/src/saltext/azurerm/modules/azurerm_keyvault_secret.py index e5222e1..8fc8596 100644 --- a/src/saltext/azurerm/modules/azurerm_keyvault_secret.py +++ b/src/saltext/azurerm/modules/azurerm_keyvault_secret.py @@ -74,6 +74,11 @@ def get_secret_client(vault_url, **kwargs): :param vault_url: The URL of the vault that the client will access. + CLI Example: + + .. code-block:: bash + + salt-call azurerm_keyvault_secret.get_secret_client https://myvault.vault.azure.net/ """ credential = saltext.azurerm.utils.azurerm.get_identity_credentials(**kwargs) diff --git a/src/saltext/azurerm/modules/azurerm_keyvault_vault.py b/src/saltext/azurerm/modules/azurerm_keyvault_vault.py index be1c14b..3e5c99c 100644 --- a/src/saltext/azurerm/modules/azurerm_keyvault_vault.py +++ b/src/saltext/azurerm/modules/azurerm_keyvault_vault.py @@ -224,7 +224,7 @@ def create_or_update( **kwargs, ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result # Create the VaultCreateOrUpdateParameters object @@ -237,7 +237,7 @@ def create_or_update( tags=tags, ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -529,7 +529,7 @@ def update_access_policy(name, resource_group, operation_kind, access_policies, **kwargs, ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: diff --git a/src/saltext/azurerm/modules/azurerm_network.py b/src/saltext/azurerm/modules/azurerm_network.py index 010c14e..b506856 100644 --- a/src/saltext/azurerm/modules/azurerm_network.py +++ b/src/saltext/azurerm/modules/azurerm_network.py @@ -170,7 +170,7 @@ def default_security_rule_get(name, security_group, resource_group, **kwargs): if default_rule["name"] == name: result = default_rule if not result: - result = {"error": "Unable to find {} in {}!".format(name, security_group)} + result = {"error": f"Unable to find {name} in {security_group}!"} except KeyError as exc: log.error("Unable to find %s in %s!", name, security_group) result = {"error": str(exc)} @@ -262,7 +262,7 @@ def security_rule_create_or_update( destination_address_prefixes=None, source_port_ranges=None, destination_port_ranges=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -347,7 +347,7 @@ def security_rule_create_or_update( # pylint: disable=eval-used if eval(params[0]): # pylint: disable=exec-used - exec("{} = None".format(params[1])) + exec(f"{params[1]} = None") netconn = saltext.azurerm.utils.azurerm.get_client("network", **kwargs) @@ -368,10 +368,10 @@ def security_rule_create_or_update( destination_port_range=destination_port_range, destination_address_prefixes=destination_address_prefixes, destination_address_prefix=destination_address_prefix, - **kwargs + **kwargs, ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -388,7 +388,7 @@ def security_rule_create_or_update( saltext.azurerm.utils.azurerm.log_cloud_error("network", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -502,7 +502,7 @@ def network_security_group_create_or_update( "network", "NetworkSecurityGroup", **kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -519,7 +519,7 @@ def network_security_group_create_or_update( saltext.azurerm.utils.azurerm.log_cloud_error("network", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -767,10 +767,10 @@ def subnet_create_or_update(name, address_prefix, virtual_network, resource_grou "Subnet", address_prefix=address_prefix, resource_group=resource_group, - **kwargs + **kwargs, ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -788,7 +788,7 @@ def subnet_create_or_update(name, address_prefix, virtual_network, resource_grou saltext.azurerm.utils.azurerm.log_cloud_error("network", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -939,10 +939,10 @@ def virtual_network_create_or_update(name, address_prefixes, resource_group, **k "VirtualNetwork", address_space=address_space, dhcp_options=dhcp_options, - **kwargs + **kwargs, ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -959,7 +959,7 @@ def virtual_network_create_or_update(name, address_prefixes, resource_group, **k saltext.azurerm.utils.azurerm.log_cloud_error("network", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -1154,7 +1154,7 @@ def load_balancer_create_or_update(name, resource_group, **kwargs): pub_ip = public_ip_address_get( name=kwargs["frontend_ip_configurations"][idx]["public_ip_address"], resource_group=resource_group, - **kwargs + **kwargs, ) if "error" not in pub_ip: kwargs["frontend_ip_configurations"][idx]["public_ip_address"] = { @@ -1271,7 +1271,7 @@ def load_balancer_create_or_update(name, resource_group, **kwargs): "network", "LoadBalancer", **kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -1288,7 +1288,7 @@ def load_balancer_create_or_update(name, resource_group, **kwargs): saltext.azurerm.utils.azurerm.log_cloud_error("network", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -1538,7 +1538,7 @@ def network_interface_create_or_update( pub_ip = public_ip_address_get( name=ipconfig["public_ip_address"], resource_group=resource_group, - **kwargs + **kwargs, ) if "error" not in pub_ip: ipconfig["public_ip_address"] = {"id": str(pub_ip["id"])} @@ -1549,7 +1549,7 @@ def network_interface_create_or_update( "network", "NetworkInterface", ip_configurations=ip_configurations, **kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -1566,7 +1566,7 @@ def network_interface_create_or_update( saltext.azurerm.utils.azurerm.log_cloud_error("network", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -1929,7 +1929,7 @@ def public_ip_address_create_or_update(name, resource_group, **kwargs): "network", "PublicIPAddress", **kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -1946,7 +1946,7 @@ def public_ip_address_create_or_update(name, resource_group, **kwargs): saltext.azurerm.utils.azurerm.log_cloud_error("network", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -2131,7 +2131,7 @@ def route_filter_rule_create_or_update( "network", "RouteFilterRule", access=access, communities=communities, **kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -2151,7 +2151,7 @@ def route_filter_rule_create_or_update( saltext.azurerm.utils.azurerm.log_cloud_error("network", message, **kwargs) result = {"error": message} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -2291,7 +2291,7 @@ def route_filter_create_or_update(name, resource_group, **kwargs): "network", "RouteFilter", **kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -2307,7 +2307,7 @@ def route_filter_create_or_update(name, resource_group, **kwargs): saltext.azurerm.utils.azurerm.log_cloud_error("network", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -2452,7 +2452,7 @@ def route_create_or_update( route_table, resource_group, next_hop_ip_address=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -2490,10 +2490,10 @@ def route_create_or_update( address_prefix=address_prefix, next_hop_type=next_hop_type, next_hop_ip_address=next_hop_ip_address, - **kwargs + **kwargs, ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -2510,7 +2510,7 @@ def route_create_or_update( saltext.azurerm.utils.azurerm.log_cloud_error("network", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -2648,7 +2648,7 @@ def route_table_create_or_update(name, resource_group, **kwargs): "network", "RouteTable", **kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -2665,7 +2665,7 @@ def route_table_create_or_update(name, resource_group, **kwargs): saltext.azurerm.utils.azurerm.log_cloud_error("network", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result diff --git a/src/saltext/azurerm/modules/azurerm_resource.py b/src/saltext/azurerm/modules/azurerm_resource.py index a4e5649..8ef10a2 100644 --- a/src/saltext/azurerm/modules/azurerm_resource.py +++ b/src/saltext/azurerm/modules/azurerm_resource.py @@ -359,7 +359,7 @@ def deployment_create_or_update( parameters_link=None, deploy_template=None, template_link=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -484,7 +484,7 @@ def deployment_create_or_update( "resource.resources", "DeploymentProperties", **deploy_kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -497,7 +497,7 @@ def deployment_create_or_update( parameters_link=deploy_kwargs.get("parameters_link"), deploy_template=deploy_kwargs.get("template"), template_link=deploy_kwargs.get("template_link"), - **kwargs + **kwargs, ) if "error" in validate: result = validate @@ -514,7 +514,7 @@ def deployment_create_or_update( saltext.azurerm.utils.azurerm.log_cloud_error("resource", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -586,7 +586,7 @@ def deployment_validate( parameters_link=None, deploy_template=None, template_link=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -665,7 +665,7 @@ def deployment_validate( "resource.resources", "DeploymentProperties", **deploy_kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -685,7 +685,7 @@ def deployment_validate( saltext.azurerm.utils.azurerm.log_cloud_error("resource", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result @@ -943,7 +943,7 @@ def policy_assignment_create(name, scope, definition_name, **kwargs): definition = definition_list[definition_name] else: definition = { - "error": 'The policy definition named "{}" could not be found.'.format(definition_name) + "error": f'The policy definition named "{definition_name}" could not be found.' } # END @@ -960,7 +960,7 @@ def policy_assignment_create(name, scope, definition_name, **kwargs): "resource.policy", "PolicyAssignment", **policy_kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -972,11 +972,9 @@ def policy_assignment_create(name, scope, definition_name, **kwargs): saltext.azurerm.utils.azurerm.log_cloud_error("resource", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} else: - result = { - "error": 'The policy definition named "{}" could not be found.'.format(definition_name) - } + result = {"error": f'The policy definition named "{definition_name}" could not be found.'} return result @@ -1109,7 +1107,7 @@ def policy_definition_create_or_update(name, policy_rule, **kwargs): # pylint: "resource.policy", "PolicyDefinition", **policy_kwargs ) except TypeError as exc: - result = {"error": "The object model could not be built. ({})".format(str(exc))} + result = {"error": f"The object model could not be built. ({str(exc)})"} return result try: @@ -1121,7 +1119,7 @@ def policy_definition_create_or_update(name, policy_rule, **kwargs): # pylint: saltext.azurerm.utils.azurerm.log_cloud_error("resource", str(exc), **kwargs) result = {"error": str(exc)} except SerializationError as exc: - result = {"error": "The object model could not be parsed. ({})".format(str(exc))} + result = {"error": f"The object model could not be parsed. ({str(exc)})"} return result diff --git a/src/saltext/azurerm/states/azurerm_compute_availability_set.py b/src/saltext/azurerm/states/azurerm_compute_availability_set.py index 22fb32a..d8bae61 100644 --- a/src/saltext/azurerm/states/azurerm_compute_availability_set.py +++ b/src/saltext/azurerm/states/azurerm_compute_availability_set.py @@ -81,7 +81,7 @@ def present( virtual_machines=None, sku=None, connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2.1.0 @@ -188,12 +188,12 @@ def present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Availability set {} is already present.".format(name) + ret["comment"] = f"Availability set {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Availability set {} would be updated.".format(name) + ret["comment"] = f"Availability set {name} would be updated." return ret else: @@ -210,7 +210,7 @@ def present( } if __opts__["test"]: - ret["comment"] = "Availability set {} would be created.".format(name) + ret["comment"] = f"Availability set {name} would be created." ret["result"] = None return ret @@ -225,15 +225,19 @@ def present( platform_fault_domain_count=platform_fault_domain_count, sku=sku, tags=tags, - **aset_kwargs + **aset_kwargs, ) if "error" not in aset: ret["result"] = True - ret["comment"] = "Availability set {} has been created.".format(name) + ret["comment"] = f"Availability set {name} has been created." return ret - ret["comment"] = "Failed to create availability set {}! ({})".format(name, aset.get("error")) + ret[ + "comment" + ] = "Failed to create availability set {}! ({})".format( # pylint: disable=consider-using-f-string + name, aset.get("error") + ) return ret @@ -265,11 +269,11 @@ def absent(name, resource_group, connection_auth=None): if "error" in aset: ret["result"] = True - ret["comment"] = "Availability set {} was not found.".format(name) + ret["comment"] = f"Availability set {name} was not found." return ret elif __opts__["test"]: - ret["comment"] = "Availability set {} would be deleted.".format(name) + ret["comment"] = f"Availability set {name} would be deleted." ret["result"] = None ret["changes"] = { "old": aset, @@ -283,9 +287,9 @@ def absent(name, resource_group, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Availability set {} has been deleted.".format(name) + ret["comment"] = f"Availability set {name} has been deleted." ret["changes"] = {"old": aset, "new": {}} return ret - ret["comment"] = "Failed to delete availability set {}!".format(name) + ret["comment"] = f"Failed to delete availability set {name}!" return ret diff --git a/src/saltext/azurerm/states/azurerm_compute_virtual_machine.py b/src/saltext/azurerm/states/azurerm_compute_virtual_machine.py index b09ba3a..ae42a40 100644 --- a/src/saltext/azurerm/states/azurerm_compute_virtual_machine.py +++ b/src/saltext/azurerm/states/azurerm_compute_virtual_machine.py @@ -547,17 +547,17 @@ def present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Virtual machine {} is already present.".format(name) + ret["comment"] = f"Virtual machine {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Virtual machine {} would be updated.".format(name) + ret["comment"] = f"Virtual machine {name} would be updated." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Virtual machine {} would be created.".format(name) + ret["comment"] = f"Virtual machine {name} would be created." return ret vm_kwargs = kwargs.copy() @@ -622,7 +622,9 @@ def present( ret["comment"] = f"Virtual machine {name} has been {action}d." return ret - ret["comment"] = "Failed to {} virtual machine {}! ({})".format( + ret[ + "comment" + ] = "Failed to {} virtual machine {}! ({})".format( # pylint: disable=consider-using-f-string action, name, virt_mach.get("error") ) if not ret["result"]: @@ -688,11 +690,11 @@ def absent( if "error" in virt_mach: ret["result"] = True - ret["comment"] = "Virtual machine {} was not found.".format(name) + ret["comment"] = f"Virtual machine {name} was not found." return ret if __opts__["test"]: - ret["comment"] = "Virtual machine {} would be deleted.".format(name) + ret["comment"] = f"Virtual machine {name} would be deleted." ret["result"] = None ret["changes"] = { "old": virt_mach, @@ -802,9 +804,9 @@ def absent( ) ret["result"] = True - ret["comment"] = "Virtual machine {} has been deleted.".format(name) + ret["comment"] = f"Virtual machine {name} has been deleted." ret["changes"] = {"old": virt_mach, "new": {}} return ret - ret["comment"] = "Failed to delete virtual machine {}!".format(name) + ret["comment"] = f"Failed to delete virtual machine {name}!" return ret diff --git a/src/saltext/azurerm/states/azurerm_dns.py b/src/saltext/azurerm/states/azurerm_dns.py index 22d5119..c06d4c9 100644 --- a/src/saltext/azurerm/states/azurerm_dns.py +++ b/src/saltext/azurerm/states/azurerm_dns.py @@ -124,7 +124,7 @@ def zone_present( tags=None, zone_type="Public", connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 3000 @@ -250,12 +250,12 @@ def zone_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "DNS zone {} is already present.".format(name) + ret["comment"] = f"DNS zone {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "DNS zone {} would be updated.".format(name) + ret["comment"] = f"DNS zone {name} would be updated." return ret else: @@ -273,7 +273,7 @@ def zone_present( } if __opts__["test"]: - ret["comment"] = "DNS zone {} would be created.".format(name) + ret["comment"] = f"DNS zone {name} would be created." ret["result"] = None return ret @@ -290,15 +290,19 @@ def zone_present( resolution_virtual_networks=resolution_virtual_networks, tags=tags, zone_type=zone_type, - **zone_kwargs + **zone_kwargs, ) if "error" not in zone: ret["result"] = True - ret["comment"] = "DNS zone {} has been created.".format(name) + ret["comment"] = f"DNS zone {name} has been created." return ret - ret["comment"] = "Failed to create DNS zone {}! ({})".format(name, zone.get("error")) + ret[ + "comment" + ] = "Failed to create DNS zone {}! ({})".format( # pylint: disable=consider-using-f-string + name, zone.get("error") + ) return ret @@ -336,11 +340,11 @@ def zone_absent(name, resource_group, zone_type="Public", connection_auth=None): if "error" in zone: ret["result"] = True - ret["comment"] = "DNS zone {} was not found.".format(name) + ret["comment"] = f"DNS zone {name} was not found." return ret elif __opts__["test"]: - ret["comment"] = "DNS zone {} would be deleted.".format(name) + ret["comment"] = f"DNS zone {name} would be deleted." ret["result"] = None ret["changes"] = { "old": zone, @@ -354,11 +358,11 @@ def zone_absent(name, resource_group, zone_type="Public", connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "DNS zone {} has been deleted.".format(name) + ret["comment"] = f"DNS zone {name} has been deleted." ret["changes"] = {"old": zone, "new": {}} return ret - ret["comment"] = "Failed to delete DNS zone {}!".format(name) + ret["comment"] = f"Failed to delete DNS zone {name}!" return ret @@ -384,7 +388,7 @@ def record_set_present( soa_record=None, caa_records=None, connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 3000 @@ -536,7 +540,7 @@ def record_set_present( record_type, zone_type, azurerm_log_level="info", - **connection_auth + **connection_auth, ) if "error" not in rec_set: @@ -560,7 +564,7 @@ def record_set_present( if not isinstance(record, dict): ret[ "comment" - ] = "{} record information must be specified as a dictionary!".format( + ] = "{} record information must be specified as a dictionary!".format( # pylint: disable=consider-using-f-string record_str ) return ret @@ -569,9 +573,10 @@ def record_set_present( ret["changes"] = {"new": {record_str: record}} elif record_str[-1] == "s": if not isinstance(record, list): - ret["comment"] = ( - "{} record information must be specified as a list of" - " dictionaries!".format(record_str) + ret[ + "comment" + ] = "{} record information must be specified as a list of dictionaries!".format( # pylint: disable=consider-using-f-string + record_str ) return ret local, remote = (sorted(config) for config in (record, rec_set[record_str])) @@ -588,12 +593,12 @@ def record_set_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Record set {} is already present.".format(name) + ret["comment"] = f"Record set {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Record set {} would be updated.".format(name) + ret["comment"] = f"Record set {name} would be updated." return ret else: @@ -616,7 +621,7 @@ def record_set_present( ret["changes"]["new"][record] = eval(record) if __opts__["test"]: - ret["comment"] = "Record set {} would be created.".format(name) + ret["comment"] = f"Record set {name} would be created." ret["result"] = None return ret @@ -644,15 +649,19 @@ def record_set_present( cname_record=cname_record, soa_record=soa_record, caa_records=caa_records, - **rec_set_kwargs + **rec_set_kwargs, ) if "error" not in rec_set: ret["result"] = True - ret["comment"] = "Record set {} has been created.".format(name) + ret["comment"] = f"Record set {name} has been created." return ret - ret["comment"] = "Failed to create record set {}! ({})".format(name, rec_set.get("error")) + ret[ + "comment" + ] = "Failed to create record set {}! ({})".format( # pylint: disable=consider-using-f-string + name, rec_set.get("error") + ) return ret @@ -697,16 +706,16 @@ def record_set_absent( record_type=record_type, azurerm_log_level="info", zone_type=zone_type, - **connection_auth + **connection_auth, ) if "error" in rec_set: ret["result"] = True - ret["comment"] = "Record set {} was not found in zone {}.".format(name, zone_name) + ret["comment"] = f"Record set {name} was not found in zone {zone_name}." return ret elif __opts__["test"]: - ret["comment"] = "Record set {} would be deleted.".format(name) + ret["comment"] = f"Record set {name} would be deleted." ret["result"] = None ret["changes"] = { "old": rec_set, @@ -720,14 +729,14 @@ def record_set_absent( resource_group, record_type=record_type, zone_type=zone_type, - **connection_auth + **connection_auth, ) if deleted: ret["result"] = True - ret["comment"] = "Record set {} has been deleted.".format(name) + ret["comment"] = f"Record set {name} has been deleted." ret["changes"] = {"old": rec_set, "new": {}} return ret - ret["comment"] = "Failed to delete record set {}!".format(name) + ret["comment"] = f"Failed to delete record set {name}!" return ret diff --git a/src/saltext/azurerm/states/azurerm_keyvault_key.py b/src/saltext/azurerm/states/azurerm_keyvault_key.py index efdba2a..52b2d37 100644 --- a/src/saltext/azurerm/states/azurerm_keyvault_key.py +++ b/src/saltext/azurerm/states/azurerm_keyvault_key.py @@ -169,16 +169,16 @@ def present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Key {} is already present.".format(name) + ret["comment"] = f"Key {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Key {} would be updated.".format(name) + ret["comment"] = f"Key {name} would be updated." return ret if __opts__["test"]: - ret["comment"] = "Key {} would be created.".format(name) + ret["comment"] = f"Key {name} would be created." ret["result"] = None return ret @@ -208,7 +208,9 @@ def present( ret["comment"] = f"Key {name} has been {action}d." return ret - ret["comment"] = "Failed to {} Key {}! ({})".format(action, name, key.get("error")) + ret["comment"] = "Failed to {} Key {}! ({})".format( # pylint: disable=consider-using-f-string + action, name, key.get("error") + ) if not ret["result"]: ret["changes"] = {} return ret @@ -254,11 +256,11 @@ def absent(name, vault_url, connection_auth=None): if "error" in key: ret["result"] = True - ret["comment"] = "Key {} was not found.".format(name) + ret["comment"] = f"Key {name} was not found." return ret if __opts__["test"]: - ret["comment"] = "Key {} would be deleted.".format(name) + ret["comment"] = f"Key {name} would be deleted." ret["result"] = None ret["changes"] = { "old": key, @@ -272,9 +274,9 @@ def absent(name, vault_url, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Key {} has been deleted.".format(name) + ret["comment"] = f"Key {name} has been deleted." ret["changes"] = {"old": key, "new": {}} return ret - ret["comment"] = "Failed to delete Key {}!".format(name) + ret["comment"] = f"Failed to delete Key {name}!" return ret diff --git a/src/saltext/azurerm/states/azurerm_keyvault_secret.py b/src/saltext/azurerm/states/azurerm_keyvault_secret.py index 19bc644..6eba502 100644 --- a/src/saltext/azurerm/states/azurerm_keyvault_secret.py +++ b/src/saltext/azurerm/states/azurerm_keyvault_secret.py @@ -165,16 +165,16 @@ def present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Secret {} is already present.".format(name) + ret["comment"] = f"Secret {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Secret {} would be updated.".format(name) + ret["comment"] = f"Secret {name} would be updated." return ret if __opts__["test"]: - ret["comment"] = "Secret {} would be created.".format(name) + ret["comment"] = f"Secret {name} would be created." ret["result"] = None return ret @@ -216,7 +216,11 @@ def present( ret["comment"] = f"Secret {name} has been {action}d." return ret - ret["comment"] = "Failed to {} Secret {}! ({})".format(action, name, secret.get("error")) + ret[ + "comment" + ] = "Failed to {} Secret {}! ({})".format( # pylint: disable=consider-using-f-string + action, name, secret.get("error") + ) if not ret["result"]: ret["changes"] = {} return ret diff --git a/src/saltext/azurerm/states/azurerm_keyvault_vault.py b/src/saltext/azurerm/states/azurerm_keyvault_vault.py index 8086e53..db41fdf 100644 --- a/src/saltext/azurerm/states/azurerm_keyvault_vault.py +++ b/src/saltext/azurerm/states/azurerm_keyvault_vault.py @@ -332,16 +332,16 @@ def present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Key Vault {} is already present.".format(name) + ret["comment"] = f"Key Vault {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Key Vault {} would be updated.".format(name) + ret["comment"] = f"Key Vault {name} would be updated." return ret if __opts__["test"]: - ret["comment"] = "Key vault {} would be created.".format(name) + ret["comment"] = f"Key vault {name} would be created." ret["result"] = None return ret @@ -377,7 +377,11 @@ def present( ret["comment"] = f"Key Vault {name} has been {action}d." return ret - ret["comment"] = "Failed to {} Key Vault {}! ({})".format(action, name, vault.get("error")) + ret[ + "comment" + ] = "Failed to {} Key Vault {}! ({})".format( # pylint: disable=consider-using-f-string + action, name, vault.get("error") + ) if not ret["result"]: ret["changes"] = {} return ret @@ -418,11 +422,11 @@ def absent(name, resource_group, connection_auth=None): if "error" in vault: ret["result"] = True - ret["comment"] = "Key Vault {} was not found.".format(name) + ret["comment"] = f"Key Vault {name} was not found." return ret if __opts__["test"]: - ret["comment"] = "Key Vault {} would be deleted.".format(name) + ret["comment"] = f"Key Vault {name} would be deleted." ret["result"] = None ret["changes"] = { "old": vault, @@ -434,9 +438,9 @@ def absent(name, resource_group, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Key Vault {} has been deleted.".format(name) + ret["comment"] = f"Key Vault {name} has been deleted." ret["changes"] = {"old": vault, "new": {}} return ret - ret["comment"] = "Failed to delete Key Vault {}!".format(name) + ret["comment"] = f"Failed to delete Key Vault {name}!" return ret diff --git a/src/saltext/azurerm/states/azurerm_network.py b/src/saltext/azurerm/states/azurerm_network.py index 51df6a2..f416c9d 100644 --- a/src/saltext/azurerm/states/azurerm_network.py +++ b/src/saltext/azurerm/states/azurerm_network.py @@ -101,7 +101,7 @@ def virtual_network_present( dns_servers=None, tags=None, connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -196,12 +196,12 @@ def virtual_network_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Virtual network {} is already present.".format(name) + ret["comment"] = f"Virtual network {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Virtual network {} would be updated.".format(name) + ret["comment"] = f"Virtual network {name} would be updated." return ret else: @@ -219,7 +219,7 @@ def virtual_network_present( } if __opts__["test"]: - ret["comment"] = "Virtual network {} would be created.".format(name) + ret["comment"] = f"Virtual network {name} would be created." ret["result"] = None return ret @@ -232,15 +232,19 @@ def virtual_network_present( address_prefixes=address_prefixes, dns_servers=dns_servers, tags=tags, - **vnet_kwargs + **vnet_kwargs, ) if "error" not in vnet: ret["result"] = True - ret["comment"] = "Virtual network {} has been created.".format(name) + ret["comment"] = f"Virtual network {name} has been created." return ret - ret["comment"] = "Failed to create virtual network {}! ({})".format(name, vnet.get("error")) + ret[ + "comment" + ] = "Failed to create virtual network {}! ({})".format( # pylint: disable=consider-using-f-string + name, vnet.get("error") + ) return ret @@ -272,11 +276,11 @@ def virtual_network_absent(name, resource_group, connection_auth=None): if "error" in vnet: ret["result"] = True - ret["comment"] = "Virtual network {} was not found.".format(name) + ret["comment"] = f"Virtual network {name} was not found." return ret elif __opts__["test"]: - ret["comment"] = "Virtual network {} would be deleted.".format(name) + ret["comment"] = f"Virtual network {name} would be deleted." ret["result"] = None ret["changes"] = { "old": vnet, @@ -290,11 +294,11 @@ def virtual_network_absent(name, resource_group, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Virtual network {} has been deleted.".format(name) + ret["comment"] = f"Virtual network {name} has been deleted." ret["changes"] = {"old": vnet, "new": {}} return ret - ret["comment"] = "Failed to delete virtual network {}!".format(name) + ret["comment"] = f"Failed to delete virtual network {name}!" return ret @@ -306,7 +310,7 @@ def subnet_present( security_group=None, route_table=None, connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -390,12 +394,12 @@ def subnet_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Subnet {} is already present.".format(name) + ret["comment"] = f"Subnet {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Subnet {} would be updated.".format(name) + ret["comment"] = f"Subnet {name} would be updated." return ret else: @@ -410,7 +414,7 @@ def subnet_present( } if __opts__["test"]: - ret["comment"] = "Subnet {} would be created.".format(name) + ret["comment"] = f"Subnet {name} would be created." ret["result"] = None return ret @@ -424,15 +428,19 @@ def subnet_present( address_prefix=address_prefix, network_security_group=security_group, route_table=route_table, - **snet_kwargs + **snet_kwargs, ) if "error" not in snet: ret["result"] = True - ret["comment"] = "Subnet {} has been created.".format(name) + ret["comment"] = f"Subnet {name} has been created." return ret - ret["comment"] = "Failed to create subnet {}! ({})".format(name, snet.get("error")) + ret[ + "comment" + ] = "Failed to create subnet {}! ({})".format( # pylint: disable=consider-using-f-string + name, snet.get("error") + ) return ret @@ -467,11 +475,11 @@ def subnet_absent(name, virtual_network, resource_group, connection_auth=None): if "error" in snet: ret["result"] = True - ret["comment"] = "Subnet {} was not found.".format(name) + ret["comment"] = f"Subnet {name} was not found." return ret elif __opts__["test"]: - ret["comment"] = "Subnet {} would be deleted.".format(name) + ret["comment"] = f"Subnet {name} would be deleted." ret["result"] = None ret["changes"] = { "old": snet, @@ -485,11 +493,11 @@ def subnet_absent(name, virtual_network, resource_group, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Subnet {} has been deleted.".format(name) + ret["comment"] = f"Subnet {name} has been deleted." ret["changes"] = {"old": snet, "new": {}} return ret - ret["comment"] = "Failed to delete subnet {}!".format(name) + ret["comment"] = f"Failed to delete subnet {name}!" return ret @@ -577,7 +585,11 @@ def network_security_group_present( ) if comp_ret.get("comment"): - ret["comment"] = '"security_rules" {}'.format(comp_ret["comment"]) + ret[ + "comment" + ] = '"security_rules" {}'.format( # pylint: disable=consider-using-f-string + comp_ret["comment"] + ) return ret if comp_ret.get("changes"): @@ -585,12 +597,12 @@ def network_security_group_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Network security group {} is already present.".format(name) + ret["comment"] = f"Network security group {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Network security group {} would be updated.".format(name) + ret["comment"] = f"Network security group {name} would be updated." return ret else: @@ -605,7 +617,7 @@ def network_security_group_present( } if __opts__["test"]: - ret["comment"] = "Network security group {} would be created.".format(name) + ret["comment"] = f"Network security group {name} would be created." ret["result"] = None return ret @@ -617,15 +629,17 @@ def network_security_group_present( resource_group=resource_group, tags=tags, security_rules=security_rules, - **nsg_kwargs + **nsg_kwargs, ) if "error" not in nsg: ret["result"] = True - ret["comment"] = "Network security group {} has been created.".format(name) + ret["comment"] = f"Network security group {name} has been created." return ret - ret["comment"] = "Failed to create network security group {}! ({})".format( + ret[ + "comment" + ] = "Failed to create network security group {}! ({})".format( # pylint: disable=consider-using-f-string name, nsg.get("error") ) return ret @@ -659,11 +673,11 @@ def network_security_group_absent(name, resource_group, connection_auth=None): if "error" in nsg: ret["result"] = True - ret["comment"] = "Network security group {} was not found.".format(name) + ret["comment"] = f"Network security group {name} was not found." return ret elif __opts__["test"]: - ret["comment"] = "Network security group {} would be deleted.".format(name) + ret["comment"] = f"Network security group {name} would be deleted." ret["result"] = None ret["changes"] = { "old": nsg, @@ -677,11 +691,11 @@ def network_security_group_absent(name, resource_group, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Network security group {} has been deleted.".format(name) + ret["comment"] = f"Network security group {name} has been deleted." ret["changes"] = {"old": nsg, "new": {}} return ret - ret["comment"] = "Failed to delete network security group {}!".format(name) + ret["comment"] = f"Failed to delete network security group {name}!" return ret @@ -703,7 +717,7 @@ def security_rule_present( source_address_prefixes=None, source_port_ranges=None, connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -812,7 +826,9 @@ def security_rule_present( for params in exclusive_params: # pylint: disable=eval-used if not eval(params[0]) and not eval(params[1]): - ret["comment"] = "Either the {} or {} parameter must be provided!".format( + ret[ + "comment" + ] = "Either the {} or {} parameter must be provided!".format( # pylint: disable=consider-using-f-string params[0], params[1] ) return ret @@ -820,10 +836,10 @@ def security_rule_present( if eval(params[0]): # pylint: disable=eval-used if not isinstance(eval(params[0]), list): - ret["comment"] = "The {} parameter must be a list!".format(params[0]) + ret["comment"] = f"The {params[0]} parameter must be a list!" return ret # pylint: disable=exec-used - exec("{} = None".format(params[1])) + exec(f"{params[1]} = None") rule = __salt__["azurerm_network.security_rule_get"]( name, security_group, resource_group, azurerm_log_level="info", **connection_auth @@ -946,12 +962,12 @@ def security_rule_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Security rule {} is already present.".format(name) + ret["comment"] = f"Security rule {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Security rule {} would be updated.".format(name) + ret["comment"] = f"Security rule {name} would be updated." return ret else: @@ -976,7 +992,7 @@ def security_rule_present( } if __opts__["test"]: - ret["comment"] = "Security rule {} would be created.".format(name) + ret["comment"] = f"Security rule {name} would be created." ret["result"] = None return ret @@ -1000,15 +1016,19 @@ def security_rule_present( source_address_prefixes=source_address_prefixes, source_port_range=source_port_range, source_port_ranges=source_port_ranges, - **rule_kwargs + **rule_kwargs, ) if "error" not in rule: ret["result"] = True - ret["comment"] = "Security rule {} has been created.".format(name) + ret["comment"] = f"Security rule {name} has been created." return ret - ret["comment"] = "Failed to create security rule {}! ({})".format(name, rule.get("error")) + ret[ + "comment" + ] = "Failed to create security rule {}! ({})".format( # pylint: disable=consider-using-f-string + name, rule.get("error") + ) return ret @@ -1043,11 +1063,11 @@ def security_rule_absent(name, security_group, resource_group, connection_auth=N if "error" in rule: ret["result"] = True - ret["comment"] = "Security rule {} was not found.".format(name) + ret["comment"] = f"Security rule {name} was not found." return ret elif __opts__["test"]: - ret["comment"] = "Security rule {} would be deleted.".format(name) + ret["comment"] = f"Security rule {name} would be deleted." ret["result"] = None ret["changes"] = { "old": rule, @@ -1061,11 +1081,11 @@ def security_rule_absent(name, security_group, resource_group, connection_auth=N if deleted: ret["result"] = True - ret["comment"] = "Security rule {} has been deleted.".format(name) + ret["comment"] = f"Security rule {name} has been deleted." ret["changes"] = {"old": rule, "new": {}} return ret - ret["comment"] = "Failed to delete security rule {}!".format(name) + ret["comment"] = f"Failed to delete security rule {name}!" return ret @@ -1082,7 +1102,7 @@ def load_balancer_present( outbound_nat_rules=None, tags=None, connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -1282,7 +1302,11 @@ def load_balancer_present( ) if comp_ret.get("comment"): - ret["comment"] = '"frontend_ip_configurations" {}'.format(comp_ret["comment"]) + ret[ + "comment" + ] = '"frontend_ip_configurations" {}'.format( # pylint: disable=consider-using-f-string + comp_ret["comment"] + ) return ret if comp_ret.get("changes"): @@ -1295,7 +1319,11 @@ def load_balancer_present( ) if comp_ret.get("comment"): - ret["comment"] = '"backend_address_pools" {}'.format(comp_ret["comment"]) + ret[ + "comment" + ] = '"backend_address_pools" {}'.format( # pylint: disable=consider-using-f-string + comp_ret["comment"] + ) return ret if comp_ret.get("changes"): @@ -1308,7 +1336,9 @@ def load_balancer_present( ) if comp_ret.get("comment"): - ret["comment"] = '"probes" {}'.format(comp_ret["comment"]) + ret["comment"] = '"probes" {}'.format( # pylint: disable=consider-using-f-string + comp_ret["comment"] + ) return ret if comp_ret.get("changes"): @@ -1323,7 +1353,11 @@ def load_balancer_present( ) if comp_ret.get("comment"): - ret["comment"] = '"load_balancing_rules" {}'.format(comp_ret["comment"]) + ret[ + "comment" + ] = '"load_balancing_rules" {}'.format( # pylint: disable=consider-using-f-string + comp_ret["comment"] + ) return ret if comp_ret.get("changes"): @@ -1338,7 +1372,11 @@ def load_balancer_present( ) if comp_ret.get("comment"): - ret["comment"] = '"inbound_nat_rules" {}'.format(comp_ret["comment"]) + ret[ + "comment" + ] = '"inbound_nat_rules" {}'.format( # pylint: disable=consider-using-f-string + comp_ret["comment"] + ) return ret if comp_ret.get("changes"): @@ -1353,7 +1391,11 @@ def load_balancer_present( ) if comp_ret.get("comment"): - ret["comment"] = '"inbound_nat_pools" {}'.format(comp_ret["comment"]) + ret[ + "comment" + ] = '"inbound_nat_pools" {}'.format( # pylint: disable=consider-using-f-string + comp_ret["comment"] + ) return ret if comp_ret.get("changes"): @@ -1368,7 +1410,11 @@ def load_balancer_present( ) if comp_ret.get("comment"): - ret["comment"] = '"outbound_nat_rules" {}'.format(comp_ret["comment"]) + ret[ + "comment" + ] = '"outbound_nat_rules" {}'.format( # pylint: disable=consider-using-f-string + comp_ret["comment"] + ) return ret if comp_ret.get("changes"): @@ -1376,12 +1422,12 @@ def load_balancer_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Load balancer {} is already present.".format(name) + ret["comment"] = f"Load balancer {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Load balancer {} would be updated.".format(name) + ret["comment"] = f"Load balancer {name} would be updated." return ret else: @@ -1402,7 +1448,7 @@ def load_balancer_present( } if __opts__["test"]: - ret["comment"] = "Load balancer {} would be created.".format(name) + ret["comment"] = f"Load balancer {name} would be created." ret["result"] = None return ret @@ -1421,15 +1467,19 @@ def load_balancer_present( inbound_nat_rules=inbound_nat_rules, inbound_nat_pools=inbound_nat_pools, outbound_nat_rules=outbound_nat_rules, - **lb_kwargs + **lb_kwargs, ) if "error" not in load_bal: ret["result"] = True - ret["comment"] = "Load balancer {} has been created.".format(name) + ret["comment"] = f"Load balancer {name} has been created." return ret - ret["comment"] = "Failed to create load balancer {}! ({})".format(name, load_bal.get("error")) + ret[ + "comment" + ] = "Failed to create load balancer {}! ({})".format( # pylint: disable=consider-using-f-string + name, load_bal.get("error") + ) return ret @@ -1461,11 +1511,11 @@ def load_balancer_absent(name, resource_group, connection_auth=None): if "error" in load_bal: ret["result"] = True - ret["comment"] = "Load balancer {} was not found.".format(name) + ret["comment"] = f"Load balancer {name} was not found." return ret elif __opts__["test"]: - ret["comment"] = "Load balancer {} would be deleted.".format(name) + ret["comment"] = f"Load balancer {name} would be deleted." ret["result"] = None ret["changes"] = { "old": load_bal, @@ -1479,11 +1529,11 @@ def load_balancer_absent(name, resource_group, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Load balancer {} has been deleted.".format(name) + ret["comment"] = f"Load balancer {name} has been deleted." ret["changes"] = {"old": load_bal, "new": {}} return ret - ret["comment"] = "Failed to delete load balancer {}!".format(name) + ret["comment"] = f"Failed to delete load balancer {name}!" return ret @@ -1497,7 +1547,7 @@ def public_ip_address_present( dns_settings=None, idle_timeout_in_minutes=None, connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -1630,12 +1680,12 @@ def public_ip_address_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Public IP address {} is already present.".format(name) + ret["comment"] = f"Public IP address {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Public IP address {} would be updated.".format(name) + ret["comment"] = f"Public IP address {name} would be updated." return ret else: @@ -1653,7 +1703,7 @@ def public_ip_address_present( } if __opts__["test"]: - ret["comment"] = "Public IP address {} would be created.".format(name) + ret["comment"] = f"Public IP address {name} would be created." ret["result"] = None return ret @@ -1669,15 +1719,19 @@ def public_ip_address_present( public_ip_allocation_method=public_ip_allocation_method, public_ip_address_version=public_ip_address_version, idle_timeout_in_minutes=idle_timeout_in_minutes, - **pub_ip_kwargs + **pub_ip_kwargs, ) if "error" not in pub_ip: ret["result"] = True - ret["comment"] = "Public IP address {} has been created.".format(name) + ret["comment"] = f"Public IP address {name} has been created." return ret - ret["comment"] = "Failed to create public IP address {}! ({})".format(name, pub_ip.get("error")) + ret[ + "comment" + ] = "Failed to create public IP address {}! ({})".format( # pylint: disable=consider-using-f-string + name, pub_ip.get("error") + ) return ret @@ -1709,11 +1763,11 @@ def public_ip_address_absent(name, resource_group, connection_auth=None): if "error" in pub_ip: ret["result"] = True - ret["comment"] = "Public IP address {} was not found.".format(name) + ret["comment"] = f"Public IP address {name} was not found." return ret elif __opts__["test"]: - ret["comment"] = "Public IP address {} would be deleted.".format(name) + ret["comment"] = f"Public IP address {name} would be deleted." ret["result"] = None ret["changes"] = { "old": pub_ip, @@ -1727,11 +1781,11 @@ def public_ip_address_absent(name, resource_group, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Public IP address {} has been deleted.".format(name) + ret["comment"] = f"Public IP address {name} has been deleted." ret["changes"] = {"old": pub_ip, "new": {}} return ret - ret["comment"] = "Failed to delete public IP address {}!".format(name) + ret["comment"] = f"Failed to delete public IP address {name}!" return ret @@ -1750,7 +1804,7 @@ def network_interface_present( enable_accelerated_networking=None, enable_ip_forwarding=None, connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -1927,7 +1981,11 @@ def network_interface_present( ) if comp_ret.get("comment"): - ret["comment"] = '"ip_configurations" {}'.format(comp_ret["comment"]) + ret[ + "comment" + ] = '"ip_configurations" {}'.format( # pylint: disable=consider-using-f-string + comp_ret["comment"] + ) return ret if comp_ret.get("changes"): @@ -1935,12 +1993,12 @@ def network_interface_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Network interface {} is already present.".format(name) + ret["comment"] = f"Network interface {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Network interface {} would be updated.".format(name) + ret["comment"] = f"Network interface {name} would be updated." return ret else: @@ -1961,7 +2019,7 @@ def network_interface_present( } if __opts__["test"]: - ret["comment"] = "Network interface {} would be created.".format(name) + ret["comment"] = f"Network interface {name} would be created." ret["result"] = None return ret @@ -1982,15 +2040,19 @@ def network_interface_present( network_security_group=network_security_group, virtual_machine=virtual_machine, tags=tags, - **iface_kwargs + **iface_kwargs, ) if "error" not in iface: ret["result"] = True - ret["comment"] = "Network interface {} has been created.".format(name) + ret["comment"] = f"Network interface {name} has been created." return ret - ret["comment"] = "Failed to create network interface {}! ({})".format(name, iface.get("error")) + ret[ + "comment" + ] = "Failed to create network interface {}! ({})".format( # pylint: disable=consider-using-f-string + name, iface.get("error") + ) return ret @@ -2022,11 +2084,11 @@ def network_interface_absent(name, resource_group, connection_auth=None): if "error" in iface: ret["result"] = True - ret["comment"] = "Network interface {} was not found.".format(name) + ret["comment"] = f"Network interface {name} was not found." return ret elif __opts__["test"]: - ret["comment"] = "Network interface {} would be deleted.".format(name) + ret["comment"] = f"Network interface {name} would be deleted." ret["result"] = None ret["changes"] = { "old": iface, @@ -2040,11 +2102,11 @@ def network_interface_absent(name, resource_group, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Network interface {} has been deleted.".format(name) + ret["comment"] = f"Network interface {name} has been deleted." ret["changes"] = {"old": iface, "new": {}} return ret - ret["comment"] = "Failed to delete network interface {}!)".format(name) + ret["comment"] = f"Failed to delete network interface {name}!)" return ret @@ -2055,7 +2117,7 @@ def route_table_present( routes=None, disable_bgp_route_propagation=None, connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -2139,7 +2201,9 @@ def route_table_present( ) if comp_ret.get("comment"): - ret["comment"] = '"routes" {}'.format(comp_ret["comment"]) + ret["comment"] = '"routes" {}'.format( # pylint: disable=consider-using-f-string + comp_ret["comment"] + ) return ret if comp_ret.get("changes"): @@ -2147,12 +2211,12 @@ def route_table_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Route table {} is already present.".format(name) + ret["comment"] = f"Route table {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Route table {} would be updated.".format(name) + ret["comment"] = f"Route table {name} would be updated." return ret else: @@ -2167,7 +2231,7 @@ def route_table_present( } if __opts__["test"]: - ret["comment"] = "Route table {} would be created.".format(name) + ret["comment"] = f"Route table {name} would be created." ret["result"] = None return ret @@ -2180,15 +2244,19 @@ def route_table_present( disable_bgp_route_propagation=disable_bgp_route_propagation, routes=routes, tags=tags, - **rt_tbl_kwargs + **rt_tbl_kwargs, ) if "error" not in rt_tbl: ret["result"] = True - ret["comment"] = "Route table {} has been created.".format(name) + ret["comment"] = f"Route table {name} has been created." return ret - ret["comment"] = "Failed to create route table {}! ({})".format(name, rt_tbl.get("error")) + ret[ + "comment" + ] = "Failed to create route table {}! ({})".format( # pylint: disable=consider-using-f-string + name, rt_tbl.get("error") + ) return ret @@ -2220,11 +2288,11 @@ def route_table_absent(name, resource_group, connection_auth=None): if "error" in rt_tbl: ret["result"] = True - ret["comment"] = "Route table {} was not found.".format(name) + ret["comment"] = f"Route table {name} was not found." return ret elif __opts__["test"]: - ret["comment"] = "Route table {} would be deleted.".format(name) + ret["comment"] = f"Route table {name} would be deleted." ret["result"] = None ret["changes"] = { "old": rt_tbl, @@ -2238,11 +2306,11 @@ def route_table_absent(name, resource_group, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Route table {} has been deleted.".format(name) + ret["comment"] = f"Route table {name} has been deleted." ret["changes"] = {"old": rt_tbl, "new": {}} return ret - ret["comment"] = "Failed to delete route table {}!".format(name) + ret["comment"] = f"Failed to delete route table {name}!" return ret @@ -2254,7 +2322,7 @@ def route_present( resource_group, next_hop_ip_address=None, connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -2334,12 +2402,12 @@ def route_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Route {} is already present.".format(name) + ret["comment"] = f"Route {name} is already present." return ret if __opts__["test"]: ret["result"] = None - ret["comment"] = "Route {} would be updated.".format(name) + ret["comment"] = f"Route {name} would be updated." return ret else: @@ -2354,7 +2422,7 @@ def route_present( } if __opts__["test"]: - ret["comment"] = "Route {} would be created.".format(name) + ret["comment"] = f"Route {name} would be created." ret["result"] = None return ret @@ -2368,15 +2436,19 @@ def route_present( address_prefix=address_prefix, next_hop_type=next_hop_type, next_hop_ip_address=next_hop_ip_address, - **route_kwargs + **route_kwargs, ) if "error" not in route: ret["result"] = True - ret["comment"] = "Route {} has been created.".format(name) + ret["comment"] = f"Route {name} has been created." return ret - ret["comment"] = "Failed to create route {}! ({})".format(name, route.get("error")) + ret[ + "comment" + ] = "Failed to create route {}! ({})".format( # pylint: disable=consider-using-f-string + name, route.get("error") + ) return ret @@ -2411,11 +2483,11 @@ def route_absent(name, route_table, resource_group, connection_auth=None): if "error" in route: ret["result"] = True - ret["comment"] = "Route {} was not found.".format(name) + ret["comment"] = f"Route {name} was not found." return ret elif __opts__["test"]: - ret["comment"] = "Route {} would be deleted.".format(name) + ret["comment"] = f"Route {name} would be deleted." ret["result"] = None ret["changes"] = { "old": route, @@ -2429,9 +2501,9 @@ def route_absent(name, route_table, resource_group, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Route {} has been deleted.".format(name) + ret["comment"] = f"Route {name} has been deleted." ret["changes"] = {"old": route, "new": {}} return ret - ret["comment"] = "Failed to delete route {}!".format(name) + ret["comment"] = f"Failed to delete route {name}!" return ret diff --git a/src/saltext/azurerm/states/azurerm_resource.py b/src/saltext/azurerm/states/azurerm_resource.py index 51babc2..91ab28e 100644 --- a/src/saltext/azurerm/states/azurerm_resource.py +++ b/src/saltext/azurerm/states/azurerm_resource.py @@ -144,17 +144,17 @@ def resource_group_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Resource group {} is already present.".format(name) + ret["comment"] = f"Resource group {name} is already present." return ret if __opts__["test"]: - ret["comment"] = "Resource group {} tags would be updated.".format(name) + ret["comment"] = f"Resource group {name} tags would be updated." ret["result"] = None ret["changes"] = {"old": group.get("tags", {}), "new": tags} return ret elif __opts__["test"]: - ret["comment"] = "Resource group {} would be created.".format(name) + ret["comment"] = f"Resource group {name} would be created." ret["result"] = None ret["changes"] = { "old": {}, @@ -177,11 +177,15 @@ def resource_group_present( if present: ret["result"] = True - ret["comment"] = "Resource group {} has been created.".format(name) + ret["comment"] = f"Resource group {name} has been created." ret["changes"] = {"old": {}, "new": group} return ret - ret["comment"] = "Failed to create resource group {}! ({})".format(name, group.get("error")) + ret[ + "comment" + ] = "Failed to create resource group {}! ({})".format( # pylint: disable=consider-using-f-string + name, group.get("error") + ) return ret @@ -210,13 +214,13 @@ def resource_group_absent(name, connection_auth=None): if not present: ret["result"] = True - ret["comment"] = "Resource group {} is already absent.".format(name) + ret["comment"] = f"Resource group {name} is already absent." return ret elif __opts__["test"]: group = __salt__["azurerm_resource.resource_group_get"](name, **connection_auth) - ret["comment"] = "Resource group {} would be deleted.".format(name) + ret["comment"] = f"Resource group {name} would be deleted." ret["result"] = None ret["changes"] = { "old": group, @@ -236,11 +240,11 @@ def resource_group_absent(name, connection_auth=None): if not present: ret["result"] = True - ret["comment"] = "Resource group {} has been deleted.".format(name) + ret["comment"] = f"Resource group {name} has been deleted." ret["changes"] = {"old": group, "new": {}} return ret - ret["comment"] = "Failed to delete resource group {}!".format(name) + ret["comment"] = f"Failed to delete resource group {name}!" return ret @@ -260,7 +264,7 @@ def policy_definition_present( source_hash_name=None, skip_verify=False, connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -381,7 +385,7 @@ def policy_definition_present( try: temp_rule = json.loads(policy_rule_json) except Exception as exc: # pylint: disable=broad-except - ret["comment"] = "Unable to load policy rule json! ({})".format(exc) + ret["comment"] = f"Unable to load policy rule json! ({exc})" return ret elif policy_rule_file: try: @@ -399,23 +403,27 @@ def policy_definition_present( None, None, skip_verify=skip_verify, - **kwargs + **kwargs, ) except Exception as exc: # pylint: disable=broad-except - ret["comment"] = 'Unable to locate policy rule file "{}"! ({})'.format( + ret[ + "comment" + ] = 'Unable to locate policy rule file "{}"! ({})'.format( # pylint: disable=consider-using-f-string policy_rule_file, exc ) return ret if not sfn: - ret["comment"] = 'Unable to locate policy rule file "{}"!)'.format(policy_rule_file) + ret["comment"] = f'Unable to locate policy rule file "{policy_rule_file}"!)' return ret try: with salt.utils.files.fopen(sfn, "r") as prf: temp_rule = json.load(prf) except Exception as exc: # pylint: disable=broad-except - ret["comment"] = 'Unable to load policy rule file "{}"! ({})'.format( + ret[ + "comment" + ] = 'Unable to load policy rule file "{}"! ({})'.format( # pylint: disable=consider-using-f-string policy_rule_file, exc ) return ret @@ -479,11 +487,11 @@ def policy_definition_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Policy definition {} is already present.".format(name) + ret["comment"] = f"Policy definition {name} is already present." return ret if __opts__["test"]: - ret["comment"] = "Policy definition {} would be updated.".format(name) + ret["comment"] = f"Policy definition {name} would be updated." ret["result"] = None return ret @@ -503,7 +511,7 @@ def policy_definition_present( } if __opts__["test"]: - ret["comment"] = "Policy definition {} would be created.".format(name) + ret["comment"] = f"Policy definition {name} would be created." ret["result"] = None return ret @@ -525,15 +533,19 @@ def policy_definition_present( description=description, metadata=metadata, parameters=parameters, - **policy_kwargs + **policy_kwargs, ) if "error" not in policy: ret["result"] = True - ret["comment"] = "Policy definition {} has been created.".format(name) + ret["comment"] = f"Policy definition {name} has been created." return ret - ret["comment"] = "Failed to create policy definition {}! ({})".format(name, policy.get("error")) + ret[ + "comment" + ] = "Failed to create policy definition {}! ({})".format( # pylint: disable=consider-using-f-string + name, policy.get("error") + ) return ret @@ -562,11 +574,11 @@ def policy_definition_absent(name, connection_auth=None): if "error" in policy: ret["result"] = True - ret["comment"] = "Policy definition {} is already absent.".format(name) + ret["comment"] = f"Policy definition {name} is already absent." return ret elif __opts__["test"]: - ret["comment"] = "Policy definition {} would be deleted.".format(name) + ret["comment"] = f"Policy definition {name} would be deleted." ret["result"] = None ret["changes"] = { "old": policy, @@ -578,11 +590,11 @@ def policy_definition_absent(name, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Policy definition {} has been deleted.".format(name) + ret["comment"] = f"Policy definition {name} has been deleted." ret["changes"] = {"old": policy, "new": {}} return ret - ret["comment"] = "Failed to delete policy definition {}!".format(name) + ret["comment"] = f"Failed to delete policy definition {name}!" return ret @@ -595,7 +607,7 @@ def policy_assignment_present( assignment_type=None, parameters=None, connection_auth=None, - **kwargs + **kwargs, ): """ .. versionadded:: 2019.2.0 @@ -682,11 +694,11 @@ def policy_assignment_present( if not ret["changes"]: ret["result"] = True - ret["comment"] = "Policy assignment {} is already present.".format(name) + ret["comment"] = f"Policy assignment {name} is already present." return ret if __opts__["test"]: - ret["comment"] = "Policy assignment {} would be updated.".format(name) + ret["comment"] = f"Policy assignment {name} would be updated." ret["result"] = None return ret @@ -705,7 +717,7 @@ def policy_assignment_present( } if __opts__["test"]: - ret["comment"] = "Policy assignment {} would be created.".format(name) + ret["comment"] = f"Policy assignment {name} would be created." ret["result"] = None return ret @@ -722,15 +734,19 @@ def policy_assignment_present( display_name=display_name, description=description, parameters=parameters, - **policy_kwargs + **policy_kwargs, ) if "error" not in policy: ret["result"] = True - ret["comment"] = "Policy assignment {} has been created.".format(name) + ret["comment"] = f"Policy assignment {name} has been created." return ret - ret["comment"] = "Failed to create policy assignment {}! ({})".format(name, policy.get("error")) + ret[ + "comment" + ] = "Failed to create policy assignment {}! ({})".format( # pylint: disable=consider-using-f-string + name, policy.get("error") + ) return ret @@ -762,11 +778,11 @@ def policy_assignment_absent(name, scope, connection_auth=None): if "error" in policy: ret["result"] = True - ret["comment"] = "Policy assignment {} is already absent.".format(name) + ret["comment"] = f"Policy assignment {name} is already absent." return ret elif __opts__["test"]: - ret["comment"] = "Policy assignment {} would be deleted.".format(name) + ret["comment"] = f"Policy assignment {name} would be deleted." ret["result"] = None ret["changes"] = { "old": policy, @@ -778,9 +794,9 @@ def policy_assignment_absent(name, scope, connection_auth=None): if deleted: ret["result"] = True - ret["comment"] = "Policy assignment {} has been deleted.".format(name) + ret["comment"] = f"Policy assignment {name} has been deleted." ret["changes"] = {"old": policy, "new": {}} return ret - ret["comment"] = "Failed to delete policy assignment {}!".format(name) + ret["comment"] = f"Failed to delete policy assignment {name}!" return ret diff --git a/src/saltext/azurerm/utils/azurerm.py b/src/saltext/azurerm/utils/azurerm.py index fb5a3d8..5dc3b9e 100644 --- a/src/saltext/azurerm/utils/azurerm.py +++ b/src/saltext/azurerm/utils/azurerm.py @@ -218,12 +218,12 @@ def create_object_model(module_name, object_name, **kwargs): object_kwargs = {} try: - model_module = importlib.import_module("azure.mgmt.{}.models".format(module_name)) + model_module = importlib.import_module(f"azure.mgmt.{module_name}.models") # pylint: disable=invalid-name Model = getattr(model_module, object_name) except ImportError: raise sys.exit( # pylint: disable=raise-missing-from - "The {} model in the {} Azure module is not available.".format(object_name, module_name) + f"The {object_name} model in the {module_name} Azure module is not available." ) if "_attribute_map" in dir(Model): diff --git a/src/saltext/azurerm/version.py b/src/saltext/azurerm/version.py deleted file mode 100644 index d750c32..0000000 --- a/src/saltext/azurerm/version.py +++ /dev/null @@ -1,2 +0,0 @@ -# pylint: disable=missing-module-docstring -__version__ = "4.0.1" diff --git a/tests/conftest.py b/tests/conftest.py index 7a6c377..d1d59a0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,4 @@ +import logging import os import pytest @@ -5,6 +6,17 @@ from saltfactories.utils import random_string +# Reset the root logger to its default level(because salt changed it) +logging.root.setLevel(logging.WARNING) + + +# This swallows all logging to stdout. +# To show select logs, set --log-cli-level= +for handler in logging.root.handlers[:]: + logging.root.removeHandler(handler) + handler.close() + + @pytest.fixture(scope="session") def salt_factories_config(): """ diff --git a/tests/functional/__init__.py b/tests/functional/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py new file mode 100644 index 0000000..2c7c84a --- /dev/null +++ b/tests/functional/conftest.py @@ -0,0 +1,150 @@ +import logging +import shutil + +import pytest +from saltfactories.utils.functional import Loaders + +log = logging.getLogger(__name__) + + +@pytest.fixture(scope="package") +def minion_id(): + return "func-tests-minion-opts" + + +@pytest.fixture(scope="module") +def state_tree(tmp_path_factory): + state_tree_path = tmp_path_factory.mktemp("state-tree-base") + try: + yield state_tree_path + finally: + shutil.rmtree(str(state_tree_path), ignore_errors=True) + + +@pytest.fixture(scope="module") +def state_tree_prod(tmp_path_factory): + state_tree_path = tmp_path_factory.mktemp("state-tree-prod") + try: + yield state_tree_path + finally: + shutil.rmtree(str(state_tree_path), ignore_errors=True) + + +@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 + """ + return {} + + +@pytest.fixture(scope="module") +def minion_config_overrides(): + """ + Functional test modules can provide this fixture to tweak the configuration + overrides dictionary passed to the minion factory + """ + return {} + + +@pytest.fixture(scope="module") +def minion_opts( + salt_factories, + minion_id, + state_tree, + state_tree_prod, + minion_config_defaults, + minion_config_overrides, +): + minion_config_overrides.update( + { + "file_client": "local", + "file_roots": { + "base": [ + str(state_tree), + ], + "prod": [ + str(state_tree_prod), + ], + }, + } + ) + factory = salt_factories.salt_minion_daemon( + minion_id, + defaults=minion_config_defaults or None, + overrides=minion_config_overrides, + ) + return factory.config.copy() + + +@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 + """ + return {} + + +@pytest.fixture(scope="module") +def master_config_overrides(): + """ + Functional test modules can provide this fixture to tweak the configuration + overrides dictionary passed to the master factory + """ + return {} + + +@pytest.fixture(scope="module") +def master_opts( + salt_factories, + state_tree, + state_tree_prod, + master_config_defaults, + master_config_overrides, +): + master_config_overrides.update( + { + "file_client": "local", + "file_roots": { + "base": [ + str(state_tree), + ], + "prod": [ + str(state_tree_prod), + ], + }, + } + ) + factory = salt_factories.salt_master_daemon( + "func-tests-master-opts", + defaults=master_config_defaults or None, + overrides=master_config_overrides, + ) + return factory.config.copy() + + +@pytest.fixture(scope="module") +def loaders(minion_opts): + return Loaders(minion_opts, loaded_base_name=f"{__name__}.loaded") + + +@pytest.fixture(autouse=True) +def reset_loaders_state(loaders): + try: + # Run the tests + yield + 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/tests/integration/conftest.py b/tests/integration/conftest.py index 4ad9061..2935c35 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -21,12 +21,12 @@ def minion(minion): @pytest.fixture def salt_run_cli(master): - return master.get_salt_run_cli() + return master.salt_run_cli() @pytest.fixture def salt_cli(master): - return master.get_salt_cli() + return master.salt_cli() @pytest.fixture diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py new file mode 100644 index 0000000..3e3fa4a --- /dev/null +++ b/tests/unit/conftest.py @@ -0,0 +1,57 @@ +import pytest +import salt.config + + +@pytest.fixture +def minion_opts(tmp_path): + """ + 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) + for name in ("cachedir", "pki_dir", "sock_dir", "conf_dir"): + dirpath = root_dir / name + dirpath.mkdir(parents=True) + opts[name] = str(dirpath) + opts["log_file"] = "logs/minion.log" + return opts + + +@pytest.fixture +def master_opts(tmp_path): + """ + Default master configuration with relative temporary paths to not + require root permissions. + """ + root_dir = tmp_path / "master" + opts = salt.config.master_config(None) + opts["__role"] = "master" + opts["root_dir"] = str(root_dir) + for name in ("cachedir", "pki_dir", "sock_dir", "conf_dir"): + dirpath = root_dir / name + dirpath.mkdir(parents=True) + opts[name] = str(dirpath) + opts["log_file"] = "logs/master.log" + return opts + + +@pytest.fixture +def syndic_opts(tmp_path): + """ + Default master configuration with relative temporary paths to not + require root permissions. + """ + root_dir = tmp_path / "syndic" + opts = salt.config.DEFAULT_MINION_OPTS.copy() + opts["syndic_master"] = "127.0.0.1" + opts["__role"] = "minion" + opts["root_dir"] = str(root_dir) + for name in ("cachedir", "pki_dir", "sock_dir", "conf_dir"): + dirpath = root_dir / name + dirpath.mkdir(parents=True) + opts[name] = str(dirpath) + opts["log_file"] = "logs/syndic.log" + return opts From 91f456f193a51d092bf0473ac0caa8d8a47e000b Mon Sep 17 00:00:00 2001 From: nicholasmhughes Date: Sun, 31 Dec 2023 23:16:36 -0500 Subject: [PATCH 2/9] centralize workflows --- .github/workflows/pr.yml | 19 ++ .github/workflows/tag.yml | 32 +++ .github/workflows/test.yml | 445 ------------------------------------- 3 files changed, 51 insertions(+), 445 deletions(-) create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/tag.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..3a04455 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,19 @@ +name: Pull Request or Push + +on: + push: + branches: + - 'main' # Run on pushes to main + tags-ignore: + - '*' # Ignore pushes to tags + pull_request: + +jobs: + call_central_workflow: + name: CI + uses: salt-extensions/central-artifacts/.github/workflows/ci.yml@main + with: + setup-vault: true + permissions: + contents: write + pull-requests: read diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 0000000..abdd5e7 --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,32 @@ +name: Tagged Releases + +on: + push: + tags: + - "v*" # Only tags starting with "v" for "v1.0.0", etc. + +jobs: + get_tag_version: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.get_version.outputs.version }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Extract tag name + id: get_version + run: echo "::set-output name=version::$(echo ${GITHUB_REF#refs/tags/v})" + + call_central_workflow: + needs: get_tag_version + uses: salt-extensions/central-artifacts/.github/workflows/ci.yml@main + with: + setup-vault: true + release: true + version: ${{ needs.get_tag_version.outputs.version }} + permissions: + contents: write + id-token: write + pull-requests: read + secrets: inherit diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index cf19d67..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,445 +0,0 @@ - -name: Testing - -on: [push, pull_request] - -jobs: - Pre-Commit: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: "3.10" - - 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-22.04 - needs: Pre-Commit - - timeout-minutes: 10 - - steps: - - uses: actions/checkout@v2 - - - name: Set up Python 3.10 For Nox - uses: actions/setup-python@v1 - with: - python-version: "3.10" - - - name: Install Nox - run: | - python -m pip install --upgrade pip - pip uninstall -y distro-info - pip install nox - - - name: Install Doc Requirements - env: - SALT_REQUIREMENT: salt==3006.1 - 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-22.04 - needs: Pre-Commit - - timeout-minutes: 15 - - strategy: - fail-fast: false - max-parallel: 4 - matrix: - python-version: - - "3.10" - salt-version: - - 3006.1 - - 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 uninstall -y distro-info - pip install nox - - - name: Install Test Requirements - env: - SALT_REQUIREMENT: salt==${{ matrix.salt-version }} - run: | - nox --force-color -e tests-3 --install-only - - - name: Unit Test - env: - SALT_REQUIREMENT: salt==${{ matrix.salt-version }} - SKIP_REQUIREMENTS_INSTALL: YES - run: | - nox --force-color -e tests-3 -- -vv tests/unit - - - name: Integration Test - if: false - env: - SALT_REQUIREMENT: salt==${{ matrix.salt-version }} - SKIP_REQUIREMENTS_INSTALL: YES - run: | - nox --force-color -e tests-3 -- -vv tests/integration - - - 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('-22.04', ''), '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: - if: false - runs-on: windows-2019 - needs: Pre-Commit - - timeout-minutes: 40 - - strategy: - fail-fast: false - max-parallel: 3 - matrix: - python-version: - - "3.10" - salt-version: - - 3006.1 - - 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: Unit 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/unit - - - name: Integration Test - if: false - 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/integration - - - 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('-2019', ''), '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: - if: false - runs-on: macOS-10.15 - needs: Pre-Commit - - timeout-minutes: 40 - - strategy: - fail-fast: false - max-parallel: 3 - matrix: - python-version: - - "3.10" - salt-version: - - 3006.1 - - 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: Unit Test - env: - SALT_REQUIREMENT: salt==${{ matrix.salt-version }} - SKIP_REQUIREMENTS_INSTALL: YES - run: | - nox --force-color -e tests-3 -- -vv tests/unit - - - name: Integration Test - if: false - env: - SALT_REQUIREMENT: salt==${{ matrix.salt-version }} - SKIP_REQUIREMENTS_INSTALL: YES - run: | - nox --force-color -e tests-3 -- -vv tests/integration - - - 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('-10.15', ''), '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 From 72e853c1a9256473581bc74bb73d30299b6241bf Mon Sep 17 00:00:00 2001 From: nicholasmhughes Date: Sun, 31 Dec 2023 23:41:03 -0500 Subject: [PATCH 3/9] suppress non-consecutive header warnings --- docs/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index f54c4d7..7e439fc 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -123,6 +123,8 @@ autosummary_generate = False +suppress_warnings = ["myst.header"] + # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for From 902eb0f4c0624be8e0b50216f85cc6b3a3a44bdf Mon Sep 17 00:00:00 2001 From: nicholasmhughes Date: Sun, 31 Dec 2023 23:58:25 -0500 Subject: [PATCH 4/9] resolve doc build error for conf_master reference --- src/saltext/azurerm/fileserver/azurefs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/saltext/azurerm/fileserver/azurefs.py b/src/saltext/azurerm/fileserver/azurefs.py index 05953e7..9420bf7 100644 --- a/src/saltext/azurerm/fileserver/azurefs.py +++ b/src/saltext/azurerm/fileserver/azurefs.py @@ -3,8 +3,8 @@ .. versionadded:: 2015.8.0 -To enable, add ``azurefs`` to the :conf_master:`fileserver_backend` option in -the Master config file. +To enable, add ``azurefs`` to the `fileserver_backend` option in the +Master config file. .. code-block:: yaml From b02a0b478f14dd78ab201cd1dba88ea7671b615c Mon Sep 17 00:00:00 2001 From: nicholasmhughes Date: Mon, 1 Jan 2024 00:11:27 -0500 Subject: [PATCH 5/9] resolve doc build error for strong start without end --- src/saltext/azurerm/modules/azurerm_compute.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/saltext/azurerm/modules/azurerm_compute.py b/src/saltext/azurerm/modules/azurerm_compute.py index ea5e9fc..a03341e 100644 --- a/src/saltext/azurerm/modules/azurerm_compute.py +++ b/src/saltext/azurerm/modules/azurerm_compute.py @@ -70,7 +70,7 @@ def availability_set_create_or_update( .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_availability_set.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Create or update an availability set. From 0fd7ffd4f0dae6692798de415b55197ff44ef6a1 Mon Sep 17 00:00:00 2001 From: nicholasmhughes Date: Mon, 1 Jan 2024 00:20:14 -0500 Subject: [PATCH 6/9] resolve doc build error for strong start without end --- .../azurerm/modules/azurerm_compute.py | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/saltext/azurerm/modules/azurerm_compute.py b/src/saltext/azurerm/modules/azurerm_compute.py index a03341e..9738b96 100644 --- a/src/saltext/azurerm/modules/azurerm_compute.py +++ b/src/saltext/azurerm/modules/azurerm_compute.py @@ -96,7 +96,7 @@ def availability_set_delete(name, resource_group, **kwargs): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_availability_set.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Delete an availability set. @@ -122,7 +122,7 @@ def availability_set_get(name, resource_group, **kwargs): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_availability_set.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Get a dictionary representing an availability set's properties. @@ -148,7 +148,7 @@ def availability_sets_list(resource_group, **kwargs): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_availability_set.py) - and will be deprecated in the future.** + and will be deprecated in the future.** List all availability sets within a resource group. @@ -172,7 +172,7 @@ def availability_sets_list_available_sizes(name, resource_group, **kwargs): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_availability_set.py) - and will be deprecated in the future.** + and will be deprecated in the future.** List all available virtual machine sizes that can be used to to create a new virtual machine in an existing availability set. @@ -202,7 +202,7 @@ def virtual_machine_capture( .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_virtual_machine.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. @@ -240,7 +240,7 @@ def virtual_machine_get(name, resource_group, **kwargs): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_virtual_machine.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Retrieves information about the model view or the instance view of a virtual machine. @@ -267,7 +267,7 @@ def virtual_machine_convert_to_managed_disks(name, resource_group, **kwargs): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_virtual_machine.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @@ -294,7 +294,7 @@ def virtual_machine_deallocate(name, resource_group, **kwargs): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_virtual_machine.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Power off a virtual machine and deallocate compute resources. @@ -320,7 +320,7 @@ def virtual_machine_generalize(name, resource_group, **kwargs): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_virtual_machine.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Set the state of a virtual machine to 'generalized'. @@ -346,7 +346,7 @@ def virtual_machines_list(resource_group, **kwargs): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_virtual_machine.py) - and will be deprecated in the future.** + and will be deprecated in the future.** List all virtual machines within a resource group. @@ -368,7 +368,7 @@ def virtual_machines_list_all(**kwargs): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_virtual_machine.py) - and will be deprecated in the future.** + and will be deprecated in the future.** List all virtual machines within a subscription. @@ -389,7 +389,7 @@ def virtual_machines_list_available_sizes( .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_virtual_machine.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Lists all available virtual machine sizes to which the specified virtual machine can be resized. @@ -416,7 +416,7 @@ def virtual_machine_power_off(name, resource_group, **kwargs): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_virtual_machine.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Power off (stop) a virtual machine. @@ -494,7 +494,7 @@ def virtual_machine_redeploy(name, resource_group, **kwargs): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_virtual_machine.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Redeploy a virtual machine. From 0542c545dfc52dfdf85d4812e616434066692e3f Mon Sep 17 00:00:00 2001 From: nicholasmhughes Date: Mon, 1 Jan 2024 00:27:12 -0500 Subject: [PATCH 7/9] resolve doc build error for unexpected indentation --- .../azurerm/modules/azurerm_keyvault_vault.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/saltext/azurerm/modules/azurerm_keyvault_vault.py b/src/saltext/azurerm/modules/azurerm_keyvault_vault.py index 3e5c99c..5fcfac0 100644 --- a/src/saltext/azurerm/modules/azurerm_keyvault_vault.py +++ b/src/saltext/azurerm/modules/azurerm_keyvault_vault.py @@ -134,17 +134,17 @@ def create_or_update( - ``application_id``: (Optional) Application ID of the client making request on behalf of a principal. - ``permissions``: (Required) A dictionary representing permissions the identity has for keys, secrets, and certifications. Valid parameters include: - - ``keys``: A list that represents permissions to keys. Possible values include: 'backup', 'create', - 'decrypt', 'delete', 'encrypt', 'get', 'import_enum', 'list', 'purge', 'recover', 'restore', 'sign', - 'unwrap_key', 'update', 'verify', and 'wrap_key'. - - ``secrets``: A list that represents permissions to secrets. Possible values include: 'backup', 'delete', - 'get', 'list', 'purge', 'recover', 'restore', and 'set'. - - ``certificates``: A list that represents permissions to certificates. Possible values include: 'create', - 'delete', 'deleteissuers', 'get', 'getissuers', 'import_enum', 'list', 'listissuers', 'managecontacts', - 'manageissuers', 'purge', 'recover', 'setissuers', and 'update'. - - ``storage``: A list that represents permissions to storage accounts. Possible values include: 'backup', - 'delete', 'deletesas', 'get', 'getsas', 'list', 'listsas', 'purge', 'recover', 'regeneratekey', - 'restore', 'set', 'setsas', and 'update'. + - ``keys``: A list that represents permissions to keys. Possible values include: 'backup', 'create', + 'decrypt', 'delete', 'encrypt', 'get', 'import_enum', 'list', 'purge', 'recover', 'restore', 'sign', + 'unwrap_key', 'update', 'verify', and 'wrap_key'. + - ``secrets``: A list that represents permissions to secrets. Possible values include: 'backup', 'delete', + 'get', 'list', 'purge', 'recover', 'restore', and 'set'. + - ``certificates``: A list that represents permissions to certificates. Possible values include: 'create', + 'delete', 'deleteissuers', 'get', 'getissuers', 'import_enum', 'list', 'listissuers', 'managecontacts', + 'manageissuers', 'purge', 'recover', 'setissuers', and 'update'. + - ``storage``: A list that represents permissions to storage accounts. Possible values include: 'backup', + 'delete', 'deletesas', 'get', 'getsas', 'list', 'listsas', 'purge', 'recover', 'regeneratekey', + 'restore', 'set', 'setsas', and 'update'. :param vault_uri: The URI of the vault for performing operations on keys and secrets. From e5a4709d958704074e03701b6691b0e77c1734e2 Mon Sep 17 00:00:00 2001 From: nicholasmhughes Date: Mon, 1 Jan 2024 00:57:44 -0500 Subject: [PATCH 8/9] resolve doc build error for unexpected indentation --- docs/all.rst | 14 ----------- docs/ref/clouds/all.rst | 11 --------- docs/ref/modules/all.rst | 23 ------------------ .../azurerm/modules/azurerm_keyvault_vault.py | 24 ++++++++++--------- src/saltext/azurerm/states/azurerm_compute.py | 4 ++-- src/saltext/azurerm/states/azurerm_dns.py | 4 ++-- 6 files changed, 17 insertions(+), 63 deletions(-) delete mode 100644 docs/all.rst delete mode 100644 docs/ref/clouds/all.rst delete mode 100644 docs/ref/modules/all.rst diff --git a/docs/all.rst b/docs/all.rst deleted file mode 100644 index 41db337..0000000 --- a/docs/all.rst +++ /dev/null @@ -1,14 +0,0 @@ -.. _all the states/modules: - -Complete List of Azure Resource Manager -======================================= - -.. toctree:: - :maxdepth: 2 - :glob: - - topics/index - ref/clouds/all - ref/modules/all - ref/states/all - ref/utils/all diff --git a/docs/ref/clouds/all.rst b/docs/ref/clouds/all.rst deleted file mode 100644 index b44718f..0000000 --- a/docs/ref/clouds/all.rst +++ /dev/null @@ -1,11 +0,0 @@ - -.. all-saltext.azurerm.clouds: - -_____________ -Cloud Modules -_____________ - -.. autosummary:: - :toctree: - - saltext.azurerm.clouds.azurerm diff --git a/docs/ref/modules/all.rst b/docs/ref/modules/all.rst deleted file mode 100644 index 241b7c7..0000000 --- a/docs/ref/modules/all.rst +++ /dev/null @@ -1,23 +0,0 @@ - -.. all-saltext.azurerm.modules: - -_________ -Execution -_________ - -.. autosummary:: - :toctree: - - saltext.azurerm.modules.azurerm_compute - saltext.azurerm.modules.azurerm_compute_availability_set - saltext.azurerm.modules.azurerm_compute_disk - saltext.azurerm.modules.azurerm_compute_image - saltext.azurerm.modules.azurerm_compute_virtual_machine - saltext.azurerm.modules.azurerm_compute_virtual_machine_extension - saltext.azurerm.modules.azurerm_compute_virtual_machine_image - saltext.azurerm.modules.azurerm_dns - saltext.azurerm.modules.azurerm_keyvault_key - saltext.azurerm.modules.azurerm_keyvault_secret - saltext.azurerm.modules.azurerm_keyvault_vault - saltext.azurerm.modules.azurerm_network - saltext.azurerm.modules.azurerm_resource diff --git a/src/saltext/azurerm/modules/azurerm_keyvault_vault.py b/src/saltext/azurerm/modules/azurerm_keyvault_vault.py index 5fcfac0..0fa89ee 100644 --- a/src/saltext/azurerm/modules/azurerm_keyvault_vault.py +++ b/src/saltext/azurerm/modules/azurerm_keyvault_vault.py @@ -134,6 +134,7 @@ def create_or_update( - ``application_id``: (Optional) Application ID of the client making request on behalf of a principal. - ``permissions``: (Required) A dictionary representing permissions the identity has for keys, secrets, and certifications. Valid parameters include: + - ``keys``: A list that represents permissions to keys. Possible values include: 'backup', 'create', 'decrypt', 'delete', 'encrypt', 'get', 'import_enum', 'list', 'purge', 'recover', 'restore', 'sign', 'unwrap_key', 'update', 'verify', and 'wrap_key'. @@ -498,17 +499,18 @@ def update_access_policy(name, resource_group, operation_kind, access_policies, - ``application_id``: (Optional) Application ID of the client making request on behalf of a principal. - ``permissions``: (Required) A dictionary representing permissions the identity has for keys, secrets, and certifications. Valid parameters include: - - ``keys``: A list that represents permissions to keys. Possible values include: 'backup', 'create', - 'decrypt', 'delete', 'encrypt', 'get', 'import_enum', 'list', 'purge', 'recover', 'restore', 'sign', - 'unwrap_key', 'update', 'verify', and 'wrap_key'. - - ``secrets``: A list that represents permissions to secrets. Possible values include: 'backup', 'delete', - 'get', 'list', 'purge', 'recover', 'restore', and 'set'. - - ``certificates``: A list that represents permissions to certificates. Possible values include: 'create', - 'delete', 'deleteissuers', 'get', 'getissuers', 'import_enum', 'list', 'listissuers', 'managecontacts', - 'manageissuers', 'purge', 'recover', 'setissuers', and 'update'. - - ``storage``: A list that represents permissions to storage accounts. Possible values include: 'backup', - 'delete', 'deletesas', 'get', 'getsas', 'list', 'listsas', 'purge', 'recover', 'regeneratekey', - 'restore', 'set', 'setsas', and 'update'. + + - ``keys``: A list that represents permissions to keys. Possible values include: 'backup', 'create', + 'decrypt', 'delete', 'encrypt', 'get', 'import_enum', 'list', 'purge', 'recover', 'restore', 'sign', + 'unwrap_key', 'update', 'verify', and 'wrap_key'. + - ``secrets``: A list that represents permissions to secrets. Possible values include: 'backup', 'delete', + 'get', 'list', 'purge', 'recover', 'restore', and 'set'. + - ``certificates``: A list that represents permissions to certificates. Possible values include: 'create', + 'delete', 'deleteissuers', 'get', 'getissuers', 'import_enum', 'list', 'listissuers', 'managecontacts', + 'manageissuers', 'purge', 'recover', 'setissuers', and 'update'. + - ``storage``: A list that represents permissions to storage accounts. Possible values include: 'backup', + 'delete', 'deletesas', 'get', 'getsas', 'list', 'listsas', 'purge', 'recover', 'regeneratekey', + 'restore', 'set', 'setsas', and 'update'. CLI Example: diff --git a/src/saltext/azurerm/states/azurerm_compute.py b/src/saltext/azurerm/states/azurerm_compute.py index 1d2be97..04f0704 100644 --- a/src/saltext/azurerm/states/azurerm_compute.py +++ b/src/saltext/azurerm/states/azurerm_compute.py @@ -105,7 +105,7 @@ def availability_set_present( .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_availability_set.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Ensure an availability set exists. @@ -173,7 +173,7 @@ def availability_set_absent(name, resource_group, connection_auth=None): .. versionadded:: 2019.2.0 **WARNING: This function has been moved to another file (azurerm_compute_availability_set.py) - and will be deprecated in the future.** + and will be deprecated in the future.** Ensure an availability set does not exist in a resource group. diff --git a/src/saltext/azurerm/states/azurerm_dns.py b/src/saltext/azurerm/states/azurerm_dns.py index c06d4c9..aee426c 100644 --- a/src/saltext/azurerm/states/azurerm_dns.py +++ b/src/saltext/azurerm/states/azurerm_dns.py @@ -163,7 +163,7 @@ def zone_present( :param zone_type: The type of this DNS zone (Public or Private). Possible values include: 'Public', 'Private'. Default value: 'Public' - (requires `azure-mgmt-dns `_ >= 2.0.0rc1) + (requires `azure-mgmt-dns `_ >= 2.0.0rc1) :param connection_auth: A dict with subscription and authentication parameters to be used in connecting to the @@ -325,7 +325,7 @@ def zone_absent(name, resource_group, zone_type="Public", connection_auth=None): :param zone_type: The type of this DNS zone (Public or Private). Possible values include: 'Public', 'Private'. Default value: 'Public' - (requires `azure-mgmt-dns `_ >= 2.0.0rc1) + (requires `azure-mgmt-dns `_ >= 2.0.0rc1) """ ret = {"name": name, "result": False, "comment": "", "changes": {}} From ebd0280659196a114f479ff1e103dd530ede0db0 Mon Sep 17 00:00:00 2001 From: nicholasmhughes Date: Mon, 1 Jan 2024 09:08:00 -0500 Subject: [PATCH 9/9] resolve doc build errors --- docs/index.rst | 6 ++++++ docs/ref/states/all.rst | 19 ------------------ docs/ref/utils/all.rst | 11 ---------- .../azurerm_compute_virtual_machine.py | 2 +- .../states/azurerm_compute_virtual_machine.py | 2 +- src/saltext/azurerm/states/azurerm_dns.py | 20 +++++++++---------- 6 files changed, 18 insertions(+), 42 deletions(-) delete mode 100644 docs/ref/states/all.rst delete mode 100644 docs/ref/utils/all.rst diff --git a/docs/index.rst b/docs/index.rst index 907055d..df28fe9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -8,6 +8,7 @@ Salt Extension for interacting with Microsoft Azure :caption: Guides :hidden: + topics/index topics/installation .. toctree:: @@ -15,6 +16,11 @@ Salt Extension for interacting with Microsoft Azure :caption: Provided Modules :hidden: + ref/clouds/index + ref/fileserver/index + ref/modules/index + ref/states/index + ref/utils/index .. toctree:: :maxdepth: 2 diff --git a/docs/ref/states/all.rst b/docs/ref/states/all.rst deleted file mode 100644 index bf23779..0000000 --- a/docs/ref/states/all.rst +++ /dev/null @@ -1,19 +0,0 @@ - -.. all-saltext.azurerm.states: - -_____________ -State Modules -_____________ - -.. autosummary:: - :toctree: - - saltext.azurerm.states.azurerm_compute - saltext.azurerm.states.azurerm_compute_availability_set - saltext.azurerm.states.azurerm_compute_virtual_machine - saltext.azurerm.states.azurerm_dns - saltext.azurerm.states.azurerm_keyvault_key - saltext.azurerm.states.azurerm_keyvault_vault - saltext.azurerm.states.azurerm_keyvault_secret - saltext.azurerm.states.azurerm_network - saltext.azurerm.states.azurerm_resource diff --git a/docs/ref/utils/all.rst b/docs/ref/utils/all.rst deleted file mode 100644 index 973f1f1..0000000 --- a/docs/ref/utils/all.rst +++ /dev/null @@ -1,11 +0,0 @@ - -.. all-saltext.azurerm.utils: - -____________ -Util Modules -____________ - -.. autosummary:: - :toctree: - - saltext.azurerm.utils.azurerm diff --git a/src/saltext/azurerm/modules/azurerm_compute_virtual_machine.py b/src/saltext/azurerm/modules/azurerm_compute_virtual_machine.py index dc141f6..0599fc7 100644 --- a/src/saltext/azurerm/modules/azurerm_compute_virtual_machine.py +++ b/src/saltext/azurerm/modules/azurerm_compute_virtual_machine.py @@ -250,7 +250,7 @@ def create_or_update( :param availability_set: The resource ID of the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual - machines `_. + machines `_. Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. This parameter cannot be specified if the ``virtual_machine_scale_set`` parameter is also specified. diff --git a/src/saltext/azurerm/states/azurerm_compute_virtual_machine.py b/src/saltext/azurerm/states/azurerm_compute_virtual_machine.py index ae42a40..1921718 100644 --- a/src/saltext/azurerm/states/azurerm_compute_virtual_machine.py +++ b/src/saltext/azurerm/states/azurerm_compute_virtual_machine.py @@ -257,7 +257,7 @@ def present( :param availability_set: The resource ID of the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual - machines `_. + machines `_. Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. This parameter cannot be specified if the ``virtual_machine_scale_set`` parameter is also specified. diff --git a/src/saltext/azurerm/states/azurerm_dns.py b/src/saltext/azurerm/states/azurerm_dns.py index aee426c..cadb9be 100644 --- a/src/saltext/azurerm/states/azurerm_dns.py +++ b/src/saltext/azurerm/states/azurerm_dns.py @@ -434,61 +434,61 @@ def record_set_present( :param arecords: The list of A records in the record set. View the `Azure SDK documentation - `__ + `__ to create a list of dictionaries representing the record objects. :param aaaa_records: The list of AAAA records in the record set. View the `Azure SDK documentation - `__ + `__ to create a list of dictionaries representing the record objects. :param mx_records: The list of MX records in the record set. View the `Azure SDK documentation - `__ + `__ to create a list of dictionaries representing the record objects. :param ns_records: The list of NS records in the record set. View the `Azure SDK documentation - `__ + `__ to create a list of dictionaries representing the record objects. :param ptr_records: The list of PTR records in the record set. View the `Azure SDK documentation - `__ + `__ to create a list of dictionaries representing the record objects. :param srv_records: The list of SRV records in the record set. View the `Azure SDK documentation - `__ + `__ to create a list of dictionaries representing the record objects. :param txt_records: The list of TXT records in the record set. View the `Azure SDK documentation - `__ + `__ to create a list of dictionaries representing the record objects. :param cname_record: The CNAME record in the record set. View the `Azure SDK documentation - `__ + `__ to create a dictionary representing the record object. :param soa_record: The SOA record in the record set. View the `Azure SDK documentation - `__ + `__ to create a dictionary representing the record object. :param caa_records: The list of CAA records in the record set. View the `Azure SDK documentation - `__ + `__ to create a list of dictionaries representing the record objects. :param connection_auth: