[error]
input:
submit docker_image=centos:7 job.yaml
output:
docker_image: centos
[why]
submit split centos:7 to [centos, 7]
[how]
-s "docker_image: centos:7" ==> docker_image: centos:7
docker_image=centos:7 ==> docker_image: centos:7
Signed-off-by: Wei Jihui <weijihuiall(a)163.com>
---
sbin/submit | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sbin/submit b/sbin/submit
index e5e41828..feb65d00 100755
--- a/sbin/submit
+++ b/sbin/submit
@@ -28,7 +28,7 @@ options = OptionParser.new do |opts|
opts.separator 'options:'
opts.on("-s 'KEY: VALUE'", "--set 'KEY: VALUE'", 'add YAML hash to job') do |key_value|
- k, v = key_value.sub(' ', '').split(':')
+ k, v = key_value.sub(' ', '').split(':', 2)
opt_set_key_value[k] = v
end
@@ -59,7 +59,7 @@ options = OptionParser.new do |opts|
opts.on('-m', '--monitor', "monitor job status: use -m 'KEY: VALUE' to add rule") do
opt_monitor = true
- k, v = ARGV[0].sub(' ', '').split(':') if ARGV[0]
+ k, v = ARGV[0].sub(' ', '').split(':', 2) if ARGV[0]
if (k && !k.empty?) && (v && !v.empty?)
opt_monitor_query[k] = v
ARGV.shift
@@ -78,7 +78,7 @@ options.parse!(ARGV)
seen_job_yaml = false
ARGV.delete_if do |arg|
if arg.index '='
- k, v = arg.sub(' ', '').sub(/=/, ':').split(':')
+ k, v = arg.sub(' ', '').split('=', 2)
if seen_job_yaml
opt_set_key_value[k] = v
else
--
2.23.0