diff --git a/cdist/conf/type/__lxc_container/gencode-remote b/cdist/conf/type/__lxc_container/gencode-remote index ddba593a..480d7d41 100755 --- a/cdist/conf/type/__lxc_container/gencode-remote +++ b/cdist/conf/type/__lxc_container/gencode-remote @@ -234,8 +234,55 @@ DONE rm -rf "$container_config" mv "\$tmpconfig" "$container_config" DONE - # write message echo "config" >> "$__messages_out" + + + # restart container only if it is running + # do not echo messages start/stop or melt/start/stop/freeze; only restart to avoid junk + case "$state_is" in + running|frozen) + # only do it if the container will run again + case "$state_should" in + present|running|frozen) + # su stuff + cat <> "$__messages_out" + fi + fi + + # ending + echo "restart" >> "$__messages_out" + echo "SU" + ;; + esac + ;; + esac fi diff --git a/cdist/conf/type/__lxc_container/man.rst b/cdist/conf/type/__lxc_container/man.rst index d0abf2e2..7d1f6522 100644 --- a/cdist/conf/type/__lxc_container/man.rst +++ b/cdist/conf/type/__lxc_container/man.rst @@ -70,7 +70,11 @@ config-absent BOOLEAN PARAMETERS ------------------ -None. + +restart-if-changed + Restarts the container if configuration changes. It stop and start the container that new configuration + can be applied. If it whould be restarted with ``lxc-stop -n $name --reboot``, configuration changes + would be ignored. CREATE PARAMETERS ----------------- diff --git a/cdist/conf/type/__lxc_container/parameter/boolean b/cdist/conf/type/__lxc_container/parameter/boolean index caf89a8e..724fa14b 100644 --- a/cdist/conf/type/__lxc_container/parameter/boolean +++ b/cdist/conf/type/__lxc_container/parameter/boolean @@ -1 +1,2 @@ no-default-config +restart-if-changed