Chapter 2. Managed Files

Managed files are files that have non-default settings, or that require special handling by OpenShift Enterprise.
The $cartridge_name/metadata/managed_files.yml file lists managed files and strings that OpenShift Enterprise uses during different stages of the cartridge life cycle.
File Patterns

Most entries in the managed_files.yml file use file patterns. OpenShift Enterprise treats these patterns like shell globs. Dir.glob processes entries that contain asterisk (*) symbols using the File::FNM_DOTMATCH flag. It treats entries that end in a forward slash (/) as directories, and other entries as files. For more information on globs, see http://ruby-doc.org/core-1.9.3/Dir.html#method-c-glob.

Entries that begin with ~/ start at the gear directory. All other entries start at the cartridge directory.
Strings

Some entries allow string values. These values return directly without any modification.

Allowed Entries

OpenShift Enterprise supports the following entries:

Table 2.1. Managed File Entries

Entry Type Usage Reference
locked_files File Pattern Files that the application developer can read but not update. Chapter 3, Locking Cartridges
snapshot_exclusions File Pattern Array of file names not to backup from the gear when rhc snapshot runs. Chapter 10, Backing Up and Restoring Cartridges
setup_rewritten File Pattern Files that OpenShift Enterprise removes before running setup. Section 6.2, “setup Script”
process_templates File Pattern ERB templates OpenShift Enterprise renders after running setup. Section 6.1, “Embedded Ruby (ERB) Processing”
restore_transforms Strings Set of regex transforms for rewriting file names when rhc restore runs. Chapter 10, Backing Up and Restoring Cartridges
The following example demonstrates the structure of a basic managed_files.yml file:

Example 2.1. managed_files.yml

locked_files:
- env/
- ~/.foorc
snapshot_exclusions:
- mydir/*
restore_transforms:
- s|${OPENSHIFT_GEAR_NAME}/data|app-root/data|
process_templates:
- **/*.erb
setup_rewritten:
- conf/*