Committed `runcustomscript` runs do not deliver Event Rule actions

未关闭 适合新手
#152 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@pheus 已经在做这个了。

开始于 2026年11月11日。

  • #167 来自 @pheus —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

先定位 runcustomscript 构造 NetBoxFakeRequest 的位置,然后追踪 NetBox 如何为 Event Rule 操作复制该请求。检查命令的测试,并为触发 Event Rule 的已提交脚本添加覆盖。按照复现步骤中的描述,命令成功执行且匹配的操作进入队列,即为完成。

由索引模型根据 Issue 内容生成。

描述

app: scripts Bucket: KTLO severity: medium status: accepted type: bug
Plugin Version

v0.0.1

NetBox Version

v4.7.4

Python Version

3.12

Steps to Reproduce
  1. Create a Webhook and an enabled Event Rule that triggers it when a Tag is created.
  2. Upload and activate a Project containing deploy.py:
    from extras.models import Tag
    from netbox_scripts import Script
    
    
    class MakeTag(Script):
        def run(self, data, commit):
            Tag.objects.create(name='From Revision', slug='from-revision')
            self.log_success('The tag was created.')
    
  3. Run the Script from the command line:
    python netbox/manage.py runcustomscript deploy.MakeTag --commit
    
  4. Check the command output, Job status, and Webhook receiver.
Expected Behavior

The Tag is created, the command completes successfully, and the matching Webhook is queued for delivery, as it is when the Script runs through the UI or REST API.

Observed Behavior

The Tag is created, but the Webhook is not queued. The command exits with an error, and the Job is marked as failed:

[error] The Script did not finish: 'NetBoxFakeRequest' object has no attribute 'path_info'

An Event Rule configured to run a Script from this plugin is also affected. The triggered Script is not queued, and NetBox logs Error processing event rule with the same AttributeError.

The runcustomscript command constructs a NetBoxFakeRequest without path_info, which NetBox requires when copying the request for an Event Rule action.

This is related to #122, but separate: #122 concerns the Job's failure message, whereas this issue prevents the Event Rule action from being queued.

主要语言
Python
星标
8
派生
0
平均合并
12 小时 34 分钟
30 天内合并 PR
57

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

netbox-community/netbox-scripts 的其他 Issue

查看 netbox-community/netbox-scripts 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。