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
540fac64
Commit
540fac64
authored
Jun 18, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow post-processors in the core configuration
parent
e73c2247
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
3 deletions
+30
-3
config.go
config.go
+17
-3
packer.go
packer.go
+1
-0
packer/plugin/client.go
packer/plugin/client.go
+12
-0
No files found.
config.go
View file @
540fac64
...
@@ -40,9 +40,10 @@ type config struct {
...
@@ -40,9 +40,10 @@ type config struct {
PluginMinPort
uint
PluginMinPort
uint
PluginMaxPort
uint
PluginMaxPort
uint
Builders
map
[
string
]
string
Builders
map
[
string
]
string
Commands
map
[
string
]
string
Commands
map
[
string
]
string
Provisioners
map
[
string
]
string
PostProcessors
map
[
string
]
string
`json:"post-processors"`
Provisioners
map
[
string
]
string
}
}
// Decodes configuration in JSON format from the given io.Reader into
// Decodes configuration in JSON format from the given io.Reader into
...
@@ -94,6 +95,19 @@ func (c *config) LoadHook(name string) (packer.Hook, error) {
...
@@ -94,6 +95,19 @@ func (c *config) LoadHook(name string) (packer.Hook, error) {
return
c
.
pluginClient
(
name
)
.
Hook
()
return
c
.
pluginClient
(
name
)
.
Hook
()
}
}
// This is a proper packer.PostProcessorFunc that can be used to load
// packer.PostProcessor implementations from defined plugins.
func
(
c
*
config
)
LoadPostProcessor
(
name
string
)
(
packer
.
PostProcessor
,
error
)
{
log
.
Printf
(
"Loading post-processor: %s"
,
name
)
bin
,
ok
:=
c
.
PostProcessors
[
name
]
if
!
ok
{
log
.
Printf
(
"Post-processor not found: %s"
,
name
)
return
nil
,
nil
}
return
c
.
pluginClient
(
bin
)
.
PostProcessor
()
}
// 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
)
{
...
...
packer.go
View file @
540fac64
...
@@ -53,6 +53,7 @@ func main() {
...
@@ -53,6 +53,7 @@ func main() {
envConfig
.
Components
.
Builder
=
config
.
LoadBuilder
envConfig
.
Components
.
Builder
=
config
.
LoadBuilder
envConfig
.
Components
.
Command
=
config
.
LoadCommand
envConfig
.
Components
.
Command
=
config
.
LoadCommand
envConfig
.
Components
.
Hook
=
config
.
LoadHook
envConfig
.
Components
.
Hook
=
config
.
LoadHook
envConfig
.
Components
.
PostProcessor
=
config
.
LoadPostProcessor
envConfig
.
Components
.
Provisioner
=
config
.
LoadProvisioner
envConfig
.
Components
.
Provisioner
=
config
.
LoadProvisioner
env
,
err
:=
packer
.
NewEnvironment
(
envConfig
)
env
,
err
:=
packer
.
NewEnvironment
(
envConfig
)
...
...
packer/plugin/client.go
View file @
540fac64
...
@@ -140,6 +140,18 @@ func (c *Client) Hook() (packer.Hook, error) {
...
@@ -140,6 +140,18 @@ func (c *Client) Hook() (packer.Hook, error) {
return
&
cmdHook
{
packrpc
.
Hook
(
client
),
c
},
nil
return
&
cmdHook
{
packrpc
.
Hook
(
client
),
c
},
nil
}
}
// Returns a post-processor implementation that is communicating over
// this client. If the client hasn't been started, this will start it.
func
(
c
*
Client
)
PostProcessor
()
(
packer
.
PostProcessor
,
error
)
{
_
,
err
:=
c
.
rpcClient
()
if
err
!=
nil
{
return
nil
,
err
}
// TODO
return
nil
,
nil
}
// Returns a provisioner implementation that is communicating over this
// Returns a provisioner implementation that is communicating over this
// client. If the client hasn't been started, this will start it.
// client. If the client hasn't been started, this will start it.
func
(
c
*
Client
)
Provisioner
()
(
packer
.
Provisioner
,
error
)
{
func
(
c
*
Client
)
Provisioner
()
(
packer
.
Provisioner
,
error
)
{
...
...
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