feat(templates): add support for a restart_policy field (#898)

pull/444/merge
Anthony Lapenna 2017-05-27 10:11:42 +02:00 committed by GitHub
parent 42d28db47a
commit bde9dd8b88
3 changed files with 5 additions and 1 deletions

View File

@ -11,8 +11,9 @@ function TemplateViewModel(data) {
this.Network = data.network ? data.network : '';
this.Env = data.env ? data.env : [];
this.Privileged = data.privileged ? data.privileged : false;
this.Volumes = [];
this.Interactive = data.interactive ? data.interactive : false;
this.RestartPolicy = data.restart_policy ? data.restart_policy : 'always';
this.Volumes = [];
if (data.volumes) {
this.Volumes = data.volumes.map(function (v) {
return {

View File

@ -10,6 +10,8 @@ function TemplateLSIOViewModel(data) {
this.Network = data.network ? data.network : '';
this.Env = data.env ? data.env : [];
this.Privileged = data.privileged ? data.privileged : false;
this.Interactive = data.interactive ? data.interactive : false;
this.RestartPolicy = data.restart_policy ? data.restart_policy : 'always';
this.Volumes = [];
if (data.volumes) {
this.Volumes = data.volumes.map(function (v) {

View File

@ -39,6 +39,7 @@ angular.module('portainer.services')
var configuration = TemplateHelper.getDefaultContainerConfiguration();
configuration.HostConfig.NetworkMode = network.Name;
configuration.HostConfig.Privileged = template.Privileged;
configuration.HostConfig.RestartPolicy = { Name: template.RestartPolicy };
configuration.name = containerName;
configuration.Image = template.Image;
configuration.Env = TemplateHelper.EnvToStringArray(template.Env, containerMapping);