feat: add whole-group export/import for worker groups and edge fleets#1
Draft
JacobPEvans-personal wants to merge 5 commits into
Draft
feat: add whole-group export/import for worker groups and edge fleets#1JacobPEvans-personal wants to merge 5 commits into
JacobPEvans-personal wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new groups CLI command for exporting/importing an entire worker group or edge fleet configuration, backed by a new group_transfer utility module and unit tests.
Changes:
- Introduces
cribl_cli.utils.group_transferto collect per-group resources into an export payload and apply an import payload with safety flags (routes/packs/lookups/sensitive). - Adds a new
cribl groups export|importClick command and registers it in the main CLI. - Adds unit tests and updates
CLAUDE.mddocumentation for the new feature.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
cribl_cli/utils/group_transfer.py |
Implements whole-group collect/export, import/apply, and directory-based payload IO. |
cribl_cli/commands/groups.py |
Adds groups export and groups import CLI commands with deploy confirmation safeguards. |
cribl_cli/cli.py |
Registers the new groups command group in the root CLI. |
tests/unit/test_group_transfer.py |
Adds unit tests for resource planning, export aggregation, IO roundtrip, and import safety. |
CLAUDE.md |
Documents the new command and its safety rules/conventions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+291
to
+303
| cfg = RESOURCE_CONFIGS.get(name) | ||
| if cfg is None: | ||
| report["skipped"][name] = "unknown resource type" | ||
| continue | ||
|
|
||
| for item in _items(value): | ||
| ref = f"{name}/{item.get('id', '?')}" | ||
| try: | ||
| outcome = _upsert_item(client, target_id, cfg, item) | ||
| report[outcome].append(ref) | ||
| except Exception as exc: # noqa: BLE001 | ||
| report["failed"][ref] = str(exc) | ||
|
|
Changes: - Add fail-fast for target groups during import - Skip STREAM_ONLY resources on Edge fleets - Simplify logic in plan_resources and apply - Catch specific httpx.HTTPError for resource operations
The "Using profiles" block showed 'cribl config set cloud' (positional) and 'cribl config list', but the config group only defines set (which takes -p/--profile), show, and use — no list. Corrected to 'config set -p cloud' and 'config show'. Also wrapped two over-long lines and added a code-fence language for markdownlint; the collapsible commands section is intentional HTML and left as-is. Assisted-by: Claude:claude-opus-4-8[1m]
write_dir() chmods the export directory to 0700 and each file to 0600, so --include-sensitive exports are not left world-readable (mirrors the ~/.criblrc 0600 protection). read_input() raises on an ambiguous directory (no _meta.json plus multiple group subdirectories) instead of silently returning an empty payload that would make import a no-op. Addresses Copilot review feedback on PR #1. Assisted-by: Claude:claude-opus-4-8[1m]
Eight group-scoped resources used endpoint paths that return HTTP 404 on Cribl 4.17.1 (verified live against a real Leader). This broke both the factory CRUD commands (cribl <resource> list/get/...) and groups export/import for these types. parsers system/parsers->lib/parsers; schemas schemas->lib/schemas; db-connections lib/db-connections->lib/database-connections; conditions lib/conditions->conditions; sds-rules lib/sds/rules->lib/sds-rules; sds-rulesets lib/sds/rulesets->lib/sds-rulesets; appscope lib/appscope->lib/appscope-configs; hmac-functions lib/hmac->lib/hmac-functions. Updated the one mock test that hard-coded the old parsers path. The 4 resources still 404ing (protobuf-libs, scripts, functions, alert-monitors) are left unchanged pending confirmation of their correct paths. Assisted-by: Claude:claude-opus-4-8[1m]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for whole-group export/import functionality for worker groups and edge fleets in the Cribl CLI, along with unit tests and helper utilities.