-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extensions: Add support for
hotfixes-$variant.yaml
We have a bug in https://issues.redhat.com/browse/OCPBUGS-7275 where we need an updated rpm-ostree on the host in order to make future upgrades work. This adds basic support for hotfixes, which are RPMs that live in the extensions container, but are intended to be applied-live by the MCD. They appear in `/usr/share/rpm-ostree/extensions/hotfixes` with the hotfix data (YAML) reserialized to JSON.
- Loading branch information
Showing
3 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package cosa | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
) | ||
|
||
const initConfigPath = "src/config.json" | ||
|
||
type configVariant struct { | ||
Variant string `json:"coreos-assembler.config-variant"` | ||
} | ||
|
||
// GetVariant finds the configured variant, or "" if unset | ||
func GetVariant() (string, error) { | ||
contents, err := os.ReadFile(initConfigPath) | ||
if err != nil { | ||
if !os.IsNotExist(err) { | ||
return "", err | ||
} | ||
return "", nil | ||
} | ||
|
||
var variantData configVariant | ||
if err := json.Unmarshal(contents, &variantData); err != nil { | ||
return "", fmt.Errorf("parsing %s: %w", initConfigPath, err) | ||
} | ||
|
||
return variantData.Variant, nil | ||
} |
This file contains 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