Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
872fd14
[ci] Fixed ci YAML inconsistencies (for coveralls, etc.)
nemesifier Jun 4, 2026
d04280e
[feature] Added BatchCommand model for mass command execution #1344
dee077 Jun 9, 2026
901be90
[feature] Proof of concept need some code refinement
dee077 Jun 12, 2026
7b8b7a4
[feature] Refactored BatchCommand model, API, and task for mass comma…
dee077 Jun 14, 2026
5c8547a
[feature] Added model-level validation, failed Command records, and i…
dee077 Jun 15, 2026
cf971df
[feature] Finalized BatchCommand migration and QA fixes
dee077 Jun 15, 2026
d65dc5e
[fix] Made GET dry-run work without type param, default execute_all t…
dee077 Jun 16, 2026
2c5602f
[fix] Add docstrings and minor fixes
dee077 Jun 19, 2026
908dea1
[fix] Restructure BatchCommand fields and refine test fixtures
dee077 Jun 20, 2026
d00094e
[feature] Added skipped_devices model field and comprehensive batch c…
dee077 Jun 23, 2026
02e28de
[fix] Migration fix and add skipped devices in BatchCommandSerializer
dee077 Jun 23, 2026
030a6f9
[tests] Add more tests
dee077 Jun 25, 2026
22dd0fd
[fix] Address coderabbit comments and fix flaky tests and ci
dee077 Jun 25, 2026
4475e7f
[fix] Address comments
dee077 Jun 26, 2026
98043a0
[fix] Additional tests
dee077 Jun 28, 2026
9fe526b
[feature] Add label and notes field in model
dee077 Jul 1, 2026
7c80797
[docs] Add docs for batch command endpoints
dee077 Jul 3, 2026
894c9f3
[feature] Add Django admin workflow for mass command execution and re…
dee077 Jun 30, 2026
432952e
[feature] Add affected_devices, colored changelist status, and label …
dee077 Jul 2, 2026
b4dbb98
[fix] Restructure
dee077 Jul 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:
push:
branches:
- master
- "gsoc26-*"
pull_request:
branches:
- master
- "1.1"
- "1.2"
- "gsoc26-x509-certificate-generator-templates"
- "gsoc26-mass-commands"
- "gsoc26-*"

jobs:
build:
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
with:
parallel: true
format: cobertura
flag-name: python-${{ matrix.env.env }}
flag-name: python-${{ matrix.python-version }}-${{ matrix.django-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
fail-on-error: false

Expand Down
107 changes: 107 additions & 0 deletions docs/user/rest-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,113 @@ Get Command Details

GET /api/v1/controller/device/{device_id}/command/{command_id}/

.. _controller_batch_command_api:

Dry-Run Batch Command
~~~~~~~~~~~~~~~~~~~~~

.. code-block:: text

GET /api/v1/controller/batch-command/execute/

Returns the list of devices that would be targeted without executing
anything. Useful for previewing which devices are affected.

**Query Parameters:**

================ =================================================
Parameter Description
================ =================================================
``organization`` Organization UUID (optional)
``type`` Command type (optional for dry-run)
``input`` Input data for the command (optional for dry-run)
``devices`` Comma-separated device UUIDs (optional)
``group`` Device group UUID (optional)
``location`` Location UUID (optional)
``execute_all`` Set to ``true`` to target all devices (optional)
================ =================================================

Execute a Batch Command
~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: text

POST /api/v1/controller/batch-command/execute/

Creates and executes a batch command on the targeted devices.

**Request Parameters:**

================ ================================================
Parameter Description
================ ================================================
``organization`` Organization UUID (optional for superusers)
``type`` Type of command to execute (**required**)
``input`` Input data for the command (**required**)
``label`` A short label to identify this batch command
(**required**)
``notes`` Optional notes (optional)
``devices`` List of device UUIDs (optional)
``group`` Device group UUID (optional)
``location`` Location UUID (optional)
``execute_all`` Set to ``true`` to target all devices (optional)
================ ================================================

**Available Command Types:**

See :ref:`controller_execute_command_api` for available command types and
input formats.

**Example payload:**

.. code-block:: json

{
"organization": "org-uuid",
"type": "custom",
"input": {"command": "uptime"},
"label": "Check uptime",
"execute_all": true
}

**Example request:**

.. code-block:: shell

curl -X POST \
http://127.0.0.1:8000/api/v1/controller/batch-command/execute/ \
-H 'authorization: Bearer yoursecretauthtoken' \
-H 'content-type: application/json' \
-d '{
"organization": "org-uuid",
"type": "custom",
"input": {"command": "uptime"},
"label": "Check uptime",
"execute_all": true
}'

**Response:** ``201 Created`` with the batch command UUID.

List Batch Commands
~~~~~~~~~~~~~~~~~~~

.. code-block:: text

GET /api/v1/controller/batch-command/

Returns a paginated list of batch commands with device count and skipped
device information.

Get Batch Command Detail
~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: text

GET /api/v1/controller/batch-command/{id}/

Returns detailed information about a batch command, including the list of
targeted devices.

List Device Groups
~~~~~~~~~~~~~~~~~~

Expand Down
Loading