Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cfbs.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@
"append enable.cf services/init.cf"
]
},
"promise-type-appstreams": {
"description": "Promise type to manage AppStream modules.",
"subdirectory": "promise-types/appstreams",
"dependencies": ["library-for-promise-types-in-python"],
"steps": [
"copy appstreams.py modules/promises/",
"append init.cf services/init.cf"
]
},
"promise-type-git": {
"description": "Promise type to manage git repos.",
"subdirectory": "promise-types/git",
Expand Down
100 changes: 100 additions & 0 deletions promise-types/appstreams/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# AppStreams Promise Type

A CFEngine custom promise type for managing AppStream modules on compatible systems.

## Overview

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.

## Features

- Enable, disable, install, and remove AppStream modules
- Support for specifying streams and profiles

## Installation

To install this promise type, copy the `appstreams.py` file to your CFEngine masterfiles directory and configure the promise agent:

```
promise agent appstreams
{
interpreter => "/usr/bin/python3";
path => "$(sys.workdir)/modules/promises/appstreams.py";
}
```

## Usage

### Ensure a module is enabled

```
bundle agent main
{
appstreams:
"nodejs"
state => "enabled",
stream => "12";
}
```

### Ensure a module is disabled

```
bundle agent main
{
appstreams:
"nodejs"
state => "disabled";
}
```

### Ensure a module is installed with a specific profile

```
bundle agent main
{
appstreams:
"python36"
state => "installed",
stream => "3.6",
profile => "minimal";
}
```

### Ensure a module is removed

```
bundle agent main
{
appstreams:
"postgresql"
state => "removed";
}
```

### Reset a module to default

```
bundle agent main
{
appstreams:
"nodejs"
state => "default";
}
```

## Attributes

The promise type supports the following attributes:

- `state` (optional) - Desired state of the module: `enabled`, `disabled`, `installed`, `removed`, `default`, or `reset` (default: `enabled`)
- `stream` (optional) - Specific stream of the module to use. Set to `default` to use the module's default stream.
- `profile` (optional) - Specific profile of the module to install. Set to `default` to use the module stream's default profile.

## Requirements

- CFEngine 3.18 or later
- Python 3
- DNF Python API (python3-dnf package)
- DNF/YUM package manager (RHEL 8+, Fedora, CentOS 8+)
- AppStream repositories configured
Loading
Loading