Merge pull request #1293 from stevenh/resolve-initarg
Resolve InitArgs to ensure init works
This commit is contained in:
commit
be33383e60
|
@ -34,7 +34,15 @@ var (
|
||||||
// InitArgs returns an options func to configure a LinuxFactory with the
|
// InitArgs returns an options func to configure a LinuxFactory with the
|
||||||
// provided init binary path and arguments.
|
// provided init binary path and arguments.
|
||||||
func InitArgs(args ...string) func(*LinuxFactory) error {
|
func InitArgs(args ...string) func(*LinuxFactory) error {
|
||||||
return func(l *LinuxFactory) error {
|
return func(l *LinuxFactory) (err error) {
|
||||||
|
if len(args) > 0 {
|
||||||
|
// Resolve relative paths to ensure that its available
|
||||||
|
// after directory changes.
|
||||||
|
if args[0], err = filepath.Abs(args[0]); err != nil {
|
||||||
|
return newGenericError(err, ConfigInvalid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
l.InitArgs = args
|
l.InitArgs = args
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue