From ce32ed5b9808318b57cae3ce406d06ed154e82c9 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Sun, 25 Dec 2016 22:14:26 +1300 Subject: [PATCH] fix(service-creation): fix the command specification and add the ability to specify an entrypoint (#409) --- .../createService/createServiceController.js | 13 ++++++++++++- app/components/createService/createservice.html | 8 ++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/components/createService/createServiceController.js b/app/components/createService/createServiceController.js index 4797ae3b3..061b4c6c5 100644 --- a/app/components/createService/createServiceController.js +++ b/app/components/createService/createServiceController.js @@ -9,6 +9,7 @@ function ($scope, $state, Service, Volume, Network, ImageHelper, Messages) { Mode: 'replicated', Replicas: 1, Command: '', + EntryPoint: '', WorkingDir: '', User: '', Env: [], @@ -93,9 +94,19 @@ function ($scope, $state, Service, Volume, Network, ImageHelper, Messages) { } } + function commandToArray(cmd) { + var tokens = [].concat.apply([], cmd.split('"').map(function(v,i) { + return i%2 ? v : v.split(' '); + })).filter(Boolean); + return tokens; + } + function prepareCommandConfig(config, input) { + if (input.EntryPoint) { + config.TaskTemplate.ContainerSpec.Command = commandToArray(input.EntryPoint); + } if (input.Command) { - config.TaskTemplate.ContainerSpec.Command = _.split(input.Command, ' '); + config.TaskTemplate.ContainerSpec.Args = commandToArray(input.Command); } if (input.User) { config.TaskTemplate.ContainerSpec.User = input.User; diff --git a/app/components/createService/createservice.html b/app/components/createService/createservice.html index a1d017fd8..6b9e02ed2 100644 --- a/app/components/createService/createservice.html +++ b/app/components/createService/createservice.html @@ -116,6 +116,14 @@ + +
+ +
+ +
+
+