Skip to content

feat: implement com.redhat.rhsm.content Varlink interface - #562

Merged
cnsnyder merged 1 commit into
mainfrom
jajerome/cct-1716-content-varlink-interface
Aug 27, 2026
Merged

feat: implement com.redhat.rhsm.content Varlink interface#562
cnsnyder merged 1 commit into
mainfrom
jajerome/cct-1716-content-varlink-interface

Conversation

@DuckBoss

@DuckBoss DuckBoss commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Add the Refresh(force, metadata) method to a new com.redhat.rhsm.testing.content Varlink interface. It refreshes the installed SCA entitlement certificate (optionally forcing a fresh fetch) and regenerates redhat.repo accordingly, per the rhsm-varlink design doc. Business logic lives in rhsm2's UpdateEntitlementCertificate and GenerateRepoFileFromInstalledEntitlementCerts; this wires it into the same Backend/Handler pattern already used by the override and release interfaces.

Blocked by:

Resolves: CCT-1716

  1. Environment:
$ testing-farm reserve --compose RHEL-10.3-Nightly
$ git clone https://github.com/RedHatInsights/rhc.git && cd rhc/
$ git checkout jajerome/cct-1716-content-varlink-interface
$ make build
  1. Start rhc-server:
$ ./rhc-server &
  1. Confirm the interface is registered:
    Look for com.redhat.rhsm.testing.content in the interface list.
$ varlinkctl info /run/rhc/com.redhat.rhc
  1. Error path: unregistered system (no registration needed for this one)
$ varlinkctl call --json=short /run/rhc/com.redhat.rhc \
  com.redhat.rhsm.testing.content.Refresh '{"force": false}'
# error: com.redhat.rhsm.testing.content.SystemNotRegistered
  1. Register, then demo a regular Refresh:
$ ./rhc connect --username <user> --password <pass> --organization <org> \
  --enable-feature content --disable-feature analytics --disable-feature remote-management
$ ./rhc status --format json | jq   # confirm rhsm_connected: true
$ ls -la /etc/pki/entitlement/                 # note serial + mtime

Run the refresh method: entitlement cert serial/mtime unchanged (conditional If-Modified-Since GET → 304).

$ varlinkctl call --json=short /run/rhc/com.redhat.rhc \
  com.redhat.rhsm.testing.content.Refresh '{"force": false}' | jq
#  {"success": true}
  1. Force refresh: round trip proving the cert actually updates
$ varlinkctl call --json=short /run/rhc/com.redhat.rhc \
  com.redhat.rhsm.testing.content.Refresh '{"force": true}' | jq
# {"success": true}
$ ls -la /etc/pki/entitlement/     # fresh fetch: If-Modified-Since is skipped with force=true
$ cat /etc/yum.repos.d/redhat.repo
  1. Idempotency: run the refresh multiple times
    Both return {"success": true}, no crash, no duplicate files left in /etc/pki/entitlement/.
$ varlinkctl call --json=short /run/rhc/com.redhat.rhc \
  com.redhat.rhsm.testing.content.Refresh '{"force": false}' | jq
$ varlinkctl call --json=short /run/rhc/com.redhat.rhc \
  com.redhat.rhsm.testing.content.Refresh '{"force": false}' | jq

@DuckBoss
DuckBoss force-pushed the jajerome/cct-1716-content-varlink-interface branch 2 times, most recently from 2504f13 to 8ddf048 Compare August 24, 2026 17:19
Add the Refresh(force, metadata) method to a new com.redhat.rhsm.testing.content
Varlink interface. It refreshes the installed SCA entitlement certificate
(optionally forcing a fresh fetch) and regenerates redhat.repo accordingly,
per the rhsm-varlink design doc. Business logic lives in rhsm2's
UpdateEntitlementCertificate and GenerateRepoFileFromInstalledEntitlementCerts;
this wires it into the same Backend/Handler pattern already used by the
override and release interfaces. This patch also bumps rhsm2 to 6e9f30c.

Resolves: CCT-1716

Assisted-by: Claude/Sonnet-5
Signed-off-by: Jason Jerome <jajerome@redhat.com>
@DuckBoss
DuckBoss force-pushed the jajerome/cct-1716-content-varlink-interface branch from 8ddf048 to a469b81 Compare August 24, 2026 17:36
@DuckBoss
DuckBoss marked this pull request as ready for review August 24, 2026 17:58
@cnsnyder
cnsnyder self-requested a review August 25, 2026 15:11

@cnsnyder cnsnyder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@cnsnyder
cnsnyder merged commit 23b5497 into main Aug 27, 2026
33 checks passed
@cnsnyder
cnsnyder deleted the jajerome/cct-1716-content-varlink-interface branch August 27, 2026 12:59
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.

2 participants