Skip to content

--inject with notify causes crash #1538

@martinberg

Description

@martinberg

Expected behaviour:

Send a notification.

Actual behaviour:

Crash

Steps to reproduce:

  • Step 1: Create config containing a task with notify
  • Step 2: Run command with "--inject" on said task

Config:

templates:
  auth:
    if:
      - "'3D' in title": reject
    deluge:
      username: *****
      password: ******
    notify:
      to:
        - email:
            from: ********
            to: *********
            title: Flexget
            smtp_host: smtp.*******.org
            smtp_port: 587
            smtp_username: ************
            smtp_password: *******
            smtp_tls: yes
            file_template: default
        - slack:
            web_hook_url:  **************

tasks:

  shdbook:
    rss: *****
    no_entries_ok: yes
    accept_all: yes
    template: auth

Terminal Output:

2016-12-05 14:33 INFO     manager                       Test mode, creating a copy from database ...
2016-12-05 14:33 INFO     manager                       Test database created
2016-12-05 14:33 VERBOSE  task_queue                    There are 1 tasks to execute. Shutdown will commence when they have completed.
2016-12-05 14:33 INFO     task          shdbook         Plugin rss is not executed because input phase is disabled (e.g. --test)
2016-12-05 14:33 VERBOSE  task          shdbook         ACCEPTED: `Svartsjon.S01E04.1080p` by accept_all plugin
2016-12-05 14:33 INFO     download      shdbook         Would download: Svartsjon.S01E04.1080p
2016-12-05 14:33 VERBOSE  details       shdbook         Summary - Accepted: 1 (Rejected: 0 Undecided: 0 Failed: 0)
2016-12-05 14:33 INFO     deluge        shdbook         Connecting to daemon at localhost:58846..
2016-12-05 14:33 INFO     deluge        shdbook         Connected to daemon at 127.0.0.1:58846..
2016-12-05 14:33 INFO     deluge        shdbook         Connection lost to daemon at localhost:58846 reason: Connection was closed cleanly.
2016-12-05 14:33 CRITICAL task          shdbook         BUG: Unhandled error in plugin notify: 'NoneType' object has no attribute 'name'
2016-12-05 14:33 CRITICAL manager       shdbook         An unexpected crash has occurred. Writing crash report to /home/*****/.flexget/crash_report.2016.12.05.143311451303.log. Please verify you are running the latest version of flexget by using "flexget -V" from CLI or by using version_checker plugin at http://flexget.com/wiki/Plugins/version_checker. You are currently using version 2.7.2
2016-12-05 14:33 WARNING  task          shdbook         Aborting task (plugin: notify)
2016-12-05 14:33 WARNING  backlog       shdbook         No input snapshot available for `Svartsjon.S01E04.1080p`, using current state
2016-12-05 14:33 INFO     manager                       Removed test database

Crashlog:

2016-12-05 14:06 DEBUG    manager                       Figuring out config load paths
2016-12-05 14:06 DEBUG    manager                       Found config: /home/*****/.flexget/config.yml
2016-12-05 14:06 DEBUG    manager                       Config file /home/*******/.flexget/config.yml selected
2016-12-05 14:06 INFO     manager                       Test mode, creating a copy from database ...
2016-12-05 14:06 INFO     manager                       Test database created
2016-12-05 14:06 VERBOSE  task_queue                    There are 1 tasks to execute. Shutdown will commence when they have completed.
2016-12-05 14:06 INFO     task          shdbook         Plugin rss is not executed because input phase is disabled (e.g. --test)
2016-12-05 14:06 VERBOSE  task          shdbook         ACCEPTED: `Svartsjon.S01E04.1080p` by accept_all plugin
2016-12-05 14:06 INFO     download      shdbook         Would download: Svartsjon.S01E04.1080p
2016-12-05 14:06 VERBOSE  details       shdbook         Summary - Accepted: 1 (Rejected: 0 Undecided: 0 Failed: 0)
2016-12-05 14:06 INFO     deluge        shdbook         Connecting to daemon at localhost:58846..
2016-12-05 14:06 INFO     deluge        shdbook         Connected to daemon at 127.0.0.1:58846..
2016-12-05 14:06 INFO     deluge        shdbook         Connection lost to daemon at localhost:58846 reason: Connection was closed cleanly.
2016-12-05 14:06 CRITICAL task          shdbook         BUG: Unhandled error in plugin notify: 'NoneType' object has no attribute 'name'
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flexget/task.py", line 483, in __run_plugin
    return method(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flexget/event.py", line 23, in __call__
    return self.func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/flexget/plugins/notifiers/notify.py", line 126, in send_notification
    DEFAULT_DICTS[scope])
  File "/usr/local/lib/python2.7/dist-packages/flexget/plugins/notifiers/notify.py", line 93, in render_value
    result = entity.render(data)
  File "/usr/local/lib/python2.7/dist-packages/flexget/entry.py", line 294, in render
    return render_from_entry(template, self)
  File "/usr/local/lib/python2.7/dist-packages/flexget/utils/template.py", line 212, in render_from_entry
    variables['task_name'] = variables.get('task', entry.task.name)
AttributeError: 'NoneType' object has no attribute 'name'

Additional information:

  • Flexget Version: 2.7.2
  • Python Version: 2.7.12
  • Installation method: pip
  • OS and version: Ubuntu 16.04.1
  • Link to crash log: Included in issue
  • Link to debug log: http://pastebin.com/NdWUbgUv

Commands used:

The non-debug logs were produced with

flexget --test execute --tasks shdbook --inject "Svartsjon.S01E04.1080p"

and for the debug I used

flexget -L debug --test execute --tasks shdbook --inject "Svartsjon.S01E04.1080p"

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions