10.2. Restore
rhc snapshot restore command, OpenShift Enterprise restores the application from an archive in the following steps:
- Prepares the application for restoration.
- If the archive contains a Git repository, OpenShift Enterprise runs the
gear pre-receivecommand. - If the archive does not contain a Git repository, OpenShift Enterprise runs the
gear stopcommand.
- Runs the
control pre-restorecommand for each cartridge on the gear. This enables you to control the restoration of your cartridge, for example by deleting an old database dump. - Builds a list of file name changes to apply during the restoration from the
restore_transformsentry in the$cartridge_name/metadata/managed_files.ymlfile for each cartridge on the gear. - Extracts the archive into the gear user's home directory, overwriting existing files and applying the file name changes listed in the
restore_transformsentry in themanaged_files.ymlfile. - Runs the
control post-restorecommand for each cartridge on the gear. Use this script to load a database flat file into the running database. - Resumes the application.
- If the archive contains a Git repository, OpenShift Enterprise runs the
gear postreceivecommand. - If the archive does not contain a Git repository, OpenShift Enterprise runs the
gear startcommand.
- Will either stop or start the gear based on the state of the application before restoring.
Use the optional restore_transforms entry in the $cartridge_name/metadata/managed_files.yml file to provide scripts that transform file names when OpenShift Enterprise restores an application. This entry enables you to restore older snapshots to a newer cartridge with file name changes.
Example 10.2. restore_transforms Entry
restore_transforms:
- s|${OPENSHIFT_GEAR_NAME}/data|app-root/data|
tar command when restoring a gear. See the tar man page --transform option for more information.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.