mirror of https://github.com/portainer/portainer
feat(templates): add support for a restart_policy field (#898)
parent
42d28db47a
commit
bde9dd8b88
|
@ -11,8 +11,9 @@ function TemplateViewModel(data) {
|
||||||
this.Network = data.network ? data.network : '';
|
this.Network = data.network ? data.network : '';
|
||||||
this.Env = data.env ? data.env : [];
|
this.Env = data.env ? data.env : [];
|
||||||
this.Privileged = data.privileged ? data.privileged : false;
|
this.Privileged = data.privileged ? data.privileged : false;
|
||||||
this.Volumes = [];
|
|
||||||
this.Interactive = data.interactive ? data.interactive : false;
|
this.Interactive = data.interactive ? data.interactive : false;
|
||||||
|
this.RestartPolicy = data.restart_policy ? data.restart_policy : 'always';
|
||||||
|
this.Volumes = [];
|
||||||
if (data.volumes) {
|
if (data.volumes) {
|
||||||
this.Volumes = data.volumes.map(function (v) {
|
this.Volumes = data.volumes.map(function (v) {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -10,6 +10,8 @@ function TemplateLSIOViewModel(data) {
|
||||||
this.Network = data.network ? data.network : '';
|
this.Network = data.network ? data.network : '';
|
||||||
this.Env = data.env ? data.env : [];
|
this.Env = data.env ? data.env : [];
|
||||||
this.Privileged = data.privileged ? data.privileged : false;
|
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 = [];
|
this.Volumes = [];
|
||||||
if (data.volumes) {
|
if (data.volumes) {
|
||||||
this.Volumes = data.volumes.map(function (v) {
|
this.Volumes = data.volumes.map(function (v) {
|
||||||
|
|
|
@ -39,6 +39,7 @@ angular.module('portainer.services')
|
||||||
var configuration = TemplateHelper.getDefaultContainerConfiguration();
|
var configuration = TemplateHelper.getDefaultContainerConfiguration();
|
||||||
configuration.HostConfig.NetworkMode = network.Name;
|
configuration.HostConfig.NetworkMode = network.Name;
|
||||||
configuration.HostConfig.Privileged = template.Privileged;
|
configuration.HostConfig.Privileged = template.Privileged;
|
||||||
|
configuration.HostConfig.RestartPolicy = { Name: template.RestartPolicy };
|
||||||
configuration.name = containerName;
|
configuration.name = containerName;
|
||||||
configuration.Image = template.Image;
|
configuration.Image = template.Image;
|
||||||
configuration.Env = TemplateHelper.EnvToStringArray(template.Env, containerMapping);
|
configuration.Env = TemplateHelper.EnvToStringArray(template.Env, containerMapping);
|
||||||
|
|
Loading…
Reference in New Issue