Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package ansible-variables for
openSUSE:Factory checked in at 2023-09-08 21:15:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ansible-variables (Old)
and /work/SRC/openSUSE:Factory/.ansible-variables.new.1766 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ansible-variables"
Fri Sep 8 21:15:51 2023 rev:2 rq:1109654 version:0.5.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/ansible-variables/ansible-variables.changes
2023-05-26 20:15:43.700353809 +0200
+++
/work/SRC/openSUSE:Factory/.ansible-variables.new.1766/ansible-variables.changes
2023-09-08 21:16:48.601191766 +0200
@@ -1,0 +2,8 @@
+Fri Sep 8 04:40:19 UTC 2023 - Johannes Kastl <[email protected]>
+
+- update to 0.5.1:
+ Bug Fixes
+ * passing undefined variable to --var will lead to Exception
+ ([#30](https://github.com/hille721/ansible-variables/issues/30))
+
+-------------------------------------------------------------------
Old:
----
ansible-variables-0.5.0.tar.gz
New:
----
ansible-variables-0.5.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ansible-variables.spec ++++++
--- /var/tmp/diff_new_pack.0afHHx/_old 2023-09-08 21:16:50.301252526 +0200
+++ /var/tmp/diff_new_pack.0afHHx/_new 2023-09-08 21:16:50.317253098 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package python-ansible-variables
+# spec file for package ansible-variables
#
# Copyright (c) 2023 SUSE LLC
#
@@ -38,27 +38,27 @@
%endif
Name: ansible-variables
-Version: 0.5.0
+Version: 0.5.1
Release: 0
Summary: Tool to show origin of Ansible host context variables
-License: GPL-3.0+
+License: GPL-3.0-or-later
URL: https://github.com/hille721/ansible-variables
# the PyPI tarball does not contain all files required for the tests
Source:
https://github.com/hille721/ansible-variables/archive/v%{version}/ansible-variables-%{version}.tar.gz#/ansible-variables-%{version}.tar.gz
-BuildRequires: python-rpm-macros
BuildRequires: %{ansible_python}-pip
BuildRequires: %{ansible_python}-setuptools
BuildRequires: %{ansible_python}-wheel
+BuildRequires: python-rpm-macros
# SECTION test requirements
BuildRequires: ansible-core >= 2.11.0
BuildRequires: %{ansible_python}-pytest
BuildRequires: %{ansible_python}-rich
# /SECTION
BuildRequires: fdupes
-Requires: ansible-core >= 2.11.0
Requires: %{ansible_python}-rich
+Requires: ansible-core >= 2.11.0
Requires(post): update-alternatives
-Requires(postun): update-alternatives
+Requires(postun):update-alternatives
BuildArch: noarch
%description
++++++ _service ++++++
--- /var/tmp/diff_new_pack.0afHHx/_old 2023-09-08 21:16:50.585262676 +0200
+++ /var/tmp/diff_new_pack.0afHHx/_new 2023-09-08 21:16:50.589262819 +0200
@@ -1,5 +1,5 @@
<services>
- <service name="download_files" mode="disabled">
+ <service name="download_files" mode="manual">
</service>
</services>
++++++ ansible-variables-0.5.0.tar.gz -> ansible-variables-0.5.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/.github/dependabot.yml
new/ansible-variables-0.5.1/.github/dependabot.yml
--- old/ansible-variables-0.5.0/.github/dependabot.yml 1970-01-01
01:00:00.000000000 +0100
+++ new/ansible-variables-0.5.1/.github/dependabot.yml 2023-09-07
22:25:33.000000000 +0200
@@ -0,0 +1,17 @@
+---
+version: 2
+updates:
+ - package-ecosystem: pip
+ directory: /
+ schedule:
+ day: saturday
+ interval: weekly
+ labels:
+ - "dependencies"
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ day: saturday
+ interval: weekly
+ labels:
+ - "dependencies"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/ansible-variables-0.5.0/.github/workflows/publish.yml
new/ansible-variables-0.5.1/.github/workflows/publish.yml
--- old/ansible-variables-0.5.0/.github/workflows/publish.yml 2023-05-18
17:08:46.000000000 +0200
+++ new/ansible-variables-0.5.1/.github/workflows/publish.yml 2023-09-07
22:25:33.000000000 +0200
@@ -22,10 +22,10 @@
package-name: ansible-variables
# build & publish to PyPI
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
- name: Set up Python
- uses: actions/setup-python@v3
+ uses: actions/setup-python@v4
with:
python-version: "3.9"
if: ${{ steps.release.outputs.release_created }}
@@ -38,7 +38,7 @@
run: python -m build
if: ${{ steps.release.outputs.release_created }}
- name: Publish package
- uses:
pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
+ uses:
pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/.github/workflows/tox.yml
new/ansible-variables-0.5.1/.github/workflows/tox.yml
--- old/ansible-variables-0.5.0/.github/workflows/tox.yml 2023-05-18
17:08:46.000000000 +0200
+++ new/ansible-variables-0.5.1/.github/workflows/tox.yml 2023-09-07
22:25:33.000000000 +0200
@@ -1,28 +1,69 @@
-# This will run tox with https://github.com/ymyzk/tox-gh-actions
-name: Tox
+# This will run tox with https://github.com/coactions/dynamic-matrix
+name: tox
on:
push:
- branches: ["*"]
+ branches: ["main"]
pull_request:
branches: ["main"]
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number ||
github.sha }}
+ cancel-in-progress: true
+
+env:
+ FORCE_COLOR: 1 # tox, pytest, ansible-lint
+ PY_COLORS: 1
+
jobs:
- test:
+ pre:
+ name: pre
runs-on: ubuntu-latest
+ outputs:
+ matrix: ${{ steps.generate_matrix.outputs.matrix }}
+ steps:
+ - name: Determine matrix
+ id: generate_matrix
+ uses: coactions/dynamic-matrix@v1
+ with:
+ other_names: |
+ py38-2.11
+ py38-2.12
+ py38-2.13
+ py39-2.11
+ py39-2.12
+ py39-2.13
+ py39-2.14
+ py39-2.15
+ py310-2.12
+ py310-2.13
+ py310-2.14
+ py310-2.15
+ py310-devel
+ py311-2.14
+ py311-2.15
+ py311-devel
+
+ build:
+ name: ${{ matrix.name }}
+ runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
+ needs: pre
strategy:
- matrix:
- python-version: ["3.8", "3.9", "3.10", "3.11"]
+ matrix: ${{ fromJson(needs.pre.outputs.matrix) }}
steps:
- - uses: actions/checkout@v3
- - name: Set up Python ${{ matrix.python-version }}
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Set up python ${{ matrix.python_version }}
uses: actions/setup-python@v4
with:
- python-version: ${{ matrix.python-version }}
- - name: Install dependencies
+ python-version: ${{ matrix.python_version }}
+
+ - name: Install tox
run: |
- python -m pip install --upgrade pip
- python -m pip install tox tox-gh-actions
- - name: Test with tox
- run: tox
+ python -m pip install -U pip
+ pip install tox
+
+ - run: tox run -e ${{ matrix.passed_name }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/.gitignore
new/ansible-variables-0.5.1/.gitignore
--- old/ansible-variables-0.5.0/.gitignore 2023-05-18 17:08:46.000000000
+0200
+++ new/ansible-variables-0.5.1/.gitignore 2023-09-07 22:25:33.000000000
+0200
@@ -33,6 +33,7 @@
.tox
.cache
.pytest_cache
+.ruff_cache
results.xml
coverage.xml
# Development
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/.pre-commit-config.yaml
new/ansible-variables-0.5.1/.pre-commit-config.yaml
--- old/ansible-variables-0.5.0/.pre-commit-config.yaml 2023-05-18
17:08:46.000000000 +0200
+++ new/ansible-variables-0.5.1/.pre-commit-config.yaml 2023-09-07
22:25:33.000000000 +0200
@@ -1,5 +1,6 @@
---
ci:
+ autoupdate_schedule: monthly
# format compatible with release-please
autoupdate_commit_msg: "chore: pre-commit autoupdate"
autofix_commit_msg: |
@@ -20,40 +21,44 @@
language_version: python3
- repo: https://github.com/crate-ci/typos
- rev: v1.14.9
+ rev: v1.16.10
hooks:
- id: typos
- repo: https://github.com/psf/black
- rev: 23.3.0
+ rev: 23.7.0
hooks:
- id: black
exclude: ".ci/hack"
- - repo: https://github.com/pycqa/flake8.git
- rev: 6.0.0
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ rev: 'v0.0.287'
hooks:
- - id: flake8
+ - id: ruff
+ args:
+ - --fix
+ - --exit-non-zero-on-fix
- - repo: https://github.com/pycqa/doc8
- rev: v1.1.1
+ - repo: https://github.com/jackdewinter/pymarkdown
+ rev: v0.9.13.3
hooks:
- - id: doc8
+ - id: pymarkdown
+ args:
+ - -c
+ - .pymarkdown.json
+ - scan
+ exclude: CHANGELOG.md # is autogenerated
- repo: https://github.com/pycqa/pylint
- rev: v3.0.0a6
+ rev: v3.0.0a7
hooks:
- id: pylint
+ pass_filenames: false
+ entry: pylint lib tests
args:
- --output-format=colorized
additional_dependencies:
+ - .
- ansible-core>=2.11.0
- rich
- pytest
- stages: [manual] # not working if only single files are passed
-
- - repo: https://github.com/pycqa/isort
- rev: 5.12.0
- hooks:
- - id: isort
- name: isort
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/.pymarkdown.json
new/ansible-variables-0.5.1/.pymarkdown.json
--- old/ansible-variables-0.5.0/.pymarkdown.json 1970-01-01
01:00:00.000000000 +0100
+++ new/ansible-variables-0.5.1/.pymarkdown.json 2023-09-07
22:25:33.000000000 +0200
@@ -0,0 +1,13 @@
+{
+ "plugins": {
+ "line-length": {
+ "enabled": true,
+ "line_length": 120,
+ "heading_line_length": 80,
+ "code_block_line_length": 80
+ },
+ "ul-indent": {
+ "indent": 4
+ }
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/CHANGELOG.md
new/ansible-variables-0.5.1/CHANGELOG.md
--- old/ansible-variables-0.5.0/CHANGELOG.md 2023-05-18 17:08:46.000000000
+0200
+++ new/ansible-variables-0.5.1/CHANGELOG.md 2023-09-07 22:25:33.000000000
+0200
@@ -1,5 +1,12 @@
# Changelog
+##
[0.5.1](https://github.com/hille721/ansible-variables/compare/v0.5.0...v0.5.1)
(2023-09-07)
+
+
+### Bug Fixes
+
+* passing undefined variable to --var will lead to Exception
([#30](https://github.com/hille721/ansible-variables/issues/30))
([dfbb736](https://github.com/hille721/ansible-variables/commit/dfbb7365d7834ae2275172d2e9465a042f41e5e0))
+
##
[0.5.0](https://github.com/hille721/ansible-variables/compare/v0.4.3...v0.5.0)
(2023-05-18)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/README.md
new/ansible-variables-0.5.1/README.md
--- old/ansible-variables-0.5.0/README.md 2023-05-18 17:08:46.000000000
+0200
+++ new/ansible-variables-0.5.1/README.md 2023-09-07 22:25:33.000000000
+0200
@@ -5,7 +5,9 @@
[![pre-commit][pre-commit-badge]][pre-commit-link]
The Ansible inventory provides a very powerful framework to declare variables
in a hierarchical manner.
-There a lof of different places where a variable can be defined (inventory,
host_vars, groups_vars, ...) and Ansible will merge them in a specific order
([variable
precedence](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#understanding-variable-precedence)).
+There a lof of different places where a variable can be defined (inventory,
host_vars, groups_vars, ...)
+and Ansible will merge them in a specific order
+([variable
precedence](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#understanding-variable-precedence)).
`ansible-variables` will help to keep track of your host context variables:
@@ -27,7 +29,8 @@
## Usage
-The command line usage is similar to the official Ansible CLI tools,
especially like ansible-inventory, thus to see all possible commands and
options run
+The command line usage is similar to the official Ansible CLI tools,
especially like ansible-inventory,
+thus to see all possible commands and options run
```plain
ansible-variables --help
@@ -73,15 +76,20 @@
## Implementation
This tool is tightly coupled to the Ansible library (`ansible-core`) and
simple reuses what is already there.
-The whole structure and implementation was inspired and oriented by the
implementation of
[`ansible-inventory`](https://github.com/ansible/ansible/blob/devel/lib/ansible/cli/inventory.py).
+The whole structure and implementation was inspired and oriented by the
implementation of
+[`ansible-inventory`](https://github.com/ansible/ansible/blob/devel/lib/ansible/cli/inventory.py).
-To get the source and the inventory files in which Ansible will look for a
variable, we are using a [debug
flag](https://github.com/ansible/ansible/blob/devel/lib/ansible/vars/manager.py#L187)
in Ansible's `get_vars` method.
+To get the source and the inventory files in which Ansible will look for a
variable,
+we are using a [debug
flag](https://github.com/ansible/ansible/blob/devel/lib/ansible/vars/manager.py#L187)
+in Ansible's `get_vars` method.
-As as result, the output of `ansible-variables` can be fully trusted as it
uses the same methods as Ansible to get the variable precedence.
+As as result, the output of `ansible-variables` can be fully trusted
+as it uses the same methods as Ansible to get the variable precedence.
## Limitations
-* as written in the description, this tool only shows host context variables
and does not know anything about playbook or role variables or command line
options.
+* as written in the description, this tool only shows host context variables
and
+does not know anything about playbook or role variables or command line
options.
## Credits
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/ansible-variables-0.5.0/lib/ansible_variables/cli/__init__.py
new/ansible-variables-0.5.1/lib/ansible_variables/cli/__init__.py
--- old/ansible-variables-0.5.0/lib/ansible_variables/cli/__init__.py
2023-05-18 17:08:46.000000000 +0200
+++ new/ansible-variables-0.5.1/lib/ansible_variables/cli/__init__.py
2023-09-07 22:25:33.000000000 +0200
@@ -23,82 +23,81 @@
"""
@classmethod
- def cli_executor(cls, args=None):
+ def cli_executor(cls, args=None): # pylint:
disable=too-many-branches,too-many-statements
# no change for ansible-core >= 2.13
if hasattr(super(), "cli_executor"):
return super().cli_executor(args=args)
# backporting code from
https://github.com/ansible/ansible/blob/v2.13.9/lib/ansible/cli/__init__.py#L574
- else:
- if args is None:
- args = sys.argv
+ if args is None:
+ args = sys.argv
- try:
- display.debug("starting run")
+ try:
+ display.debug("starting run")
- ansible_dir = Path("~/.ansible").expanduser()
- try:
- ansible_dir.mkdir(mode=0o700)
- except OSError as exc:
- if exc.errno != errno.EEXIST:
- display.warning(
- "Failed to create the directory '%s': %s"
- % (ansible_dir, to_text(exc,
errors="surrogate_or_replace"))
- )
- else:
- display.debug("Created the '%s' directory" % ansible_dir)
-
- try:
- args = [to_text(a, errors="surrogate_or_strict") for a in
args]
- except UnicodeError:
- display.error(
- """Command line args are not in utf-8, unable to
continue.
- Ansible currently only understands utf-8"""
+ ansible_dir = Path("~/.ansible").expanduser()
+ try:
+ ansible_dir.mkdir(mode=0o700)
+ except OSError as exc:
+ if exc.errno != errno.EEXIST:
+ display.warning(
+ "Failed to create the directory '%s': %s"
+ % (ansible_dir, to_text(exc,
errors="surrogate_or_replace"))
)
- display.display("The full traceback was:\n\n%s" %
to_text(traceback.format_exc()))
- exit_code = 6
- else:
- cli = cls(args)
- exit_code = cli.run()
-
- except AnsibleOptionsError as exc:
- cli.parser.print_help()
- display.error(to_text(exc), wrap_text=False)
- exit_code = 5
- except AnsibleParserError as exc:
- display.error(to_text(exc), wrap_text=False)
- exit_code = 4
- # TQM takes care of these, but leaving comment to reserve the exit
codes
- # except AnsibleHostUnreachable as e:
- # display.error(str(e))
- # exit_code = 3
- # except AnsibleHostFailed as e:
- # display.error(str(e))
- # exit_code = 2
- except AnsibleError as e:
- display.error(to_text(e), wrap_text=False)
- exit_code = 1
- except KeyboardInterrupt:
- display.error("User interrupted execution")
- exit_code = 99
- except Exception as e:
- if C.DEFAULT_DEBUG:
- # Show raw stacktraces in debug mode, It also allow pdb to
- # enter post mortem mode.
- raise
- have_cli_options = bool(context.CLIARGS)
- display.error("Unexpected Exception, this is probably a bug:
%s" % to_text(e), wrap_text=False)
- if not have_cli_options or have_cli_options and
context.CLIARGS["verbosity"] > 2:
- log_only = False
- if hasattr(e, "orig_exc"):
- display.vvv("\nexception type: %s" %
to_text(type(e.orig_exc)))
- why = to_text(e.orig_exc)
- if to_text(e) != why:
- display.vvv("\noriginal msg: %s" % why)
- else:
- display.display("to see the full traceback, use -vvv")
- log_only = True
- display.display("the full traceback was:\n\n%s" %
to_text(traceback.format_exc()), log_only=log_only)
- exit_code = 250
+ else:
+ display.debug("Created the '%s' directory" % ansible_dir)
+
+ try:
+ args = [to_text(a, errors="surrogate_or_strict") for a in args]
+ except UnicodeError:
+ display.error(
+ """Command line args are not in utf-8, unable to continue.
+ Ansible currently only understands utf-8"""
+ )
+ display.display("The full traceback was:\n\n%s" %
to_text(traceback.format_exc()))
+ exit_code = 6
+ else:
+ cli = cls(args)
+ exit_code = cli.run()
+
+ except AnsibleOptionsError as exc:
+ cli.parser.print_help()
+ display.error(to_text(exc), wrap_text=False)
+ exit_code = 5
+ except AnsibleParserError as exc:
+ display.error(to_text(exc), wrap_text=False)
+ exit_code = 4
+ # TQM takes care of these, but leaving comment to reserve the exit
codes
+ # except AnsibleHostUnreachable as exc:
+ # display.error(str(exc))
+ # exit_code = 3
+ # except AnsibleHostFailed as exc:
+ # display.error(str(exc))
+ # exit_code = 2
+ except AnsibleError as exc:
+ display.error(to_text(exc), wrap_text=False)
+ exit_code = 1
+ except KeyboardInterrupt:
+ display.error("User interrupted execution")
+ exit_code = 99
+ except Exception as exc: # pylint: disable=broad-exception-caught
+ if C.DEFAULT_DEBUG:
+ # Show raw stacktraces in debug mode, It also allow pdb to
+ # enter post mortem mode.
+ raise
+ have_cli_options = bool(context.CLIARGS)
+ display.error("Unexpected Exception, this is probably a bug: %s" %
to_text(exc), wrap_text=False)
+ if not have_cli_options or have_cli_options and
context.CLIARGS["verbosity"] > 2:
+ log_only = False
+ if hasattr(exc, "orig_exc"):
+ display.vvv("\nexception type: %s" %
to_text(type(exc.orig_exc)))
+ why = to_text(exc.orig_exc)
+ if to_text(exc) != why:
+ display.vvv("\noriginal msg: %s" % why)
+ else:
+ display.display("to see the full traceback, use -vvv")
+ log_only = True
+ display.display("the full traceback was:\n\n%s" %
to_text(traceback.format_exc()), log_only=log_only)
+ exit_code = 250
- sys.exit(exit_code)
+ sys.exit(exit_code)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/ansible-variables-0.5.0/lib/ansible_variables/cli/variables.py
new/ansible-variables-0.5.1/lib/ansible_variables/cli/variables.py
--- old/ansible-variables-0.5.0/lib/ansible_variables/cli/variables.py
2023-05-18 17:08:46.000000000 +0200
+++ new/ansible-variables-0.5.1/lib/ansible_variables/cli/variables.py
2023-09-07 22:25:33.000000000 +0200
@@ -3,7 +3,7 @@
import rich
from ansible import context
from ansible.cli.arguments import option_helpers as opt_help
-from ansible.errors import AnsibleOptionsError
+from ansible.errors import AnsibleOptionsError, AnsibleUndefinedVariable
from ansible.module_utils._text import to_native
from ansible.utils.display import Display
@@ -126,6 +126,9 @@
var=context.CLIARGS["variable"],
):
if variable.name not in INTERNAL_VARS:
+ if context.CLIARGS["variable"] and not variable.value:
+ # variable as options passed which is not defined
+ raise AnsibleUndefinedVariable("Variable %s is not
defined" % variable.name)
rich.print(
f"[bold]{variable.name}[/bold]: {variable.value} -
[italic]{variable.source_mapped}[/italic]"
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/ansible-variables-0.5.0/lib/ansible_variables/utils/vars.py
new/ansible-variables-0.5.1/lib/ansible_variables/utils/vars.py
--- old/ansible-variables-0.5.0/lib/ansible_variables/utils/vars.py
2023-05-18 17:08:46.000000000 +0200
+++ new/ansible-variables-0.5.1/lib/ansible_variables/utils/vars.py
2023-09-07 22:25:33.000000000 +0200
@@ -42,7 +42,7 @@
}
for key, value in source_map.items():
- if self.source.startswith(key):
+ if self.source and self.source.startswith(key):
return value
return self.source
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/pyproject.toml
new/ansible-variables-0.5.1/pyproject.toml
--- old/ansible-variables-0.5.0/pyproject.toml 2023-05-18 17:08:46.000000000
+0200
+++ new/ansible-variables-0.5.1/pyproject.toml 2023-09-07 22:25:33.000000000
+0200
@@ -1,10 +1,19 @@
-# for now only be used for black config
+# for now only be used for black and ruff config
# maybe in the future we will use it instead of setup.py / setup.cfg
[tool.black]
line-length = 120
-[tool.isort]
-profile = "black"
-known_first_party = "ansible_variables"
-known_third_party = "ansible,pytest,pkg_resources,setuptools,rich"
-line_length = 120
+[tool.ruff]
+line-length = 120
+select = [
+ # Pyflakes
+ "F",
+ # Pycodestyle
+ "E",
+ "W",
+ # isort
+ "I001"
+ ]
+
+[tool.ruff.isort]
+known-first-party = ["ansible_variables"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/requirements-dev.txt
new/ansible-variables-0.5.1/requirements-dev.txt
--- old/ansible-variables-0.5.0/requirements-dev.txt 2023-05-18
17:08:46.000000000 +0200
+++ new/ansible-variables-0.5.1/requirements-dev.txt 2023-09-07
22:25:33.000000000 +0200
@@ -3,6 +3,6 @@
tox
black
pylint
-flake8
+ruff
pytest
pre-commit
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/setup.cfg
new/ansible-variables-0.5.1/setup.cfg
--- old/ansible-variables-0.5.0/setup.cfg 2023-05-18 17:08:46.000000000
+0200
+++ new/ansible-variables-0.5.1/setup.cfg 2023-09-07 22:25:33.000000000
+0200
@@ -1,6 +1,6 @@
[metadata]
name = ansible-variables
-version = 0.5.0
+version = 0.5.1
description = Keep track of Ansible host context variables
long_description = file: README.md
long_description_content_type = text/markdown
@@ -52,11 +52,8 @@
console_scripts =
ansible-variables = ansible_variables.cli.variables:main
-[flake8]
-max-line-length = 120
-
[pylint.format]
max-line-length = 120
[pylint."message control"]
-disable = missing-module-docstring, missing-function-docstring,
consider-using-f-string
+disable = missing-module-docstring, missing-function-docstring,
consider-using-f-string, fixme
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/tests/test_cli.py
new/ansible-variables-0.5.1/tests/test_cli.py
--- old/ansible-variables-0.5.0/tests/test_cli.py 2023-05-18
17:08:46.000000000 +0200
+++ new/ansible-variables-0.5.1/tests/test_cli.py 2023-09-07
22:25:33.000000000 +0200
@@ -6,6 +6,9 @@
C.set_constant("CONFIG_FILE", "tests/test_data/ansible.cfg")
C.set_constant("DEFAULT_HOST_LIST", "tests/test_data/inventory")
+# FIXME: we should not invoke the test with main() or VariablesCLI() as this
will lead to context.CLIArgs set
+# which will not be cleared between the tests and so could lead to unexpected
results
+
def test_main(capsys):
with pytest.raises(SystemExit) as pytest_wrapped_e:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/tests/test_utils.py
new/ansible-variables-0.5.1/tests/test_utils.py
--- old/ansible-variables-0.5.0/tests/test_utils.py 2023-05-18
17:08:46.000000000 +0200
+++ new/ansible-variables-0.5.1/tests/test_utils.py 2023-09-07
22:25:33.000000000 +0200
@@ -84,3 +84,13 @@
"group vars, precedence entry 'all_inventory'",
)
] == [(source.name, source.value, source.source) for source in sources]
+
+
+def test_undefined_variable():
+ sources = variable_sources(
+ variable_manager=variable_manager, host=inventory.get_host("server1"),
var="undefined_variable_blablabla_1234"
+ )
+ for variable in sources:
+ assert variable.name
+ assert not variable.value # should have None value
+ assert not variable.source_mapped # should have None source
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/ansible-variables-0.5.0/tox.ini
new/ansible-variables-0.5.1/tox.ini
--- old/ansible-variables-0.5.0/tox.ini 2023-05-18 17:08:46.000000000 +0200
+++ new/ansible-variables-0.5.1/tox.ini 2023-09-07 22:25:33.000000000 +0200
@@ -1,30 +1,24 @@
[tox]
env_list =
linters
- py39-ansible{211,212,213,214,215,devel}
- py310
- py311
+ py38-{2.11,2.12,2.13}
+ py39-{2.11,2.12,2.13,2.14,2.15}
+ py310-{2.12,2.13,2.14,2.15,devel}
+ py311-{2.14,2.15,devel}
minversion = 4.4.11
-[gh-actions]
-python =
- 3.8: py38
- 3.9: py39
- 3.10: py310
- 3.11: py311
-
[testenv]
description = run the tests with pytest
package = wheel
wheel_build_env = .pkg
deps =
pytest>=6
- ansible211: ansible-core==2.11.*
- ansible212: ansible-core==2.12.*
- ansible213: ansible-core==2.13.*
- ansible214: ansible-core==2.14.*
- ansible215: ansible-core==2.15.*
- ansibledevel: git+https://github.com/ansible/ansible
+ 2.11: ansible-core==2.11.*
+ 2.12: ansible-core==2.12.*
+ 2.13: ansible-core==2.13.*
+ 2.14: ansible-core==2.14.*
+ 2.15: ansible-core==2.15.*
+ devel: git+https://github.com/ansible/ansible
commands =
pytest {tty:--color=yes} -v {posargs}