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
9c89e33b
Commit
9c89e33b
authored
Jun 18, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer/rpc: Get RPC compliant with Environment again
parent
d95f0a62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
packer/rpc/environment.go
packer/rpc/environment.go
+28
-0
packer/rpc/environment_test.go
packer/rpc/environment_test.go
+8
-0
No files found.
packer/rpc/environment.go
View file @
9c89e33b
...
@@ -73,6 +73,22 @@ func (e *Environment) Hook(name string) (h packer.Hook, err error) {
...
@@ -73,6 +73,22 @@ func (e *Environment) Hook(name string) (h packer.Hook, err error) {
return
return
}
}
func
(
e
*
Environment
)
PostProcessor
(
name
string
)
(
p
packer
.
PostProcessor
,
err
error
)
{
var
reply
string
err
=
e
.
client
.
Call
(
"Environment.PostProcessor"
,
name
,
&
reply
)
if
err
!=
nil
{
return
}
_
,
err
=
rpc
.
Dial
(
"tcp"
,
reply
)
if
err
!=
nil
{
return
}
p
=
nil
return
}
func
(
e
*
Environment
)
Provisioner
(
name
string
)
(
p
packer
.
Provisioner
,
err
error
)
{
func
(
e
*
Environment
)
Provisioner
(
name
string
)
(
p
packer
.
Provisioner
,
err
error
)
{
var
reply
string
var
reply
string
err
=
e
.
client
.
Call
(
"Environment.Provisioner"
,
name
,
&
reply
)
err
=
e
.
client
.
Call
(
"Environment.Provisioner"
,
name
,
&
reply
)
...
@@ -143,6 +159,18 @@ func (e *EnvironmentServer) Hook(name *string, reply *string) error {
...
@@ -143,6 +159,18 @@ func (e *EnvironmentServer) Hook(name *string, reply *string) error {
return
nil
return
nil
}
}
func
(
e
*
EnvironmentServer
)
PostProcessor
(
name
*
string
,
reply
*
string
)
error
{
_
,
err
:=
e
.
env
.
PostProcessor
(
*
name
)
if
err
!=
nil
{
return
err
}
server
:=
rpc
.
NewServer
()
*
reply
=
serveSingleConn
(
server
)
return
nil
}
func
(
e
*
EnvironmentServer
)
Provisioner
(
name
*
string
,
reply
*
string
)
error
{
func
(
e
*
EnvironmentServer
)
Provisioner
(
name
*
string
,
reply
*
string
)
error
{
prov
,
err
:=
e
.
env
.
Provisioner
(
*
name
)
prov
,
err
:=
e
.
env
.
Provisioner
(
*
name
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
packer/rpc/environment_test.go
View file @
9c89e33b
...
@@ -18,6 +18,8 @@ type testEnvironment struct {
...
@@ -18,6 +18,8 @@ type testEnvironment struct {
cliArgs
[]
string
cliArgs
[]
string
hookCalled
bool
hookCalled
bool
hookName
string
hookName
string
ppCalled
bool
ppName
string
provCalled
bool
provCalled
bool
provName
string
provName
string
uiCalled
bool
uiCalled
bool
...
@@ -45,6 +47,12 @@ func (e *testEnvironment) Hook(name string) (packer.Hook, error) {
...
@@ -45,6 +47,12 @@ func (e *testEnvironment) Hook(name string) (packer.Hook, error) {
return
nil
,
nil
return
nil
,
nil
}
}
func
(
e
*
testEnvironment
)
PostProcessor
(
name
string
)
(
packer
.
PostProcessor
,
error
)
{
e
.
ppCalled
=
true
e
.
ppName
=
name
return
nil
,
nil
}
func
(
e
*
testEnvironment
)
Provisioner
(
name
string
)
(
packer
.
Provisioner
,
error
)
{
func
(
e
*
testEnvironment
)
Provisioner
(
name
string
)
(
packer
.
Provisioner
,
error
)
{
e
.
provCalled
=
true
e
.
provCalled
=
true
e
.
provName
=
name
e
.
provName
=
name
...
...
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