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
e904705a
Commit
e904705a
authored
Jun 11, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer uses the new plugin client API
parent
88d50889
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
config.go
config.go
+13
-6
packer/plugin/client.go
packer/plugin/client.go
+1
-1
No files found.
config.go
View file @
e904705a
...
@@ -66,38 +66,45 @@ func (c *config) LoadBuilder(name string) (packer.Builder, error) {
...
@@ -66,38 +66,45 @@ func (c *config) LoadBuilder(name string) (packer.Builder, error) {
return
nil
,
nil
return
nil
,
nil
}
}
return
plugin
.
Builder
(
exec
.
Command
(
bin
)
)
return
c
.
pluginClient
(
bin
)
.
Builder
(
)
}
}
// This is a proper packer.CommandFunc that can be used to load packer.Command
// This is a proper packer.CommandFunc that can be used to load packer.Command
// implementations from the defined plugins.
// implementations from the defined plugins.
func
(
c
*
config
)
LoadCommand
(
name
string
)
(
packer
.
Command
,
error
)
{
func
(
c
*
config
)
LoadCommand
(
name
string
)
(
packer
.
Command
,
error
)
{
log
.
Printf
(
"Loading command: %s
\n
"
,
name
)
log
.
Printf
(
"Loading command: %s
\n
"
,
name
)
commandB
in
,
ok
:=
c
.
Commands
[
name
]
b
in
,
ok
:=
c
.
Commands
[
name
]
if
!
ok
{
if
!
ok
{
log
.
Printf
(
"Command not found: %s
\n
"
,
name
)
log
.
Printf
(
"Command not found: %s
\n
"
,
name
)
return
nil
,
nil
return
nil
,
nil
}
}
return
plugin
.
Command
(
exec
.
Command
(
commandBin
)
)
return
c
.
pluginClient
(
bin
)
.
Command
(
)
}
}
// This is a proper implementation of packer.HookFunc that can be used
// This is a proper implementation of packer.HookFunc that can be used
// to load packer.Hook implementations from the defined plugins.
// to load packer.Hook implementations from the defined plugins.
func
(
c
*
config
)
LoadHook
(
name
string
)
(
packer
.
Hook
,
error
)
{
func
(
c
*
config
)
LoadHook
(
name
string
)
(
packer
.
Hook
,
error
)
{
log
.
Printf
(
"Loading hook: %s
\n
"
,
name
)
log
.
Printf
(
"Loading hook: %s
\n
"
,
name
)
return
plugin
.
Hook
(
exec
.
Command
(
name
)
)
return
c
.
pluginClient
(
name
)
.
Hook
(
)
}
}
// This is a proper packer.ProvisionerFunc that can be used to load
// This is a proper packer.ProvisionerFunc that can be used to load
// packer.Provisioner implementations from defined plugins.
// packer.Provisioner implementations from defined plugins.
func
(
c
*
config
)
LoadProvisioner
(
name
string
)
(
packer
.
Provisioner
,
error
)
{
func
(
c
*
config
)
LoadProvisioner
(
name
string
)
(
packer
.
Provisioner
,
error
)
{
log
.
Printf
(
"Loading provisioner: %s
\n
"
,
name
)
log
.
Printf
(
"Loading provisioner: %s
\n
"
,
name
)
provB
in
,
ok
:=
c
.
Provisioners
[
name
]
b
in
,
ok
:=
c
.
Provisioners
[
name
]
if
!
ok
{
if
!
ok
{
log
.
Printf
(
"Provisioner not found: %s
\n
"
,
name
)
log
.
Printf
(
"Provisioner not found: %s
\n
"
,
name
)
return
nil
,
nil
return
nil
,
nil
}
}
return
plugin
.
Provisioner
(
exec
.
Command
(
provBin
))
return
c
.
pluginClient
(
bin
)
.
Provisioner
()
}
func
(
c
*
config
)
pluginClient
(
path
string
)
*
plugin
.
Client
{
var
config
plugin
.
ClientConfig
config
.
Cmd
=
exec
.
Command
(
path
)
config
.
Managed
=
true
return
plugin
.
NewClient
(
&
config
)
}
}
packer/plugin/client.go
View file @
e904705a
...
@@ -42,7 +42,7 @@ type ClientConfig struct {
...
@@ -42,7 +42,7 @@ type ClientConfig struct {
// plugin package or not. If true, then by calling CleanupClients,
// plugin package or not. If true, then by calling CleanupClients,
// it will automatically be cleaned up. Otherwise, the client
// it will automatically be cleaned up. Otherwise, the client
// user is fully responsible for making sure to Kill all plugin
// user is fully responsible for making sure to Kill all plugin
// clients.
// clients.
By default the client is _not_ managed.
Managed
bool
Managed
bool
// The minimum and maximum port to use for communicating with
// The minimum and maximum port to use for communicating with
...
...
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