Implement restart-policy handling. Closes #1734

Applications without a restart-policy will have their policies set to `on-failure:10`. Users can completely unset the restart-policy using the `docker-options` plugin, though this will be equivalent to setting it explicitly to `no`.

Restart policies must be explicitly set, and the following are all valid:

- no
- unless-stopped
- always
- on-failure
- on-failure:NUMBER
This commit is contained in:
Jose Diaz-Gonzalez
2016-07-02 17:17:17 -04:00
parent b4481cfd3a
commit 59c9207797
6 changed files with 98 additions and 0 deletions

View File

@@ -165,3 +165,15 @@ ps_scale() {
release_and_deploy "$APP" "$IMAGE_TAG"
fi
}
get_restart_policies() {
declare desc="strips docker options and prints restart policies"
local -r phase_file_path=$1
[[ -r "$phase_file_path" ]] && sed -e '/^--restart=/!d' -e 's/^--restart=/ /' < "$phase_file_path"
}
get_raw_restart_policies() {
declare desc="strips docker options and prints raw restart policies"
local -r phase_file_path=$1
[[ -r "$phase_file_path" ]] && sed -e '/^--restart=/!d' < "$phase_file_path"
}