Skip to content

feat(sync): add Katello content-view client and ContentViewSyncer#34

Merged
mdheller merged 1 commit into
mainfrom
feat/katello-content-client
Jun 16, 2026
Merged

feat(sync): add Katello content-view client and ContentViewSyncer#34
mdheller merged 1 commit into
mainfrom
feat/katello-content-client

Conversation

@mdheller

Copy link
Copy Markdown
Contributor

Summary

  • katello_client.py: stdlib-only HTTP client for Katello API; queries org/content-view/lifecycle-env/version endpoints; derives Pulp content URL and nix cache URL from the Foreman base URL
  • content_sync.py: ContentViewSyncer produces a non-mutating ContentSyncPlan; locus gate (local/trusted_private only); execute() defaults to dry-run; skips missing nix/nixos-rebuild binaries gracefully
  • cli.py: adds sync plan and sync apply subcommands; --execute flag required to leave dry-run mode

Usage (Phase 0)

# Preview what would be synced from local Katello
KATELLO_PASSWORD=<pw> sourceos-syncd sync plan \
  --katello-url https://127.0.0.1:8443 \
  --no-verify-ssl

# Apply (dry-run by default)
KATELLO_PASSWORD=<pw> sourceos-syncd sync apply \
  --katello-url https://127.0.0.1:8443 \
  --no-verify-ssl

# Actually execute nix copy + nixos-rebuild
KATELLO_PASSWORD=<pw> sourceos-syncd sync apply \
  --katello-url https://127.0.0.1:8443 \
  --no-verify-ssl \
  --execute

Test plan

  • 13 new tests pass (pytest tests/test_katello_client.py)
  • Full suite passes (pytest)
  • sourceos-syncd sync plan --help shows all flags
  • Against live Foreman+Katello: sync plan returns a ContentSyncPlan with correct nix_cache_url

katello_client.py: stdlib-only HTTP client (urllib.request) for Katello API;
queries org, content view, lifecycle env, and version endpoints; returns a
ContentViewManifest with the Pulp content URL and nix cache URL derived from
the Foreman HTTPS port

content_sync.py: ContentViewSyncer produces a non-mutating ContentSyncPlan
(policy_gate: allowed/denied/no-op); execute() is the only side-effecting
method and defaults to dry_run=True; enforces locus gate (local/trusted_private
only); skips nix/nixos-rebuild if not in PATH

cli.py: adds `sync plan` and `sync apply` subcommands under the `sync` area;
--katello-url, --org, --content-view, --lifecycle-env, --locus, --flake-ref,
--current-version, --no-verify-ssl, --execute flags

13 tests, all passing
@mdheller mdheller merged commit 63a6cbb into main Jun 16, 2026
4 checks passed
@mdheller mdheller deleted the feat/katello-content-client branch June 16, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant