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
76ab8709
Commit
76ab8709
authored
Jun 18, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: PostProcessor takes a UI [GH-20]
parent
73cb1a3f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
10 deletions
+16
-10
packer/build.go
packer/build.go
+1
-1
packer/plugin/post_processor.go
packer/plugin/post_processor.go
+2
-2
packer/plugin/post_processor_test.go
packer/plugin/post_processor_test.go
+1
-1
packer/post_processor.go
packer/post_processor.go
+1
-1
packer/post_processor_test.go
packer/post_processor_test.go
+3
-1
packer/rpc/post_processor.go
packer/rpc/post_processor.go
+3
-2
packer/rpc/post_processor_test.go
packer/rpc/post_processor_test.go
+5
-2
No files found.
packer/build.go
View file @
76ab8709
...
@@ -169,7 +169,7 @@ PostProcessorRunSeqLoop:
...
@@ -169,7 +169,7 @@ PostProcessorRunSeqLoop:
artifact
:=
builderArtifact
artifact
:=
builderArtifact
for
_
,
corePP
:=
range
ppSeq
{
for
_
,
corePP
:=
range
ppSeq
{
var
err
error
var
err
error
artifact
,
err
=
corePP
.
processor
.
PostProcess
(
artifact
)
artifact
,
err
=
corePP
.
processor
.
PostProcess
(
ui
,
artifact
)
if
err
!=
nil
{
if
err
!=
nil
{
errors
=
append
(
errors
,
fmt
.
Errorf
(
"Post-processor failed: %s"
,
err
))
errors
=
append
(
errors
,
fmt
.
Errorf
(
"Post-processor failed: %s"
,
err
))
continue
PostProcessorRunSeqLoop
continue
PostProcessorRunSeqLoop
...
...
packer/plugin/post_processor.go
View file @
76ab8709
...
@@ -19,13 +19,13 @@ func (c *cmdPostProcessor) Configure(config interface{}) error {
...
@@ -19,13 +19,13 @@ func (c *cmdPostProcessor) Configure(config interface{}) error {
return
c
.
p
.
Configure
(
config
)
return
c
.
p
.
Configure
(
config
)
}
}
func
(
c
*
cmdPostProcessor
)
PostProcess
(
a
packer
.
Artifact
)
(
packer
.
Artifact
,
error
)
{
func
(
c
*
cmdPostProcessor
)
PostProcess
(
ui
packer
.
Ui
,
a
packer
.
Artifact
)
(
packer
.
Artifact
,
error
)
{
defer
func
()
{
defer
func
()
{
r
:=
recover
()
r
:=
recover
()
c
.
checkExit
(
r
,
nil
)
c
.
checkExit
(
r
,
nil
)
}()
}()
return
c
.
p
.
PostProcess
(
a
)
return
c
.
p
.
PostProcess
(
ui
,
a
)
}
}
func
(
c
*
cmdPostProcessor
)
checkExit
(
p
interface
{},
cb
func
())
{
func
(
c
*
cmdPostProcessor
)
checkExit
(
p
interface
{},
cb
func
())
{
...
...
packer/plugin/post_processor_test.go
View file @
76ab8709
...
@@ -12,7 +12,7 @@ func (helperPostProcessor) Configure(interface{}) error {
...
@@ -12,7 +12,7 @@ func (helperPostProcessor) Configure(interface{}) error {
return
nil
return
nil
}
}
func
(
helperPostProcessor
)
PostProcess
(
packer
.
Artifact
)
(
packer
.
Artifact
,
error
)
{
func
(
helperPostProcessor
)
PostProcess
(
packer
.
Ui
,
packer
.
Artifact
)
(
packer
.
Artifact
,
error
)
{
return
nil
,
nil
return
nil
,
nil
}
}
...
...
packer/post_processor.go
View file @
76ab8709
...
@@ -13,5 +13,5 @@ type PostProcessor interface {
...
@@ -13,5 +13,5 @@ type PostProcessor interface {
// PostProcess takes a previously created Artifact and produces another
// PostProcess takes a previously created Artifact and produces another
// Artifact. If an error occurs, it should return that error.
// Artifact. If an error occurs, it should return that error.
PostProcess
(
Artifact
)
(
Artifact
,
error
)
PostProcess
(
Ui
,
Artifact
)
(
Artifact
,
error
)
}
}
packer/post_processor_test.go
View file @
76ab8709
...
@@ -5,6 +5,7 @@ type TestPostProcessor struct {
...
@@ -5,6 +5,7 @@ type TestPostProcessor struct {
configVal
interface
{}
configVal
interface
{}
ppCalled
bool
ppCalled
bool
ppArtifact
Artifact
ppArtifact
Artifact
ppUi
Ui
}
}
func
(
pp
*
TestPostProcessor
)
Configure
(
v
interface
{})
error
{
func
(
pp
*
TestPostProcessor
)
Configure
(
v
interface
{})
error
{
...
@@ -13,8 +14,9 @@ func (pp *TestPostProcessor) Configure(v interface{}) error {
...
@@ -13,8 +14,9 @@ func (pp *TestPostProcessor) Configure(v interface{}) error {
return
nil
return
nil
}
}
func
(
pp
*
TestPostProcessor
)
PostProcess
(
a
Artifact
)
(
Artifact
,
error
)
{
func
(
pp
*
TestPostProcessor
)
PostProcess
(
ui
Ui
,
a
Artifact
)
(
Artifact
,
error
)
{
pp
.
ppCalled
=
true
pp
.
ppCalled
=
true
pp
.
ppArtifact
=
a
pp
.
ppArtifact
=
a
pp
.
ppUi
=
ui
return
nil
,
nil
return
nil
,
nil
}
}
packer/rpc/post_processor.go
View file @
76ab8709
...
@@ -33,9 +33,10 @@ func (p *postProcessor) Configure(raw interface{}) (err error) {
...
@@ -33,9 +33,10 @@ func (p *postProcessor) Configure(raw interface{}) (err error) {
return
return
}
}
func
(
p
*
postProcessor
)
PostProcess
(
a
packer
.
Artifact
)
(
packer
.
Artifact
,
error
)
{
func
(
p
*
postProcessor
)
PostProcess
(
ui
packer
.
Ui
,
a
packer
.
Artifact
)
(
packer
.
Artifact
,
error
)
{
server
:=
rpc
.
NewServer
()
server
:=
rpc
.
NewServer
()
RegisterArtifact
(
server
,
a
)
RegisterArtifact
(
server
,
a
)
RegisterUi
(
server
,
ui
)
var
response
PostProcessorProcessResponse
var
response
PostProcessorProcessResponse
if
err
:=
p
.
client
.
Call
(
"PostProcessor.PostProcess"
,
serveSingleConn
(
server
),
&
response
);
err
!=
nil
{
if
err
:=
p
.
client
.
Call
(
"PostProcessor.PostProcess"
,
serveSingleConn
(
server
),
&
response
);
err
!=
nil
{
...
@@ -71,7 +72,7 @@ func (p *PostProcessorServer) PostProcess(address string, reply *PostProcessorPr
...
@@ -71,7 +72,7 @@ func (p *PostProcessorServer) PostProcess(address string, reply *PostProcessorPr
responseAddress
:=
""
responseAddress
:=
""
artifact
,
err
:=
p
.
p
.
PostProcess
(
Artifact
(
client
))
artifact
,
err
:=
p
.
p
.
PostProcess
(
&
Ui
{
client
},
Artifact
(
client
))
if
err
==
nil
&&
artifact
!=
nil
{
if
err
==
nil
&&
artifact
!=
nil
{
server
:=
rpc
.
NewServer
()
server
:=
rpc
.
NewServer
()
RegisterArtifact
(
server
,
artifact
)
RegisterArtifact
(
server
,
artifact
)
...
...
packer/rpc/post_processor_test.go
View file @
76ab8709
...
@@ -13,6 +13,7 @@ type TestPostProcessor struct {
...
@@ -13,6 +13,7 @@ type TestPostProcessor struct {
configVal
interface
{}
configVal
interface
{}
ppCalled
bool
ppCalled
bool
ppArtifact
packer
.
Artifact
ppArtifact
packer
.
Artifact
ppUi
packer
.
Ui
}
}
func
(
pp
*
TestPostProcessor
)
Configure
(
v
interface
{})
error
{
func
(
pp
*
TestPostProcessor
)
Configure
(
v
interface
{})
error
{
...
@@ -21,9 +22,10 @@ func (pp *TestPostProcessor) Configure(v interface{}) error {
...
@@ -21,9 +22,10 @@ func (pp *TestPostProcessor) Configure(v interface{}) error {
return
nil
return
nil
}
}
func
(
pp
*
TestPostProcessor
)
PostProcess
(
a
packer
.
Artifact
)
(
packer
.
Artifact
,
error
)
{
func
(
pp
*
TestPostProcessor
)
PostProcess
(
ui
packer
.
Ui
,
a
packer
.
Artifact
)
(
packer
.
Artifact
,
error
)
{
pp
.
ppCalled
=
true
pp
.
ppCalled
=
true
pp
.
ppArtifact
=
a
pp
.
ppArtifact
=
a
pp
.
ppUi
=
ui
return
testPostProcessorArtifact
,
nil
return
testPostProcessorArtifact
,
nil
}
}
...
@@ -60,7 +62,8 @@ func TestPostProcessorRPC(t *testing.T) {
...
@@ -60,7 +62,8 @@ func TestPostProcessorRPC(t *testing.T) {
// Test PostProcess
// Test PostProcess
a
:=
new
(
testArtifact
)
a
:=
new
(
testArtifact
)
artifact
,
err
:=
pClient
.
PostProcess
(
a
)
ui
:=
new
(
testUi
)
artifact
,
err
:=
pClient
.
PostProcess
(
ui
,
a
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
t
.
Fatalf
(
"err: %s"
,
err
)
}
}
...
...
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