Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
6cd0e7cb
Commit
6cd0e7cb
authored
Jun 17, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check same directory as `packer` for plugins.
parent
64f9173e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
config.go
config.go
+26
-0
No files found.
config.go
View file @
6cd0e7cb
...
...
@@ -2,11 +2,13 @@ package main
import
(
"encoding/json"
"github.com/mitchellh/osext"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer/plugin"
"io"
"log"
"os/exec"
"path/filepath"
)
// This is the default, built-in configuration that ships with
...
...
@@ -106,6 +108,30 @@ func (c *config) LoadProvisioner(name string) (packer.Provisioner, error) {
}
func
(
c
*
config
)
pluginClient
(
path
string
)
*
plugin
.
Client
{
originalPath
:=
path
// First attempt to find the executable by consulting the PATH.
path
,
err
:=
exec
.
LookPath
(
path
)
if
err
!=
nil
{
// If that doesn't work, look for it in the same directory
// as the `packer` executable (us).
log
.
Printf
(
"Plugin could not be found. Checking same directory as executable."
)
exePath
,
err
:=
osext
.
Executable
()
if
err
!=
nil
{
log
.
Printf
(
"Couldn't get current exe path: %s"
,
err
)
}
else
{
log
.
Printf
(
"Current exe path: %s"
,
exePath
)
path
=
filepath
.
Join
(
filepath
.
Dir
(
exePath
),
filepath
.
Base
(
originalPath
))
}
}
// If everything failed, just use the original path and let the error
// bubble through.
if
path
==
""
{
path
=
originalPath
}
log
.
Printf
(
"Creating plugin client for path: %s"
,
path
)
var
config
plugin
.
ClientConfig
config
.
Cmd
=
exec
.
Command
(
path
)
config
.
Managed
=
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment