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

Be explicit about importing from salt.utils.jinja to avoid circular imports #30043

Merged
merged 1 commit into from Dec 28, 2015

Conversation

Projects
None yet
2 participants
@rallytime
Contributor

rallytime commented Dec 28, 2015

Fixes #29960

Without this change, a circular import happens between the salt.utils.templates.py and salt.fileclient.py files. Here's an example of the previous behavior:

$ python -c 'import salt.utils.jinja'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "salt/utils/jinja.py", line 27, in <module>
    import salt.fileclient
  File "salt/fileclient.py", line 27, in <module>
    import salt.utils.templates
  File "salt/utils/templates.py", line 28, in <module>
    from salt.utils.jinja import ensure_sequence_filter, show_full_context
ImportError: cannot import name ensure_sequence_filter

And with this fix:

$ python -c 'import salt.utils.jinja'
$

@cachedout I believe this is the correct fix for this bug, but since this is in the templates utils file, I'd love any feedback.

@cachedout

This comment has been minimized.

Show comment
Hide comment
@cachedout

cachedout Dec 28, 2015

Contributor

LGTM.

Contributor

cachedout commented Dec 28, 2015

LGTM.

@rallytime

This comment has been minimized.

Show comment
Hide comment
@rallytime

rallytime Dec 28, 2015

Contributor

Go Go Jenkins!

Contributor

rallytime commented Dec 28, 2015

Go Go Jenkins!

cachedout added a commit that referenced this pull request Dec 28, 2015

Merge pull request #30043 from rallytime/fix-29960
Be explicit about importing from salt.utils.jinja to avoid circular imports

@cachedout cachedout merged commit 3c63527 into saltstack:2015.8 Dec 28, 2015

3 of 5 checks passed

default Merged build finished.
Details
jenkins/salt-pr-linode-ubuntu14.04-n Salt PR - Linode Ubuntu 14.04 #3520 — FAILURE
Details
jenkins/salt-pr-clone Salt PR - Clone Repository #12397 — SUCCESS
Details
jenkins/salt-pr-lint-n Salt PR - Code Lint #12096 — SUCCESS
Details
jenkins/salt-pr-rs-cent7-n Salt PR - RS CentOS 7 #10978 — SUCCESS
Details

@rallytime rallytime deleted the rallytime:fix-29960 branch Dec 28, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment