Skip to main content

Advanced features of the package editor.

A Medulla package is a list of steps executed in sequence on the target computers. Beyond this linear workflow, Medulla offers several mechanisms for dynamically controlling a deployment: reacting to the result of each step, redirecting execution, reusing files from another package, and conditionally chaining multiple packages together.

This documentation is intended for all Medulla users. It brings these mechanisms together in a single document, organized to progress from the most local (a single step) to the most global (multiple packages):

  • chapter 2 shows how to make a package’s execution dependent on the outcome of its steps, and how to jump from one step to another;
  • chapter 3 explains how to reuse files from another already-deployed package within a package;
  • chapter 4 describes how to automatically trigger a package based on the status or result of another;
  • the appendix at the end of the document summarizes the Meta variables that can be used in steps.

1. Overview: what each mechanism enables

You want to…Use…
Jump to a step **based on the return code** (without pausing)“Add goto” rule in a step’s Options (`==`, `!=`, `IN`, `OUT`, …)
Mark a **pause** then jump to a step (unconditionally)“Wait and go to step” action (delay in seconds + jump)
Name a step so you can jump to itStep label
Cleanly exit as appropriate“End Success” / “End Error” actions
Reuse files from another package“Alternate package” option
Trigger a package based on the status/result of anotherMarker + dynamic group targeted by the second deployment

2. Return codes, labels, and “Goto” jumps

This chapter explains how to make a package’s execution dependent on the results of its steps, and how to redirect execution to a specific step instead of following a purely linear flow.

Prerequisite: Know how to build a package in the editor (see “The package editor: how it works”).

How a package runs

A package is a sequence of numbered steps, executed in order, from the first to the last. At the end of execution, each step produces:

  • textual output (what the command or script wrote);
  • a numeric return code (the “exit code”: 0 = success by convention; any other value has a meaning specific to the called tool).

Both pieces of information can be reused by the next step via the Meta variables @@@PREC_RESULT@@@ (text output) and @@@PREC_RETURNCODE@@@ (return code)—see the appendix at the end of this document for a complete list of Meta variables.

The label: name a step so you can jump to it

Each step has a unique label. This label serves as an anchor that allows another step to point to it: as long as a step has a label, any other step in the package can request “go to this label” instead of continuing linearly.

![The step editor: the “Available Actions” palette (left) and the “Deployment Workflow” (right), showing the Install Section, an “Execute script” step, followed by “End Success” and “End Error.”]01-plan-de-deploiement.png

The Label (“Step label”) field and the jump rules are configured in a step’s Options:

![Options for an “Execute script” step: the “Step label” field, the “Alternate package” option, and an “On return code, goto” rule (Return Code !=0 → Goto Label END_ERROR).][!(https://docs.medulla-tech.io/uploads/images/gallery/2026-09/scaled-1680-/VS1UIGZ2vddi2koc-01-plan-de-deploiement.png)]

There is no standalone step that simply performs a “Goto Label.” It is important to distinguish between two different jump mechanisms, which serve different purposes:

1. The “Wait and go to step” action—this is a step in its own right, which you drag from the palette. It waits for a specified duration (the “Wait for (seconds)” field, 10 s by default) and then jumps to a target step (the goto field), unconditionally. This is the only mechanism that introduces a pause. It is useful, for example, to allow a service to start before continuing. ![The “Wait and go to step” action: the “Wait for (seconds)” field (default 10) and the goto field (here “END_SUCCESS”).](01ter-wait-and-go-a.png)

2. The “Add goto” button in a step’s Options—it adds a conditional jump rule based on the return code (“Return Code → Goto Label,” see screenshot above). The jump is triggered only if the return code satisfies the condition; there is no pause. This is the mechanism used to branch based on the result of a step (see the next section).

In other words, the “Goto Label” behavior does exist, but it is always attached to a step: either the dedicated “Wait and go to step” step (pause + jump), or a conditional jump rule added to a step’s Options (without a pause). There is no standalone “Goto Label” type.

Respond to a return code

The principle

Convention: a return code of 0 = success. Any code other than 0 = error.

This is the convention to follow when designing your packages. Be careful, however, with how the engine actually applies it:

  • a step that returns 0 without any specific rule is considered successful, and the flow continues to the next step;
  • a step that returns a code other than 0 is not automatically treated as an error: if there are no rules covering that code, the engine simply moves on to the next step (often “End Success”) — and the deployment may then be marked as successful even though the step failed.

⚠️ Key takeaway: For a failure code to actually terminate the package with an error, it must be explicitly declared with a rule !=0 → END_ERROR. Do not rely on automatic error handling.

Handle cases with rules

Return code rules are used both to enforce the convention (==0 → END_SUCCESS, !=0 → END_ERROR) and to handle exceptions (e.g., treating a code that is not 0 as a success, such as 3010, or redirecting to a specific step). Each rule associates a condition (operator + value) with an action (go to a label, END_SUCCESS, or END_ERROR). Rules are evaluated in order, and the first one that matches takes precedence.

Available operators:

OperatorMeaning
`==1`Return code exactly equal to 1
`!=1` or `<>1`Return code not equal to 1
`<1` / `>1` / `<=1` / `>=1`Numeric comparisons
`IN1,5`Return code within the range `[1;5]`
`OUT1,5`Return code outside the interval `[1;5]`

Best practice: For any step where the result matters, declare at least the two rules ==0 → END_SUCCESS and !=0 → END_ERROR (plus your specific codes, such as ==3010). This is the only reliable way to ensure that a success is a success and a failure is a failure.

Example 1 — An installer that requires a reboot

Many MSI installers return code 3010 to indicate “installation successful, a reboot is required.” By default, this code ≠ 0 would be considered a failure. Here’s how to handle it:

The labels END_SUCCESS and END_ERROR are the reserved labels for the “End Success” and “End Error” steps: the process jumps directly to them, so there’s no need to create custom end labels.

Étape 1  [libellé: install]   Exécuter une commande : setup.exe /qn
           Règle : ==3010  → aller à [reboot]
           Règle : ==0     → aller à END_SUCCESS
           Règle : !=0     → aller à END_ERROR

Étape 2  [libellé: reboot]    Redémarrer la machine
                              (puis enchaîne naturellement sur END_SUCCESS)

Étape 3  Fin avec succès      (libellé END_SUCCESS, inventaire forcé)

Étape 4  Fin avec erreur      (libellé END_ERROR)

Result: Code 3010 is no longer treated as a failure, the computer reboots properly, and the deployment is marked as successful.

Example 2 — Retry, then switch to an alternative method

Typical scenario: you attempt a “clean” installation, and if it fails, you switch to a fallback method before abandoning the process.

Étape 1  [libellé: tentative1]  Exécuter un script : installation standard
           Règle : ==0   → aller à END_SUCCESS
           Règle : !=0   → aller à [tentative2]

Étape 2  [libellé: tentative2]  Exécuter un script : installation de secours (mode forcé)
           Règle : ==0   → aller à END_SUCCESS
           Règle : !=0   → aller à [echec]

Étape 3  Fin avec succès        (libellé END_SUCCESS)

Étape 4  [libellé: echec]       Ajouter au journal : "Les deux méthodes ont échoué (code @@@PREC_RETURNCODE@@@)"
                                (puis enchaîne sur END_ERROR)

Étape 5  Fin avec erreur        (libellé END_ERROR)

Beware of loops: jumping back to a previous step (for example, to retry) can create an infinite loop if the exit condition is never met. Always include a counter (via an incremented environment variable) or a strict exit condition.

Sections of a package: installation, update, uninstallation

A single package can contain up to three execution modes:

  • Install Section — the default section;
  • Update Section — triggered by negative convergences;
  • Uninstall Section — forced via a JSON dynamic parameter, for example {"section": "uninstall"}.

Jumps and return codes work within each section. The value of a dynamic parameter passed to the deployment can be accessed in the steps via @@@DYNAMIC_PARAM@@@section@@@, allowing you to adapt the behavior to the requested mode.

3. The “Alternate package” option

This chapter explains how a package can reuse files from another package already deployed on the computer, using the “Alternate package” option.

What the option does

By default, an action (command, script, extraction, download) operates within the local folder of the current package on the client workstation. The “Alternate package” option appears as a checkbox in the Options for these actions: once checked, the action no longer operates within the current package’s folder but instead uses the folder of another package already deployed on the computer, selected from the drop-down list right next to it.

In practice, this allows a “lightweight” package to access files placed there by a “heavy” package—without having to re-download those files.

Actions that support this optional setting:

ActionBehavior with “Alternate package”
**Run command**The command runs from the other package’s folder
**Execute script**The script runs from the other package’s folder
**Unzip File**The archive is extracted to/from the other package’s folder
**Download File**The file is placed in the other package’s folder

What this option does NOT do: it does NOT “launch” the other package or execute its steps. It merely provides access to its file folder. To actually trigger the execution of another package, see Chapter 4—Dynamic groups and conditional package chaining.

![In the Options for a “Run command” action, the “Alternate package” checkbox is selected, and the drop-down list allows you to choose the target package (here, “notepad++”).]02-package-alternatifBIS.png

Prerequisites

For an alternative package to be usable on the target computer:

  1. It must already have been deployed on that workstation (its local folder must exist);
  2. Its contents must not have been deleted. In particular, if the source package contains a “Remove uploaded files” step or an “End Success” step configured to clean up the package, its folder will no longer exist.

Best practices:

  • The “library” package (the one whose files are reused) must not clean itself up: do not include a “Remove uploaded files” step in it, and configure its “End Success” step without deleting the package.
  • Ensure the deployment order: the library package must arrive on the computer before the package that uses it. See Chapter 4—Dynamic groups and conditional package chaining to automate this sequence.

Behavior if the alternative package is missing

If the alternative package cannot be found (never deployed, or directory cleaned up), the step does not fail and does not return a specific error code: a simple warning is logged (“Requested package directory missing”), then execution continues in the current directory and proceeds to the next step. It is then the action that uses these files (command, script, etc.) that returns a failure code, since it is running in the wrong location.

But be careful: this failure code alone is not enough to cause the deployment to fail. As explained in Chapter 2 — Return codes, labels, and “Goto” jumps, without an explicit return code rule, an unhandled non-zero return code simply causes the process to proceed to the next step (“End Success”): the deployment may therefore complete successfully even though the library was missing.

Typical log excerpt for a missing alternative package, without a return code rule (the deployment incorrectly ends successfully):

Warning : Requested package directory missing!!!: <package uuid>
[GoTo] Received return code: 1
[GoTo] Attempting jump to next step.
Branching to next step 1        ← passe à « Fin avec succès »

Recommendation: In the action that uses the alternative package, always declare a rule !=0 → END_ERROR (and ==0 → END_SUCCESS). This ensures that if the library is missing, the command’s failure is properly reported as an error. For even more explicit verification, you can check for the presence of the folder in an “Execute script” step before using it.

Example — A shared payload

Scenario: A large runtime (2 GB) must be available for three different business applications. Rather than embedding it three times:

Package "Runtime-Commun"   (déployé une seule fois, ne se nettoie pas)
   └── contient les 2 Go de fichiers du runtime

Package "AppA"  →  Exécuter une commande : install_appA.exe
                   [Package alternatif : Runtime-Commun]
                   (l'installeur trouve le runtime dans le dossier de Runtime-Commun)

Package "AppB"  →  idem, package alternatif : Runtime-Commun
Package "AppC"  →  idem, package alternatif : Runtime-Commun

Benefit: The 2 GB is transferred over the network only once, and the three application packages remain lightweight.

4. Dynamic groups and conditional package chaining

This chapter explains how to automatically trigger a package based on the status or result of another, using dynamic groups and deployment convergence.

The principle: you don’t “chain” packages; you control their target

Medulla does not offer a command such as “at the end of this package, run that other package.” Conditional chaining works differently:

A computer is added to (or removed from) a dynamic group based on its state, and a deployment is configured to target that group. When the computer joins the group, the package deploys to it automatically.

The perceived result is identical to a “conditional call of one package from another,” but the mechanism is declarative (based on the computer’s state) rather than imperative. It’s more robust: if a computer was powered off when the first package was deployed, it is included as soon as it meets the conditions.

The key step: reflect a package’s result in the inventory

For package B to trigger “as a result of” package A, the result of package A must be visible in the inventory so that a dynamic group can detect it. Two approaches:

  1. Rely on the actual effect of package A. Package A installs software X; the dynamic group “computers where X is installed” is automatically populated after the next inventory update. This is the simplest and most reliable approach.

    • Tip: An “End Success” step can trigger an inventory run at the end of package A, so that the status is reported immediately.
  2. Set an explicit marker—the registry key (recommended method on Windows). The dynamic groups module natively exposes the “Register key” and “Register key value” criteria. Package A writes a registry key in its success branch, and the dynamic group targets “Register key value = <your value>.”

    • Prerequisite: For a registry key to be reported in the inventory (and become usable as a criterion), it must be included in the inventory’s registry collection scope (FusionInventory/GLPI collection rules). Add the key to be collected in the inventory configuration; otherwise, the criterion will remain empty.
    • Other markers that can be used as criteria without specific configuration: the presence of installed software or a specific software version, or membership in an entity or group.

![The “Register key” and “Register key value” criteria exposed by the glpi module: these allow you to target a registry key deployed by a package as a marker.]

Make the call conditional

The condition is coded entirely within the marker and the group’s criteria:

  • Conditional on success: the marker is set only in the event of success (in the END_SUCCESS branch). A computer that fails does not set the marker, does not enter the group, and therefore does not receive package B.
  • Conditional on a specific return code: set a different marker depending on the return code branch taken (for example, resultat=reboot_requis vs. resultat=ok), and create one dynamic group per marker value.
  • Exclude computers that have already been processed: add the criterion “package B not yet installed” to the group to prevent redeployments.

Example — Deploy the monitoring agent only after a successful installation

Objective: Install the monitoring agent (package B) only on computers where the business application (package A) has been successfully installed.

1. Package A "Install-AppMetier"
      … étapes d'installation …
      Branche END_SUCCESS :
          Poser un marqueur : écrire la clé de registre  HKLM\Software\MonOrga\AppMetier = OK
          Fin avec succès (inventaire forcé)
      Branche END_ERROR :
          (aucun marqueur posé)
          Fin avec erreur

2. Groupe dynamique "AppMetier-OK-sans-superviseur"
      Critère 1 : clé de registre HKLM\Software\MonOrga\AppMetier = OK
      Critère 2 : agent de supervision NON installé

3. Package B "Install-Superviseur"
      Déploiement configuré pour cibler le groupe "AppMetier-OK-sans-superviseur"
      → toute machine qui rejoint le groupe reçoit automatiquement le package B

Process: A computer where A succeeds sets the marker → when the inventory is refreshed, it enters the group → package B is automatically deployed to it. A computer where A fails does not set the marker, remains outside the group, and never receives B. Once B is installed, criterion 2 is no longer met: the computer leaves the group, which prevents any redeployment.

Combine with the “Alternate package”

Conditional triggering and file reuse complement each other for dependencies:

  • Use a dynamic group to ensure that the “library” package is deployed before the package that consumes it (criterion: “library present”).
  • Once the library is in place, the consumer package uses the “Alternate package” option (Chapter 3) to access its files.

This gives you a complete workflow: ordered deployment (dynamic groups) + file reuse (alternative package) + branching based on results (return codes and jumps, Chapter 2).

Appendix — Meta variables

Meta variables are enclosed in @@@ and replaced at runtime on the computer. They can be used in commands, scripts, and step parameters.

VariableContent
`@@@PREC_RESULT@@@`Text output from the previous step
`@@@PREC_RETURNCODE@@@`Return code from the previous step
`@@@DYNAMIC_PARAM@@@section@@@`Value of a dynamic deployment parameter (e.g., the section)
`@@@PACKAGE_NAME@@@`Package name
`@@@UUID_PACKAGE@@@`Unique identifier of the package
`@@@HOSTNAME@@@` / `@@@IP_MACHINE@@@` / `@@@OS_FAMILY@@@`Target computer metadata