Skip to main content

How do I change the GLPI entity for a Medulla Imaging server?

Applies to: Medulla server
Version: Medulla 5.6.x
Environment: On-Premise / Debian
Category: Imaging / Administration

Overview

This procedure allows you to change the GLPI entity to which a Medulla Imaging server is associated, without having to delete or recreate that server.

The change_entite_imaging.sh script automates the preparation for this operation.

It allows you to:

  • Display the available GLPI entities.
  • Select the new target entity.
  • Display existing Imaging servers and their current associations.
  • Select the Imaging server to be moved.
  • Automatically prepare the new association.
  • Detect situations where no changes are necessary.
  • Log the operations.

The reassignment is then finalized from the Medulla administration interface.

1. Prerequisites

Before you begin, make sure you have:

  • SSH access to the main Medulla server.
  • root or sudo privileges.
  • Access to the Medulla administration interface.
  • An existing GLPI destination entity.
  • An Imaging server already registered in Medulla.

The server must also have functional access to its databases and a version of MariaDB compatible with the script.

Caution: This procedure modifies the configuration for associating an Imaging server. It is recommended that you perform a backup of your data before proceeding and perform this operation during a maintenance window.

2. Download the script

Connect via SSH to the main Medulla server.

Download the script from the official Medulla download server:

wget https://dl.medulla-tech.io/ma/change_entite_imaging.sh

Make the script executable:

chmod +x change_entite_imaging.sh

The script is now ready to use.

3. Simulate the entity change

Before making an actual change, it is recommended that you run a simulation.

sudo bash change_entite_imaging.sh --dry-run

The script automatically displays the list of available GLPI entities.

Example:

=== Entités ===
ID    ENTITÉ
0     Entité racine
2     Collectivité A
5     Collectivité B
ID de l'entité destination :

Enter the ID of the new entity.

The script then displays the existing Imaging servers:

=== Imaging Servers ===
ID    NOM                 ENTITÉ ACTUELLE       ÉTAT
1     imaging-server-01    Collectivité A        associé
2     imaging-server-02    Collectivité B        associé
ID de l'Imaging Server à basculer :

Enter the ID of the relevant Imaging server.

The script then displays the planned operations and indicates that it is running in simulation mode.

Simulation mode: No changes are made to the databases. This step allows you to verify the selected information before making the actual change.

4. Change the Imaging server's entity

Once the simulation has been verified, run the script without any parameters:

sudo bash change_entite_imaging.sh

The script will prompt you in sequence to:

  1. Select the destination GLPI entity.
  2. Select the Imaging server to be moved.
  3. Confirm the operation.

A summary of the change is displayed before confirmation.

To confirm, enter o when the script displays:

Confirmer ? (o/N) :

To cancel, enter N or press Entrée.

After confirmation, the script automatically prepares to reassign the Imaging server.

When the operation is successful, it displays:

Bascule effectuée.
>>> Finaliser dans l'interface Medulla :
    Menu Imaging > entité de destination > valider en bas de page > recharger.

Important: Running the script alone is not sufficient to complete the entity change. Confirmation in the Medulla interface is required.

5. Finalize the reassignment in Medulla

After running the script:

  1. Log in to the Medulla administration interface.
  2. Open the Imaging menu.
  3. Select the new GLPI entity.
  4. Click the submit button at the bottom of the page.
  5. Reload the page.
  6. Verify that the Imaging server is now associated with the new entity.

Result: The Imaging server is now linked to the new GLPI entity, without having to delete or recreate it.

6. Special cases

The server is already associated with the correct entity

If the Imaging server is already associated with the selected entity, the script automatically detects this and makes no changes.

The server is already unlinked

If the Imaging server is already unlinked, the script checks whether the destination entity is available.

If it already exists, the script indicates that no further changes are needed and prompts you to complete the operation directly in Medulla.

If it does not yet exist in Imaging, the script prepares to create it before validation in the interface.

The selected entity or server does not exist

The script verifies the IDs entered and aborts the operation if the entity or the Imaging server does not exist.

Another execution is already in progress

The script prevents two simultaneous executions.

If another operation is in progress, wait for it to finish before trying again.

7. View the operation log

Completed operations are recorded in the following file:

/var/log/medulla_change_entite_imaging.log

To view the latest operations:

sudo tail -n 50 /var/log/medulla_change_entite_imaging.log

This log allows you to retrieve information about the changes made and facilitates troubleshooting.

8. Recommendations

  • Always perform a simulation before making the actual change.
  • Carefully verify the destination entity and the selected Imaging server.
  • Avoid simultaneous Imaging operations during the procedure.
  • Complete the reassignment in the Medulla interface immediately after running the script.
  • Verify that the Imaging server is functioning properly in its new entity.

9. Summary of commands

Action Command
Download the script wget https://dl.medulla-tech.io/ma/change_entite_imaging.sh
Make the script executable chmod +x change_entite_imaging.sh
View help sudo bash change_entite_imaging.sh --help
Run a simulation sudo bash change_entite_imaging.sh --dry-run
Change the entity sudo bash change_entite_imaging.sh
View the log sudo tail -n 50 /var/log/medulla_change_entite_imaging.log

Key point: Changing the entity of a Medulla Imaging server is a two-step process: first, run the script on the main server, then validate the new association in the Medulla interface.