diff --git a/Makefile b/Makefile index 7b6cc43..488e942 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ init-exporter-converter: deps: go get -d -v pkg.re/check.v1 - go get -d -v pkg.re/essentialkaos/ek.v7 + go get -d -v pkg.re/essentialkaos/ek.v8 go get -d -v pkg.re/essentialkaos/go-simpleyaml.v1 go get -d -v pkg.re/yaml.v2 diff --git a/cli/cli.go b/cli/cli.go index 55690ea..6f52512 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -11,15 +11,15 @@ import ( "os" "runtime" - "pkg.re/essentialkaos/ek.v7/arg" - "pkg.re/essentialkaos/ek.v7/env" - "pkg.re/essentialkaos/ek.v7/fmtc" - "pkg.re/essentialkaos/ek.v7/fsutil" - "pkg.re/essentialkaos/ek.v7/knf" - "pkg.re/essentialkaos/ek.v7/log" - "pkg.re/essentialkaos/ek.v7/system" - "pkg.re/essentialkaos/ek.v7/usage" - "pkg.re/essentialkaos/ek.v7/usage/update" + "pkg.re/essentialkaos/ek.v8/arg" + "pkg.re/essentialkaos/ek.v8/env" + "pkg.re/essentialkaos/ek.v8/fmtc" + "pkg.re/essentialkaos/ek.v8/fsutil" + "pkg.re/essentialkaos/ek.v8/knf" + "pkg.re/essentialkaos/ek.v8/log" + "pkg.re/essentialkaos/ek.v8/system" + "pkg.re/essentialkaos/ek.v8/usage" + "pkg.re/essentialkaos/ek.v8/usage/update" "github.com/funbox/init-exporter/export" "github.com/funbox/init-exporter/procfile" @@ -30,7 +30,7 @@ import ( // App props const ( APP = "init-exporter" - VER = "0.12.3" + VER = "0.13.0" DESC = "Utility for exporting services described by Procfile to init system" ) diff --git a/common/init-exporter.spec b/common/init-exporter.spec index 0432c0e..577cb58 100644 --- a/common/init-exporter.spec +++ b/common/init-exporter.spec @@ -42,7 +42,7 @@ Summary: Utility for exporting services described by Procfile to init system Name: init-exporter -Version: 0.12.3 +Version: 0.13.0 Release: 0%{?dist} Group: Development/Tools License: MIT @@ -69,7 +69,7 @@ Utility for exporting services described by Procfile to init system. %package converter Summary: Utility for converting procfiles from v1 to v2 format -Version: 0.4.0 +Version: 0.5.0 Release: 0%{?dist} %description converter @@ -132,6 +132,10 @@ rm -rf %{buildroot} ############################################################################### %changelog +* Mon Apr 24 2017 Anton Novojilov - 0.13.0-0 +- ek package updated to v8 +- Improved v2 format validation + * Mon Apr 17 2017 Anton Novojilov - 0.12.3-0 - Fixed typo in uninstall option name diff --git a/converter/converter.go b/converter/converter.go index 06d139e..55859d9 100644 --- a/converter/converter.go +++ b/converter/converter.go @@ -13,10 +13,10 @@ import ( "runtime" "text/template" - "pkg.re/essentialkaos/ek.v7/arg" - "pkg.re/essentialkaos/ek.v7/fmtc" - "pkg.re/essentialkaos/ek.v7/knf" - "pkg.re/essentialkaos/ek.v7/usage" + "pkg.re/essentialkaos/ek.v8/arg" + "pkg.re/essentialkaos/ek.v8/fmtc" + "pkg.re/essentialkaos/ek.v8/knf" + "pkg.re/essentialkaos/ek.v8/usage" "github.com/funbox/init-exporter/procfile" ) @@ -26,7 +26,7 @@ import ( // App props const ( APP = "init-exporter-converter" - VER = "0.4.0" + VER = "0.5.0" DESC = "Utility for converting procfiles from v1 to v2 format" ) diff --git a/export/export_test.go b/export/export_test.go index c51cb89..68edf00 100644 --- a/export/export_test.go +++ b/export/export_test.go @@ -15,8 +15,8 @@ import ( "github.com/funbox/init-exporter/procfile" - "pkg.re/essentialkaos/ek.v7/fsutil" - "pkg.re/essentialkaos/ek.v7/log" + "pkg.re/essentialkaos/ek.v8/fsutil" + "pkg.re/essentialkaos/ek.v8/log" . "pkg.re/check.v1" ) diff --git a/export/exporter.go b/export/exporter.go index 227f6a7..540418a 100644 --- a/export/exporter.go +++ b/export/exporter.go @@ -11,9 +11,9 @@ import ( "io/ioutil" "os" - "pkg.re/essentialkaos/ek.v7/fsutil" - "pkg.re/essentialkaos/ek.v7/log" - "pkg.re/essentialkaos/ek.v7/path" + "pkg.re/essentialkaos/ek.v8/fsutil" + "pkg.re/essentialkaos/ek.v8/log" + "pkg.re/essentialkaos/ek.v8/path" "github.com/funbox/init-exporter/procfile" ) diff --git a/export/provider.go b/export/provider.go index 8d99ff8..c8c13de 100644 --- a/export/provider.go +++ b/export/provider.go @@ -11,7 +11,7 @@ import ( "fmt" "text/template" - "pkg.re/essentialkaos/ek.v7/log" + "pkg.re/essentialkaos/ek.v8/log" "github.com/funbox/init-exporter/procfile" ) diff --git a/export/systemd.go b/export/systemd.go index 8d5e44d..cc5c78a 100644 --- a/export/systemd.go +++ b/export/systemd.go @@ -10,8 +10,8 @@ import ( "strings" "time" - "pkg.re/essentialkaos/ek.v7/system" - "pkg.re/essentialkaos/ek.v7/timeutil" + "pkg.re/essentialkaos/ek.v8/system/exec" + "pkg.re/essentialkaos/ek.v8/timeutil" "github.com/funbox/init-exporter/procfile" ) @@ -123,12 +123,12 @@ func (sp *SystemdProvider) UnitName(name string) string { // EnableService enable service with given name func (sp *SystemdProvider) EnableService(appName string) error { - return system.Exec("systemctl", "enable", sp.UnitName(appName)) + return exec.Run("systemctl", "enable", sp.UnitName(appName)) } // DisableService disable service with given name func (sp *SystemdProvider) DisableService(appName string) error { - return system.Exec("systemctl", "disable", sp.UnitName(appName)) + return exec.Run("systemctl", "disable", sp.UnitName(appName)) } // RenderAppTemplate render unit template data with given app data and return diff --git a/export/upstart.go b/export/upstart.go index de429f3..8331e42 100644 --- a/export/upstart.go +++ b/export/upstart.go @@ -10,7 +10,7 @@ import ( "fmt" "time" - "pkg.re/essentialkaos/ek.v7/timeutil" + "pkg.re/essentialkaos/ek.v8/timeutil" "github.com/funbox/init-exporter/procfile" ) diff --git a/procfile/procfile.go b/procfile/procfile.go index 78e2d3c..3285864 100644 --- a/procfile/procfile.go +++ b/procfile/procfile.go @@ -13,10 +13,10 @@ import ( "sort" "strings" - "pkg.re/essentialkaos/ek.v7/errutil" - "pkg.re/essentialkaos/ek.v7/fsutil" - "pkg.re/essentialkaos/ek.v7/log" - "pkg.re/essentialkaos/ek.v7/path" + "pkg.re/essentialkaos/ek.v8/errutil" + "pkg.re/essentialkaos/ek.v8/fsutil" + "pkg.re/essentialkaos/ek.v8/log" + "pkg.re/essentialkaos/ek.v8/path" ) // ////////////////////////////////////////////////////////////////////////////////// // @@ -25,7 +25,7 @@ const ( REGEXP_V1_LINE = `^([A-z\d_]+):\s*(.+)` REGEXP_V2_VERSION = `(?m)^\s*version:\s*2\s*$` REGEXP_PATH_CHECK = `\A[A-Za-z0-9_\-./]+\z` - REGEXP_VALUE_CHECK = `\A[A-Za-z0-9_\-.,+/:;${}" =]+\z` + REGEXP_VALUE_CHECK = `\A[A-Za-z0-9_\-.,+/:;${}"' =]+\z` ) // ////////////////////////////////////////////////////////////////////////////////// // @@ -455,8 +455,10 @@ func checkEnv(name, value string) error { return fmt.Errorf("Environment variable %s has empty value", name) } - if strings.Contains(value, " ") && !strings.Contains(value, "\"") { - return fmt.Errorf("Environment variable %s has unquoted value with spaces", name) + if strings.Contains(value, " ") { + if !strings.Contains(value, "\"") && !strings.Contains(value, "'") { + return fmt.Errorf("Environment variable %s has unquoted value with spaces", name) + } } if !regexp.MustCompile(REGEXP_VALUE_CHECK).MatchString(name) { diff --git a/procfile/procfile_test.go b/procfile/procfile_test.go index ebcba0c..6affdfe 100644 --- a/procfile/procfile_test.go +++ b/procfile/procfile_test.go @@ -98,9 +98,10 @@ func (s *ProcfileSuite) TestProcV2Parsing(c *C) { c.Assert(service.Options.Env["RAILS_ENV"], Equals, "staging") c.Assert(service.Options.Env["TEST"], Equals, "true") c.Assert(service.Options.Env["JAVA_OPTS"], Equals, "\"${JAVA_OPTS} -Xms512m -Xmx1g -XX:+HeapDumpOnIutOfMemoryError -Djava.net.preferIPv4Stack=true\"") + c.Assert(service.Options.Env["AUX_OPTS"], Equals, "'--debug --native'") c.Assert(service.Options.Env["QUEUE"], Equals, "log_syncronizer,file_downloader,log_searcher") c.Assert(service.Options.Env["LC_ALL"], Equals, "en_US.UTF-8") - c.Assert(service.Options.EnvString(), Equals, "HEX_HOME=/srv/projects/ploy/shared/tmp JAVA_OPTS=\"${JAVA_OPTS} -Xms512m -Xmx1g -XX:+HeapDumpOnIutOfMemoryError -Djava.net.preferIPv4Stack=true\" LC_ALL=en_US.UTF-8 QUEUE=log_syncronizer,file_downloader,log_searcher RAILS_ENV=staging TEST=true") + c.Assert(service.Options.EnvString(), Equals, "AUX_OPTS='--debug --native' HEX_HOME=/srv/projects/ploy/shared/tmp JAVA_OPTS=\"${JAVA_OPTS} -Xms512m -Xmx1g -XX:+HeapDumpOnIutOfMemoryError -Djava.net.preferIPv4Stack=true\" LC_ALL=en_US.UTF-8 QUEUE=log_syncronizer,file_downloader,log_searcher RAILS_ENV=staging TEST=true") c.Assert(service.Options.LimitFile, Equals, 4096) c.Assert(service.Options.LimitProc, Equals, 4096) c.Assert(service.Application, NotNil) diff --git a/procfile/procfile_v1.go b/procfile/procfile_v1.go index 21927bd..308f26d 100644 --- a/procfile/procfile_v1.go +++ b/procfile/procfile_v1.go @@ -13,7 +13,7 @@ import ( "regexp" "strings" - "pkg.re/essentialkaos/ek.v7/log" + "pkg.re/essentialkaos/ek.v8/log" ) // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/procfile/procfile_v2.go b/procfile/procfile_v2.go index da3e170..232f8a6 100644 --- a/procfile/procfile_v2.go +++ b/procfile/procfile_v2.go @@ -9,7 +9,7 @@ package procfile import ( "fmt" - "pkg.re/essentialkaos/ek.v7/log" + "pkg.re/essentialkaos/ek.v8/log" "pkg.re/essentialkaos/go-simpleyaml.v1" ) diff --git a/testdata/procfile_v2 b/testdata/procfile_v2 index f0b79a2..276cde7 100644 --- a/testdata/procfile_v2 +++ b/testdata/procfile_v2 @@ -26,6 +26,7 @@ commands: env: RAILS_ENV: staging # if needs to be redefined or extended JAVA_OPTS: '"${JAVA_OPTS} -Xms512m -Xmx1g -XX:+HeapDumpOnIutOfMemoryError -Djava.net.preferIPv4Stack=true"' + AUX_OPTS: "'--debug --native'" QUEUE: log_syncronizer,file_downloader,log_searcher HEX_HOME: /srv/projects/ploy/shared/tmp LC_ALL: "en_US.UTF-8"