Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rework some of ansible's inner templating #72419

Draft
wants to merge 13 commits into
base: devel
Choose a base branch
from

Conversation

bcoca
Copy link
Member

@bcoca bcoca commented Oct 30, 2020

  • vars is now a template object that is autosolvable
    also 'fixes' vars['varname'] not being templated.
  • avoid full vars dict copy now for every get_vars call.
  • moved to use common object for hostvarsvars as for vars.

related #72829

ISSUE TYPE
  • Bugfix Pull Request
  • Feature Pull Request
COMPONENT NAME

vars

@ansibot ansibot added affects_2.11 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 30, 2020
@ansibot

This comment has been minimized.

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. core_review In order to be merged, this PR must follow the core review workflow. and removed core_review In order to be merged, this PR must follow the core review workflow. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Oct 30, 2020
@ansibot

This comment has been minimized.

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. core_review In order to be merged, this PR must follow the core review workflow. test This PR relates to tests. and removed core_review In order to be merged, this PR must follow the core review workflow. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Oct 30, 2020
@ansibot

This comment has been minimized.

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Oct 30, 2020
@samdoran samdoran added the ci_verified Changes made in this PR are causing tests to fail. label Oct 31, 2020
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. support:community This issue/PR relates to code supported by the Ansible community. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. core_review In order to be merged, this PR must follow the core review workflow. labels Nov 2, 2020
@bcoca bcoca force-pushed the template_uninsanity branch from cff8d23 to 6f2f190 Compare Nov 3, 2020
@ansibot ansibot removed the core_review In order to be merged, this PR must follow the core review workflow. label Nov 3, 2020
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Nov 19, 2020
@ansibot ansibot added pre_azp This PR was last tested before migration to Azure Pipelines. and removed ci_verified Changes made in this PR are causing tests to fail. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Dec 5, 2020
@ansibot ansibot added the WIP This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers. label Feb 18, 2021
bcoca added 13 commits Oct 15, 2021
  - vars is now a template object that is autosolvable
    also 'fixes' vars['varname'] not being templated.
  - avoid full vars dict copy now for every get_vars call.
  - moved to use common object for hostvarsvars as for vars.
 also added comment to autovars init
@ansibot
Copy link
Contributor

ansibot commented Oct 15, 2021

The test ansible-test sanity --test package-data [explain] failed with the error:

Command "/root/.ansible/test/venv/sanity.package-data/3.10/431ccf3c/bin/python /root/ansible/test/sanity/code-smell/package-data.py" returned exit status 1.
>>> Standard Error
Traceback (most recent call last):
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 383, in <module>
    main()
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 360, in main
    sdist_path = create_sdist(tmp_dir)
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 174, in create_sdist
    raise Exception('make snapshot failed:\n%s' % stderr)
Exception: make snapshot failed:
Traceback (most recent call last):
  File "/tmp/tmpu7mad4ph/hacking/build-ansible.py", line 103, in <module>
    main()
  File "/tmp/tmpu7mad4ph/hacking/build-ansible.py", line 92, in main
    retval = command.main(args)
  File "/tmp/tmpu7mad4ph/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 279, in main
    allvars[cli_name] = opts_docs(cli_class_name, cli_name)
  File "/tmp/tmpu7mad4ph/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 119, in opts_docs
    cli_klass = getattr(__import__("ansible.cli.%s" % cli_module_name,
  File "/tmp/tmpu7mad4ph/lib/ansible/cli/config.py", line 25, in <module>
    from ansible.parsing.yaml.dumper import AnsibleDumper
  File "/tmp/tmpu7mad4ph/lib/ansible/parsing/yaml/dumper.py", line 30, in <module>
    from ansible.vars.hostvars import HostVars, HostVarsVars
ImportError: cannot import name 'HostVarsVars' from 'ansible.vars.hostvars' (/tmp/tmpu7mad4ph/lib/ansible/vars/hostvars.py)
make: *** [Makefile:190: generate_rst] Error 1

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/root/.ansible/test/venv/sanity.docs-build/3.10/966adace/bin/python /root/ansible/test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make core_singlehtmldocs' failed with status code: 2
--> Standard Output
Creating symlinks in core_structure
ln -sf ../rst/core_index.rst rst/index.rst
ln -sf ../sphinx_conf/core_conf.py rst/conf.py
../../hacking/build-ansible.py collection-meta --template-file=../templates/collections_galaxy_meta.rst.j2 --output-dir=rst/dev_guide/  ../../lib/ansible/galaxy/data/collections_galaxy_meta.yml
../../hacking/build-ansible.py document-config --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/  ../../lib/ansible/config/base.yml
mkdir -p rst/cli
../../hacking/build-ansible.py generate-man --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst  ../../lib/ansible/cli/*.py
--> Standard Error
Traceback (most recent call last):
  File "/root/ansible/docs/docsite/../../hacking/build-ansible.py", line 103, in <module>
    main()
  File "/root/ansible/docs/docsite/../../hacking/build-ansible.py", line 92, in main
    retval = command.main(args)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 279, in main
    allvars[cli_name] = opts_docs(cli_class_name, cli_name)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 119, in opts_docs
    cli_klass = getattr(__import__("ansible.cli.%s" % cli_module_name,
  File "/root/ansible/lib/ansible/cli/config.py", line 25, in <module>
    from ansible.parsing.yaml.dumper import AnsibleDumper
  File "/root/ansible/lib/ansible/parsing/yaml/dumper.py", line 30, in <module>
    from ansible.vars.hostvars import HostVars, HostVarsVars
ImportError: cannot import name 'HostVarsVars' from 'ansible.vars.hostvars' (/root/ansible/lib/ansible/vars/hostvars.py)
make: *** [Makefile:192: cli] Error 1

The test ansible-test sanity --test ansible-doc [explain] failed with the error:

Command "ansible-doc -t become runas su sudo" returned exit status 250.
>>> Standard Error
ERROR! Unexpected Exception, this is probably a bug: cannot import name 'HostVarsVars' from 'ansible.vars.hostvars' (/root/ansible/lib/ansible/vars/hostvars.py)

The test ansible-test sanity --test import --python 3.9 [explain] failed with 1 error:

lib/ansible/plugins/filter/core.py:34:0: traceback: ImportError: cannot import name 'HostVarsVars' from 'ansible.vars.hostvars' (/root/ansible/lib/ansible/vars/hostvars.py) (at lib/ansible/parsing/yaml/dumper.py:30:0)

The test ansible-test sanity --test import --python 3.8 [explain] failed with 1 error:

lib/ansible/plugins/filter/core.py:34:0: traceback: ImportError: cannot import name 'HostVarsVars' from 'ansible.vars.hostvars' (/root/ansible/lib/ansible/vars/hostvars.py) (at lib/ansible/parsing/yaml/dumper.py:30:0)

The test ansible-test sanity --test import --python 3.10 [explain] failed with 1 error:

lib/ansible/plugins/filter/core.py:34:0: traceback: ImportError: cannot import name 'HostVarsVars' from 'ansible.vars.hostvars' (/root/ansible/lib/ansible/vars/hostvars.py) (at lib/ansible/parsing/yaml/dumper.py:30:0)

The test ansible-test sanity --test pylint [explain] failed with 1 error:

test/sanity/ignore.txt:131:1: ansible-test: Ignoring 'disallowed-name' on 'lib/ansible/vars/hostvars.py' is unnecessary

click here for bot help

@ansibot ansibot removed the pre_azp This PR was last tested before migration to Azure Pipelines. label Oct 15, 2021
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Oct 23, 2021
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.11 bug This issue/PR relates to a bug. has_issue needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests. WIP This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants