Skip to content

Commit 1b77a0b

Browse files
committed
Add documentation for the env prefix in package promises's options attribute
1 parent fd69cbe commit 1b77a0b

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

reference/promise-types/packages.markdown

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,20 @@ rescue solution when a package module has added functionality which is not
127127
covered by the package promise API. As such there is no official documentation
128128
for this attribute, its usage depends on the package module in question.
129129

130+
Some package managers support a special ```env``` prefix to set environment
131+
variables for the package manager. For example, to set the ```EXTERNAL_URL```
132+
environment variable:
133+
134+
```cf3
135+
packages:
136+
"gitlab-ce"
137+
policy => "present",
138+
options => { "env:EXTERNAL_URL=https://example.com" };
139+
```
140+
141+
This allows customizing the behavior of some package managers, or setting
142+
parameters used by some packaging scripts.
143+
130144
**Type:** `slist`
131145

132146
**Allowed input range:** (arbitrary string)
@@ -441,10 +455,28 @@ bundle agent example
441455
screen-4.1.0-0.19.20120314git3c2946.el7.x86_64
442456
```
443457

458+
* Supports [```options```][packages#options] attribute. Each space separate
459+
option must be added as a separate list element. The options are passed
460+
directly through to the package manager.
461+
* It is possible to use the [```options```][packages#options] attribute to pass
462+
environment variables to the package manager with the ```env``` prefix. For
463+
example, to set the ```EXTERNAL_URL``` environment variable:
464+
465+
```cf3
466+
bundle agent example_yum_pass_env_options
467+
{
468+
packages:
469+
"gitlab-ce"
470+
policy => "present",
471+
options => { "env:EXTERNAL_URL=https://example.com" };
472+
}
473+
```
474+
444475
**History:**
445476

446477
* Added in CFEngine 3.7.0
447478
* `enablerepo` and `disablerepo` option support added in 3.7.8, 3.10.4, 3.12.0
479+
* ```env``` prefix ```options``` in support added in 3.21.7, 3.24.2 and 3.25.0
448480

449481
### apt_get
450482

@@ -478,10 +510,24 @@ packages:
478510
* Supports [```options```][packages#options] attribute. Each space separate
479511
option must be added as a separate list element. The options are passed
480512
directly through to the package manager.
513+
* It is possible to use the [```options```][packages#options] attribute to pass
514+
environment variables to the package manager with the ```env``` prefix. For
515+
example, to set the ```EXTERNAL_URL``` environment variable:
516+
517+
```cf3
518+
packages:
519+
"gitlab-ce"
520+
policy => "present",
521+
options => { "env:EXTERNAL_URL=https://example.com" };
522+
```
523+
524+
It can for exemple be used to modify the default behavior of ```needrestart```
525+
([documentation](https://manpages.ubuntu.com/manpages/focal/man1/needrestart.1.html)).
481526

482527
**History:**
483528

484529
* Added in CFEngine 3.7.0
530+
* ```env``` prefix ```options``` in support added in 3.21.7, 3.24.2 and 3.25.0
485531

486532
### freebsd_ports
487533

@@ -656,3 +702,56 @@ bundle agent main
656702

657703
- version `latest` is *not* supported when promising an absence
658704
- `list-updates` is *not* implemented, snaps are automatically updated by default
705+
706+
### zypper
707+
708+
Manage packages using ```zypper```. This is the [default package module][lib/packages.cf#package_module_knowledge] for SLES, SLED and OpenSUSE.
709+
710+
**Examples:**
711+
712+
File based package source.
713+
714+
```cf3
715+
packages:
716+
sles|sled|opensuse::
717+
"/mnt/nfs/packages/apache2-2.2.22.x86_64.rpm"
718+
policy => "present";
719+
```
720+
721+
Repository based package source with a specific version of the package.
722+
723+
```cf3
724+
packages:
725+
sles|sled|opensuse::
726+
"apache2"
727+
policy => "present",
728+
version => "2.2.22";
729+
```
730+
731+
**Notes:**
732+
733+
* Supports file path and repository sourced packages.
734+
735+
* Requires Python version 2 or 3 to be installed on the host.
736+
737+
* Supports [```options```][packages#options] attribute. Each space separate
738+
option must be added as a separate list element. The options are passed
739+
directly through to the package manager.
740+
* It is possible to use the [```options```][packages#options] attribute to pass
741+
environment variables to the package manager with the ```env``` prefix. For
742+
example, to set the ```EXTERNAL_URL``` environment variable:
743+
744+
```cf3
745+
bundle agent example_yum_pass_env_options
746+
{
747+
packages:
748+
"gitlab-ce"
749+
policy => "present",
750+
options => { "env:EXTERNAL_URL=https://example.com" };
751+
}
752+
```
753+
754+
**History:**
755+
756+
* Added in CFEngine 3.11.0
757+
* ```env``` prefix ```options``` in support added in 3.21.7, 3.24.2 and 3.25.0

0 commit comments

Comments
 (0)