Skip to content

Commit bdfd6b2

Browse files
committed
Added promise type to manage Application Streams (AppStreams)
A CFEngine custom promise type for managing AppStream modules (https://www.redhat.com/en/blog/introduction-appstreams-and-modules-red-hat-enterprise-linux) on compatible systems. - Enable, disable, install, and remove AppStream modules - Support for specifying streams and profiles Ticket: CFE-3653
1 parent b14c951 commit bdfd6b2

File tree

6 files changed

+959
-0
lines changed

6 files changed

+959
-0
lines changed

cfbs.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,15 @@
223223
"append enable.cf services/init.cf"
224224
]
225225
},
226+
"promise-type-appstreams": {
227+
"description": "Promise type to manage AppStream modules.",
228+
"subdirectory": "promise-types/appstreams",
229+
"dependencies": ["library-for-promise-types-in-python"],
230+
"steps": [
231+
"copy appstreams.py modules/promises/",
232+
"append init.cf services/init.cf"
233+
]
234+
},
226235
"promise-type-git": {
227236
"description": "Promise type to manage git repos.",
228237
"subdirectory": "promise-types/git",

promise-types/appstreams/README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# AppStreams Promise Type
2+
3+
A CFEngine custom promise type for managing AppStream modules on compatible systems.
4+
5+
## Overview
6+
7+
The `appstreams` promise type allows you to manage AppStream modules, which are a key feature of RHEL 8+ and compatible systems. AppStreams provide multiple versions of software components that can be enabled or disabled as needed.
8+
9+
## Features
10+
11+
- Enable, disable, install, and remove AppStream modules
12+
- Support for specifying streams and profiles
13+
14+
## Installation
15+
16+
To install this promise type, copy the `appstreams.py` file to your CFEngine masterfiles directory and configure the promise agent:
17+
18+
```
19+
promise agent appstreams
20+
{
21+
interpreter => "/usr/bin/python3";
22+
path => "$(sys.workdir)/modules/promises/appstreams.py";
23+
}
24+
```
25+
26+
## Usage
27+
28+
### Ensure a module is enabled
29+
30+
```
31+
bundle agent main
32+
{
33+
appstreams:
34+
"nodejs"
35+
state => "enabled",
36+
stream => "12";
37+
}
38+
```
39+
40+
### Ensure a module is disabled
41+
42+
```
43+
bundle agent main
44+
{
45+
appstreams:
46+
"nodejs"
47+
state => "disabled";
48+
}
49+
```
50+
51+
### Ensure a module is installed with a specific profile
52+
53+
```
54+
bundle agent main
55+
{
56+
appstreams:
57+
"python36"
58+
state => "installed",
59+
stream => "3.6",
60+
profile => "minimal";
61+
}
62+
```
63+
64+
### Ensure a module is removed
65+
66+
```
67+
bundle agent main
68+
{
69+
appstreams:
70+
"postgresql"
71+
state => "removed";
72+
}
73+
```
74+
75+
### Reset a module to default
76+
77+
```
78+
bundle agent main
79+
{
80+
appstreams:
81+
"nodejs"
82+
state => "default";
83+
}
84+
```
85+
86+
## Attributes
87+
88+
The promise type supports the following attributes:
89+
90+
- `state` (optional) - Desired state of the module: `enabled`, `disabled`, `installed`, `removed`, `default`, or `reset` (default: `enabled`)
91+
- `stream` (optional) - Specific stream of the module to use. Set to `default` to use the module's default stream.
92+
- `profile` (optional) - Specific profile of the module to install. Set to `default` to use the module stream's default profile.
93+
94+
## Requirements
95+
96+
- CFEngine 3.18 or later
97+
- Python 3
98+
- DNF Python API (python3-dnf package)
99+
- DNF/YUM package manager (RHEL 8+, Fedora, CentOS 8+)
100+
- AppStream repositories configured

0 commit comments

Comments
 (0)