Flexget / Flexget

The official FlexGet repository
http://www.flexget.com
MIT License
1.74k stars 473 forks source link

SFTP plugin crashes when trying to write to log file on version 3.0.20 #2538

Closed ksurl closed 4 years ago

ksurl commented 4 years ago

Expected behaviour:

download file via sftp. previously on v3.0.12 and upgraded to v3.0.20

Actual behaviour:

task fails due to paramiko error while trying to write to log

Steps to reproduce:

Config:

variables: variables.yml

templates:

  global:
    no_entries_ok: yes

  anchors:
    _sftp_list: &sftp_list
      host: '{? sftp.host ?}'
      port: 22
      username: '{? sftp.username ?}'
      private_key: '{? sftp.private_key ?}'
      private_key_pass: '{? sftp.private_key_pass ?}'

  sync-series:
    sftp_list:
      <<: *sftp_list
      dirs:
        - '{? remote.downloads ?}/series/'    
    accept_all: yes
    sftp_download:
      to: '{? local.downloads ?}/series/'

Log:

(click to expand) ``` 2019-12-21 07:19:35.480 CRITICAL plugin Exception while loading plugin flexget.components.ftp.sftp Traceback (most recent call last): File "/home/USERNAME/.venv/flexget/bin/flexget", line 8, in sys.exit(main()) │ │ └ │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/__init__.py", line 41, in main manager.start() │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/manager.py", line 389, in start self.initialize() │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/manager.py", line 232, in initialize extra_components=[os.path.join(self.config_base, 'components')], │ │ │ │ └ '/home/USERNAME/.config/flexget' │ │ │ └ │ │ └ │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 555, in load_plugins _load_components_from_dirs(extra_components) │ └ ['/home/USERNAME/.config/flexget/components', '/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components'] └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 496, in _load_components_from_dirs _import_plugin(package_name, component_path) │ │ └ PosixPath('/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components/ftp/sftp.py') │ └ 'flexget.components.ftp.sftp' └ > File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 425, in _import_plugin import_module(module_name) │ └ 'flexget.components.ftp.sftp' └ File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) │ │ │ │ │ └ 0 │ │ │ │ └ None │ │ │ └ 0 │ │ └ 'flexget.components.ftp.sftp' │ └ File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components/ftp/sftp.py", line 36, in logging.getLogger("paramiko").setLevel(logging.ERROR) NameError: name 'logging' is not defined 2019-12-21 07:19:37.304 CRITICAL plugin Exception while loading plugin flexget.components.ftp.sftp Traceback (most recent call last): File "/home/USERNAME/.venv/flexget/bin/flexget", line 8, in sys.exit(main()) │ │ └ │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/__init__.py", line 41, in main manager.start() │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/manager.py", line 389, in start self.initialize() │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/manager.py", line 232, in initialize extra_components=[os.path.join(self.config_base, 'components')], │ │ │ │ └ '/home/USERNAME/.config/flexget' │ │ │ └ │ │ └ │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 555, in load_plugins _load_components_from_dirs(extra_components) │ └ ['/home/USERNAME/.config/flexget/components', '/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components'] └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 496, in _load_components_from_dirs _import_plugin(package_name, component_path) │ │ └ PosixPath('/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components/ftp/sftp.py') │ └ 'flexget.components.ftp.sftp' └ > File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 425, in _import_plugin import_module(module_name) │ └ 'flexget.components.ftp.sftp' └ File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) │ │ │ │ │ └ 0 │ │ │ │ └ None │ │ │ └ 0 │ │ └ 'flexget.components.ftp.sftp' │ └ File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components/ftp/sftp.py", line 36, in logging.getLogger("paramiko").setLevel(logging.ERROR) NameError: name 'logging' is not defined 2019-12-21 07:19:39.278 CRITICAL plugin Exception while loading plugin flexget.components.ftp.sftp Traceback (most recent call last): File "/home/USERNAME/.venv/flexget/bin/flexget", line 8, in sys.exit(main()) │ │ └ │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/__init__.py", line 41, in main manager.start() │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/manager.py", line 389, in start self.initialize() │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/manager.py", line 232, in initialize extra_components=[os.path.join(self.config_base, 'components')], │ │ │ │ └ '/home/USERNAME/.config/flexget' │ │ │ └ │ │ └ │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 555, in load_plugins _load_components_from_dirs(extra_components) │ └ ['/home/USERNAME/.config/flexget/components', '/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components'] └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 496, in _load_components_from_dirs _import_plugin(package_name, component_path) │ │ └ PosixPath('/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components/ftp/sftp.py') │ └ 'flexget.components.ftp.sftp' └ > File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 425, in _import_plugin import_module(module_name) │ └ 'flexget.components.ftp.sftp' └ File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) │ │ │ │ │ └ 0 │ │ │ │ └ None │ │ │ └ 0 │ │ └ 'flexget.components.ftp.sftp' │ └ File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components/ftp/sftp.py", line 36, in logging.getLogger("paramiko").setLevel(logging.ERROR) NameError: name 'logging' is not defined 2019-12-21 07:19:41.309 CRITICAL plugin Exception while loading plugin flexget.components.ftp.sftp Traceback (most recent call last): File "/home/USERNAME/.venv/flexget/bin/flexget", line 8, in sys.exit(main()) │ │ └ │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/__init__.py", line 41, in main manager.start() │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/manager.py", line 389, in start self.initialize() │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/manager.py", line 232, in initialize extra_components=[os.path.join(self.config_base, 'components')], │ │ │ │ └ '/home/USERNAME/.config/flexget' │ │ │ └ │ │ └ │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 555, in load_plugins _load_components_from_dirs(extra_components) │ └ ['/home/USERNAME/.config/flexget/components', '/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components'] └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 496, in _load_components_from_dirs _import_plugin(package_name, component_path) │ │ └ PosixPath('/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components/ftp/sftp.py') │ └ 'flexget.components.ftp.sftp' └ > File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 425, in _import_plugin import_module(module_name) │ └ 'flexget.components.ftp.sftp' └ File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) │ │ │ │ │ └ 0 │ │ │ │ └ None │ │ │ └ 0 │ │ └ 'flexget.components.ftp.sftp' │ └ File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components/ftp/sftp.py", line 36, in logging.getLogger("paramiko").setLevel(logging.ERROR) NameError: name 'logging' is not defined 2019-12-21 07:19:43.283 CRITICAL plugin Exception while loading plugin flexget.components.ftp.sftp Traceback (most recent call last): File "/home/USERNAME/.venv/flexget/bin/flexget", line 8, in sys.exit(main()) │ │ └ │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/__init__.py", line 41, in main manager.start() │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/manager.py", line 389, in start self.initialize() │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/manager.py", line 232, in initialize extra_components=[os.path.join(self.config_base, 'components')], │ │ │ │ └ '/home/USERNAME/.config/flexget' │ │ │ └ │ │ └ │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 555, in load_plugins _load_components_from_dirs(extra_components) │ └ ['/home/USERNAME/.config/flexget/components', '/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components'] └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 496, in _load_components_from_dirs _import_plugin(package_name, component_path) │ │ └ PosixPath('/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components/ftp/sftp.py') │ └ 'flexget.components.ftp.sftp' └ > File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 425, in _import_plugin import_module(module_name) │ └ 'flexget.components.ftp.sftp' └ File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) │ │ │ │ │ └ 0 │ │ │ │ └ None │ │ │ └ 0 │ │ └ 'flexget.components.ftp.sftp' │ └ File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components/ftp/sftp.py", line 36, in logging.getLogger("paramiko").setLevel(logging.ERROR) NameError: name 'logging' is not defined 2019-12-21 07:20:29.159 CRITICAL plugin Exception while loading plugin flexget.components.ftp.sftp Traceback (most recent call last): File "/home/USERNAME/.venv/flexget/bin/flexget", line 8, in sys.exit(main()) │ │ └ │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/__init__.py", line 41, in main manager.start() │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/manager.py", line 389, in start self.initialize() │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/manager.py", line 232, in initialize extra_components=[os.path.join(self.config_base, 'components')], │ │ │ │ └ '/home/USERNAME/.config/flexget' │ │ │ └ │ │ └ │ └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 555, in load_plugins _load_components_from_dirs(extra_components) │ └ ['/home/USERNAME/.config/flexget/components', '/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components'] └ File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 496, in _load_components_from_dirs _import_plugin(package_name, component_path) │ │ └ PosixPath('/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components/ftp/sftp.py') │ └ 'flexget.components.ftp.sftp' └ > File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/plugin.py", line 425, in _import_plugin import_module(module_name) │ └ 'flexget.components.ftp.sftp' └ File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) │ │ │ │ │ └ 0 │ │ │ │ └ None │ │ │ └ 0 │ │ └ 'flexget.components.ftp.sftp' │ └ File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/home/USERNAME/.venv/flexget/lib/python3.6/site-packages/flexget/components/ftp/sftp.py", line 36, in logging.getLogger("paramiko").setLevel(logging.ERROR) NameError: name 'logging' is not defined ```

Additional information:

gazpachoking commented 4 years ago

Sorry about that, should be fixed in next version. Thanks for the report.

ksurl commented 4 years ago

was this due to the change to logaru in 3.0.19? I noticed the commit removed import logging and used logger instead

gazpachoking commented 4 years ago

Yeah, it was due to that change. I shouldn't have removed the logging import in this module, because it was being used to adjust the log level of the paramiko library as well as to do the regular flexget logging.