salt-sproxy icon indicating copy to clipboard operation
salt-sproxy copied to clipboard

Salt3005rc1 raises AttributeError: 'SaltStandaloneProxy' object has no attribute 'setup_logfile_logger'

Open network-shark opened this issue 2 years ago • 1 comments

Describe the bug When using the latest salt-sproxy with salt3005rc1 , we got the following error.

(salt3005rc1) sharky@debian-dev:~/salt3005rc1$ salt-sproxy -L 'r1' net.cli 'show version' -ldebug
[INFO    ] Loading Saltfile from '/home/sharky/salt3005rc1/Saltfile'
[DEBUG   ] Reading configuration from /home/sharky/salt3005rc1/Saltfile
[DEBUG   ] Reading configuration from /home/sharky/salt3005rc1/etc/salt/master
[DEBUG   ] Missing configuration file: /home/sharky/.saltrc
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Configuration file path: /home/sharky/salt3005rc1/etc/salt/master
[ERROR   ] An un-handled exception was caught by Salt's global exception handler:
AttributeError: 'SaltStandaloneProxy' object has no attribute 'setup_logfile_logger'
Traceback (most recent call last):
  File "/home/sharky/venv/salt3005rc1/bin/salt-sproxy", line 8, in <module>
    sys.exit(salt_sproxy())
  File "/home/sharky/venv/salt3005rc1/lib/python3.9/site-packages/salt_sproxy/scripts.py", line 102, in salt_sproxy
    client.run()
  File "/home/sharky/venv/salt3005rc1/lib/python3.9/site-packages/salt_sproxy/cli.py", line 68, in run
    self.setup_logfile_logger()
AttributeError: 'SaltStandaloneProxy' object has no attribute 'setup_logfile_logger'
Traceback (most recent call last):
  File "/home/sharky/venv/salt3005rc1/bin/salt-sproxy", line 8, in <module>
    sys.exit(salt_sproxy())
  File "/home/sharky/venv/salt3005rc1/lib/python3.9/site-packages/salt_sproxy/scripts.py", line 102, in salt_sproxy
    client.run()
  File "/home/sharky/venv/salt3005rc1/lib/python3.9/site-packages/salt_sproxy/cli.py", line 68, in run
    self.setup_logfile_logger()
AttributeError: 'SaltStandaloneProxy' object has no attribute 'setup_logfile_logger'

Steps To Reproduce Run salt-sproxy -L 'r1' net.cli 'show version'

Expected behavior Should work without raising an error

**Versions Report**
(salt3005rc1) sharky@debian-dev:~/salt3005rc1$ salt-sproxy -V
Salt Version:
           Salt: 3005rc1
    Salt SProxy: 2021.6.1

Dependency Versions:
        Ansible: Not Installed
           cffi: 1.15.1
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 3.1.2
     junos-eznc: 2.6.4
       jxmlease: Not Installed
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 1.0.4
         NAPALM: 4.0.0
       ncclient: 0.6.13
        Netmiko: 4.1.1
       paramiko: 2.11.0
      pycparser: 2.21
       pycrypto: Not Installed
   pycryptodome: 3.15.0
         pyeapi: 0.8.4
         pygit2: Not Installed
       PyNetBox: Not Installed
          PyNSO: Not Installed
         Python: 3.9.2 (default, Feb 28 2021, 17:03:44)
   python-gnupg: Not Installed
         PyYAML: 6.0
          PyZMQ: 23.2.0
            scp: 0.14.4
          smmap: Not Installed
        textfsm: 1.1.2
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.4

System Versions:
           dist: debian 11 bullseye
         locale: utf-8
        machine: x86_64
        release: 5.10.0-12-amd64
         system: Linux
        version: Debian GNU/Linux 11 bullseye

Salt3005 got a logging refactor and set_logfile_logger() is no longer needed from my understanding . The setup is now handled in

salt/utils/parsers.py

My PR would be

salt_sproxy/cli.py

33d32
< import salt.version as version
67,68c66
<         if version.__saltstack_version__.major < 3005:
<             self.setup_logfile_logger()
---
>         self.setup_logfile_logger()

Your thoughts on this @mirceaulinic ?

network-shark avatar Jul 28 '22 20:07 network-shark

Hi @network-shark - thanks for reporting this.

Let me dig into what's changed in Salt 3005, didn't know they were planning changes around logging.

mirceaulinic avatar Aug 04 '22 12:08 mirceaulinic