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

file.recurse logger no attibute trace! #62279

Open
dtzampanakis opened this issue Jul 6, 2022 · 11 comments
Open

file.recurse logger no attibute trace! #62279

dtzampanakis opened this issue Jul 6, 2022 · 11 comments
Labels
Bug broken, incorrect, or confusing behavior needs-triage Regression The issue is a bug that breaks functionality known to work in previous releases. Salt-SSH

Comments

@dtzampanakis
Copy link

Description of Issue

Tried with salt-ssh.
When i use file.recurse in a state file with no other sls include it works fine.
When i use it in a state that include another sls, file recurse break with
AttributeError: 'VerboseLogger' object has no attribute 'trace'

Steps to Reproduce Issue

include:
  - hashicorp/docker
  
grafana_dashboards:
  file.recurse:
    - name: /tmp/test11
    - source: salt://hashicorp/files/grafana/
    - include_empty: True
    - user: nomad
    - group: nomad
    - makedirs: true

If i remove the include part, it works fine.

full error message:

      ID: grafana_dashboards
Function: file.recurse
    Name: /tmp/test11
  Result: False
 Comment: An exception occurred in this state: Traceback (most recent call last):
            File "/tmp/salt-thin/pyall/salt/state.py", line 2154, in call
              *cdata["args"], **cdata["kwargs"]
            File "/tmp/salt-thin/pyall/salt/loader.py", line 2106, in wrapper
              return f(*args, **kwargs)
            File "/tmp/salt-thin/pyall/salt/states/file.py", line 4274, in recurse
              source, source_hash = __salt__["file.source_list"](source_list, "", __env__)
            File "/tmp/salt-thin/pyall/salt/modules/file.py", line 4293, in source_list
              mfiles = [(f, saltenv) for f in __salt__["cp.list_master"](saltenv)]
            File "/tmp/salt-thin/pyall/salt/modules/cp.py", line 671, in list_master
              return _client().file_list(saltenv, prefix)
            File "/tmp/salt-thin/pyall/salt/fileclient.py", line 1315, in file_list
              else self.channel.send(load)
            File "/tmp/salt-thin/pyall/salt/fileserver/__init__.py", line 892, in send
              return getattr(self.fs, cmd)(load)
            File "/tmp/salt-thin/pyall/salt/utils/decorators/__init__.py", line 791, in wrapped
              return function(*args, **kwargs)
            File "/tmp/salt-thin/pyall/salt/fileserver/__init__.py", line 775, in file_list
              ret.update(self.servers[fstr](load))
            File "/tmp/salt-thin/pyall/salt/fileserver/roots.py", line 439, in file_list
              return _file_lists(load, "files")
            File "/tmp/salt-thin/pyall/salt/fileserver/roots.py", line 416, in _file_lists
              _add_to(ret["dirs"], path, root, dirs)
            File "/tmp/salt-thin/pyall/salt/fileserver/roots.py", line 358, in _add_to
              log.trace("roots: Processing %s", abs_path)
          AttributeError: 'VerboseLogger' object has no attribute 'trace'
 Started: 08:18:05.632571
Duration: 3035.214 ms
 Changes:   

Versions Report

Salt Version:
Salt: 3002.2

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.11.2
libgit2: Not Installed
M2Crypto: Not Installed
Mako: 1.1.3
msgpack: 1.0.0
msgpack-pure: Not Installed
mysql-python: 1.4.4
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.9.7
pygit2: Not Installed
Python: 3.9.5 (default, Nov 18 2021, 16:00:48)
python-gnupg: 0.4.6
PyYAML: 5.3.1
PyZMQ: 20.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4

System Versions:
dist: ubuntu 21.04 hirsute
locale: utf-8
machine: x86_64
release: 5.11.0-49-generic
system: Linux
version: Ubuntu 21.04 hirsute

@welcome
Copy link

welcome bot commented Jul 6, 2022

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

@OrangeDog
Copy link
Contributor

OrangeDog commented Jul 6, 2022

3002.2 has significant security vulnerabilities and should not be used. 3002.9 is the only supported release of that version, and not for much longer.

Are you using salt-bin, as in #60661?
What version of Python is installed on the target machine?

@OrangeDog OrangeDog added Bug broken, incorrect, or confusing behavior Salt-SSH info-needed waiting for more info needs-triage Regression The issue is a bug that breaks functionality known to work in previous releases. labels Jul 6, 2022
@dtzampanakis
Copy link
Author

Python 3.6.8
i remember with version 3002.9 of salt-ssh i had other problems so i downgraded there.

@OrangeDog
Copy link
Contributor

The issue may already be fixed in 3004.2. You will also need the contextvars backport installed on the master.

@dtzampanakis
Copy link
Author

dtzampanakis commented Jul 6, 2022

Tried the 3004.2 salt-ssh. When i try to make a test.ping i get

retcode:
    1
stderr:
    Traceback (most recent call last):
      File "/tmp/salt-thin/pyall/salt/loader/context.py", line 10, in <module>
        import _contextvars as contextvars
    ModuleNotFoundError: No module named '_contextvars'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/salt-thin/salt-call", line 27, in <module>
        salt_call()
      File "/tmp/salt-thin/pyall/salt/scripts.py", line 426, in salt_call
        import salt.cli.call
      File "/tmp/salt-thin/pyall/salt/cli/call.py", line 3, in <module>
        import salt.cli.caller
      File "/tmp/salt-thin/pyall/salt/cli/caller.py", line 14, in <module>
        import salt.loader
      File "/tmp/salt-thin/pyall/salt/loader/__init__.py", line 14, in <module>
        import salt.config
      File "/tmp/salt-thin/pyall/salt/config/__init__.py", line 101, in <module>
        _DFLT_IPC_WBUFFER = _gather_buffer_space() * 0.5
      File "/tmp/salt-thin/pyall/salt/config/__init__.py", line 89, in _gather_buffer_space
        import salt.grains.core
      File "/tmp/salt-thin/pyall/salt/grains/core.py", line 32, in <module>
        import salt.modules.cmdmod
      File "/tmp/salt-thin/pyall/salt/modules/cmdmod.py", line 31, in <module>
        import salt.utils.templates
      File "/tmp/salt-thin/pyall/salt/utils/templates.py", line 20, in <module>
        import salt.utils.jinja
      File "/tmp/salt-thin/pyall/salt/utils/jinja.py", line 21, in <module>
        import salt.fileclient
      File "/tmp/salt-thin/pyall/salt/fileclient.py", line 15, in <module>
        import salt.client
      File "/tmp/salt-thin/pyall/salt/client/__init__.py", line 33, in <module>
        import salt.payload
      File "/tmp/salt-thin/pyall/salt/payload.py", line 15, in <module>
        import salt.loader.context
      File "/tmp/salt-thin/pyall/salt/loader/context.py", line 13, in <module>
        import contextvars
      File "/tmp/salt-thin/py3/contextvars.py", line 1, in <module>
        from _contextvars import Context, ContextVar, Token, copy_context
    ModuleNotFoundError: No module named '_contextvars'

when master have

$ pip3 list |grep context
contextvars            2.4

Probably that was the reason that i downgraded back to 3002.2.

@OrangeDog
Copy link
Contributor

You will also need the contextvars backport installed on the master.

@dtzampanakis
Copy link
Author

contextvars is installed on the master with pip.

$ pip3 list |grep context
contextvars 2.4

Need to add it somewhere else? or is the problem described here ?
#59942

master python3 = 3.9.5
target python3 = 3.6.8

@OrangeDog
Copy link
Contributor

That is that problem, yes, but I thought it had been solved.

@dtzampanakis
Copy link
Author

So i need to find a previous version of salt, to satisfy the file.recurse and avoid the contextvars too ?

@OrangeDog
Copy link
Contributor

Not sure, but you should certainly not be using anything older than 3002.9.
You could try one of the workarounds / patches given for the contextvars issue in 3004.2.

@dtzampanakis
Copy link
Author

ModuleNotFoundError: No module named '_contextvars' error left when i updated python to 3.9.10 to target minion.
The bad thing is that i have problems with gpg rendering now there so i have to go back to 3002.9 and live with the problem of file.recurse..

@OrangeDog OrangeDog removed the info-needed waiting for more info label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior needs-triage Regression The issue is a bug that breaks functionality known to work in previous releases. Salt-SSH
Projects
None yet
Development

No branches or pull requests

2 participants