Skip to content

Commit a1d6535

Browse files
committed
Improvements after review and testing
1 parent 754e2fe commit a1d6535

6 files changed

Lines changed: 310 additions & 453 deletions

File tree

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-dnf_appstream": {
227+
"description": "Promise type to manage dnf appstream modules.",
228+
"subdirectory": "promise-types/dnf_appstream",
229+
"dependencies": ["library-for-promise-types-in-python"],
230+
"steps": [
231+
"copy dnf_appstream.py modules/promises/",
232+
"append enable.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/dnf_appstream/README.md

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# DNF AppStream Promise Type
22

3-
A CFEngine custom promise type for managing DNF AppStream modules on RHEL 8+ and compatible systems.
3+
A CFEngine custom promise type for managing DNF AppStream modules on compatible systems.
44

55
## Overview
66

@@ -10,10 +10,6 @@ The `dnf_appstream` promise type allows you to manage DNF AppStream modules, whi
1010

1111
- Enable, disable, install, and remove DNF AppStream modules
1212
- Support for specifying streams and profiles
13-
- Input validation and sanitization for security
14-
- Proper error handling and logging
15-
- Module state checking to avoid unnecessary operations
16-
- Uses DNF Python API for efficient and secure operations
1713

1814
## Installation
1915

@@ -23,7 +19,7 @@ To install this promise type, copy the `dnf_appstream.py` file to your CFEngine
2319
promise agent dnf_appstream
2420
{
2521
interpreter => "/usr/bin/python3";
26-
path => "$(sys.inputdir)/dnf_appstream.py";
22+
path => "$(sys.workdir)/modules/promises/dnf_appstream.py";
2723
}
2824
```
2925

@@ -59,20 +55,20 @@ bundle agent main
5955
{
6056
dnf_appstream:
6157
"python36"
62-
state => "present",
58+
state => "installed",
6359
stream => "3.6",
6460
profile => "minimal";
6561
}
6662
```
6763

68-
### Ensure a module is absent
64+
### Ensure a module is removed
6965

7066
```
7167
bundle agent main
7268
{
7369
dnf_appstream:
7470
"postgresql"
75-
state => "absent";
71+
state => "removed";
7672
}
7773
```
7874

@@ -91,19 +87,9 @@ bundle agent main
9187

9288
The promise type supports the following attributes:
9389

94-
- `state` (required) - Desired state of the module: `present`, `absent`, `enabled`, `disabled`, or `default` (default: `present`)
95-
- `stream` (optional) - Specific stream of the module to use. Set to `"default"` to use the module's default stream.
96-
- `profile` (optional) - Specific profile of the module to install. Set to `"default"` to use the module stream's default profile.
97-
98-
## Module States
99-
100-
- `present` - The module and its packages (profile) are present on the system (implies enabled). Alias: `install`.
101-
- `absent` - The module is not present or is disabled. Alias: `remove`.
102-
- `enabled` - The module is enabled and available for installation.
103-
- `disabled` - The module is explicitly disabled.
104-
- `default` - The module is in its default state (neither enabled nor disabled, no profiles installed). Alias: `reset`.
105-
106-
Note: The `present` state implies `enabled` because in DNF's module system, installing a module automatically enables it first.
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.
10793

10894
## Requirements
10995

promise-types/dnf_appstream/cfbs.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)