Multipart runs ignore the Script's default when commit is omitted

Đang mở Phù hợp với người mới
#74 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu tại điểm vào chạy script của REST API và theo dõi cách dữ liệu biểu mẫu multipart được chuyển đổi thành các tham số chạy của Script; so sánh với đường xử lý yêu cầu JSON. Tái hiện bằng script CommitProbe được cung cấp và một yêu cầu multipart bỏ qua commit. Hoàn thành khi lần chạy multipart sử dụng giá trị mặc định đang bật của Script và giữ lại tag đã tạo; kiểm tra nhật ký Job và danh sách Tags.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

app: scripts severity: low status: backlog type: bug
Plugin Version

v0.0.1

NetBox Version

v4.7.3

Python Version

3.12

Steps to Reproduce
  1. Upload and activate the following commit_probe.py. Leave the Script's commit override unset, and ensure no tag with the slug multipart-commit-probe exists.
    from extras.models import Tag
    from netbox_scripts.scripts import Script
    
    
    class CommitProbe(Script):
        def run(self, data, commit):
            Tag.objects.create(
                name='Multipart commit probe',
                slug='multipart-commit-probe',
            )
    
  2. Request a multipart run without commit, replacing 12 with the Script's ID:
    curl -sS -X POST \
      -H "Authorization: Token $NETBOX_TOKEN" \
      -F 'data={}' \
      https://netbox.example.com/api/plugins/netbox-scripts/scripts/12/run/
    
  3. Wait for the returned Job to finish, then check its log and the Tags list.
Expected Behavior

The run uses the Script's effective commit default, which is enabled, and keeps the new tag. The execution guide documents this behavior when commit is omitted.

Observed Behavior

The Job records commit as false and completes as a dry run. The tag is absent, and the log contains:

Database changes have been reverted, this was a dry run.

The equivalent JSON request follows the Script's default. Adding -F 'commit=true' to the multipart request also keeps the tag.

This is separate from #16, which covers the multipart request schema.

Ngôn ngữ chính
Python
Star
8
Fork
0
Merge trung bình
11 giờ 23 phút
Pull request đã merge (30 ngày)
24

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của netbox-community/netbox-scripts

Tất cả issue của netbox-community/netbox-scripts

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.