module

Krikri::PluginHelpers::RhsmRepository

RhsmRepository - pure logic for the rhsm_repository plugin: parsing subscription-manager repos --list output, fnmatch-style glob matching, and deciding which repos need enabling/disabling. Split out of plugins/rhsm_repository.cr so the argv/planning logic is unit-spec-able (the execution path needs a real registered RHEL system, which no spec environment has).

Class methods

glob_match?(repo_id : String, pattern : String) : Bool

Python's fnmatch on repo IDs: '*' any run, '?' any one char, everything else literal (fnmatch is case-insensitive on some platforms but repo IDs are lowercase hex/alnum anyway, so the case handling never decides a match here).

Source
parse_list(output : String) : Array(Repo)

Mirrors the real module's Rhsm.list_repositories line walk: skip empty/header/indented lines, start a repo at "Repo ID: ", close it at the "Enabled: 1|0" line that follows its block.

Source
plan(repos : Array(Repo), names : Array(String), state : String, purge : Bool) : Plan

state here is already normalized to "enabled"/"disabled" (the plugin maps the removed present/absent spellings onto these).

Source

Nested types