-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation for the env prefix in package promise's options attribute #3374
Draft
amousset
wants to merge
1
commit into
cfengine:master
Choose a base branch
from
amousset:package-env-var
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+99
−0
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,6 +127,20 @@ rescue solution when a package module has added functionality which is not | |
covered by the package promise API. As such there is no official documentation | ||
for this attribute, its usage depends on the package module in question. | ||
|
||
Some package managers support a special ```env``` prefix to set environment | ||
variables for the package manager. For example, to set the ```EXTERNAL_URL``` | ||
environment variable: | ||
|
||
```cf3 | ||
packages: | ||
"gitlab-ce" | ||
policy => "present", | ||
options => { "env:EXTERNAL_URL=https://example.com" }; | ||
``` | ||
|
||
This allows customizing the behavior of some package managers, or setting | ||
parameters used by some packaging scripts. | ||
|
||
**Type:** `slist` | ||
|
||
**Allowed input range:** (arbitrary string) | ||
|
@@ -441,10 +455,28 @@ bundle agent example | |
screen-4.1.0-0.19.20120314git3c2946.el7.x86_64 | ||
``` | ||
|
||
* Supports [```options```][packages#options] attribute. Each space separate | ||
option must be added as a separate list element. The options are passed | ||
directly through to the package manager. | ||
* It is possible to use the [```options```][packages#options] attribute to pass | ||
environment variables to the package manager with the ```env``` prefix. For | ||
example, to set the ```EXTERNAL_URL``` environment variable: | ||
|
||
```cf3 | ||
bundle agent example_yum_pass_env_options | ||
{ | ||
packages: | ||
"gitlab-ce" | ||
policy => "present", | ||
options => { "env:EXTERNAL_URL=https://example.com" }; | ||
} | ||
``` | ||
|
||
**History:** | ||
|
||
* Added in CFEngine 3.7.0 | ||
* `enablerepo` and `disablerepo` option support added in 3.7.8, 3.10.4, 3.12.0 | ||
* ```env``` prefix ```options``` in support added in 3.21.7, 3.24.2 and 3.25.0 | ||
|
||
### apt_get | ||
|
||
|
@@ -478,10 +510,24 @@ packages: | |
* Supports [```options```][packages#options] attribute. Each space separate | ||
option must be added as a separate list element. The options are passed | ||
directly through to the package manager. | ||
* It is possible to use the [```options```][packages#options] attribute to pass | ||
environment variables to the package manager with the ```env``` prefix. For | ||
example, to set the ```EXTERNAL_URL``` environment variable: | ||
|
||
```cf3 | ||
packages: | ||
"gitlab-ce" | ||
policy => "present", | ||
options => { "env:EXTERNAL_URL=https://example.com" }; | ||
``` | ||
|
||
It can for exemple be used to modify the default behavior of ```needrestart``` | ||
([documentation](https://manpages.ubuntu.com/manpages/focal/man1/needrestart.1.html)). | ||
|
||
**History:** | ||
|
||
* Added in CFEngine 3.7.0 | ||
* ```env``` prefix ```options``` in support added in 3.21.7, 3.24.2 and 3.25.0 | ||
|
||
### freebsd_ports | ||
|
||
|
@@ -656,3 +702,56 @@ bundle agent main | |
|
||
- version `latest` is *not* supported when promising an absence | ||
- `list-updates` is *not* implemented, snaps are automatically updated by default | ||
|
||
### zypper | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thank you! |
||
|
||
Manage packages using ```zypper```. This is the [default package module][lib/packages.cf#package_module_knowledge] for SLES, SLED and OpenSUSE. | ||
|
||
**Examples:** | ||
|
||
File based package source. | ||
|
||
```cf3 | ||
packages: | ||
sles|sled|opensuse:: | ||
"/mnt/nfs/packages/apache2-2.2.22.x86_64.rpm" | ||
policy => "present"; | ||
``` | ||
|
||
Repository based package source with a specific version of the package. | ||
|
||
```cf3 | ||
packages: | ||
sles|sled|opensuse:: | ||
"apache2" | ||
policy => "present", | ||
version => "2.2.22"; | ||
``` | ||
|
||
**Notes:** | ||
|
||
* Supports file path and repository sourced packages. | ||
|
||
* Requires Python version 2 or 3 to be installed on the host. | ||
|
||
* Supports [```options```][packages#options] attribute. Each space separate | ||
option must be added as a separate list element. The options are passed | ||
directly through to the package manager. | ||
* It is possible to use the [```options```][packages#options] attribute to pass | ||
environment variables to the package manager with the ```env``` prefix. For | ||
example, to set the ```EXTERNAL_URL``` environment variable: | ||
|
||
```cf3 | ||
bundle agent example_yum_pass_env_options | ||
{ | ||
packages: | ||
"gitlab-ce" | ||
policy => "present", | ||
options => { "env:EXTERNAL_URL=https://example.com" }; | ||
} | ||
``` | ||
|
||
**History:** | ||
|
||
* Added in CFEngine 3.11.0 | ||
* ```env``` prefix ```options``` in support added in 3.21.7, 3.24.2 and 3.25.0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This confused me at first. I thought I might need to add a space between a single list item.
When you say "space separate option" do you mean they will eventually become space separated when added to the command lines used in the modules? I think that's what is happening right?
aka