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
44bd56c3
Commit
44bd56c3
authored
May 10, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go fmt
parent
368ccab8
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
53 additions
and
58 deletions
+53
-58
builder/amazonebs/builder.go
builder/amazonebs/builder.go
+4
-4
builder/amazonebs/builder_test.go
builder/amazonebs/builder_test.go
+2
-2
command/build/command_test.go
command/build/command_test.go
+0
-1
packer.go
packer.go
+1
-1
packer/build.go
packer/build.go
+2
-2
packer/build_test.go
packer/build_test.go
+5
-5
packer/builder.go
packer/builder.go
+0
-1
packer/command_test.go
packer/command_test.go
+2
-2
packer/environment.go
packer/environment.go
+4
-4
packer/plugin/builder.go
packer/plugin/builder.go
+2
-3
packer/plugin/builder_test.go
packer/plugin/builder_test.go
+0
-1
packer/plugin/client.go
packer/plugin/client.go
+2
-2
packer/plugin/command.go
packer/plugin/command.go
+2
-2
packer/plugin/plugin.go
packer/plugin/plugin.go
+1
-1
packer/plugin/plugin_test.go
packer/plugin/plugin_test.go
+1
-1
packer/rpc/build.go
packer/rpc/build.go
+1
-1
packer/rpc/build_test.go
packer/rpc/build_test.go
+3
-3
packer/rpc/builder_test.go
packer/rpc/builder_test.go
+3
-3
packer/rpc/command.go
packer/rpc/command.go
+1
-1
packer/rpc/command_test.go
packer/rpc/command_test.go
+2
-2
packer/rpc/environment_test.go
packer/rpc/environment_test.go
+4
-4
packer/rpc/port_test.go
packer/rpc/port_test.go
+1
-1
packer/rpc/server_test.go
packer/rpc/server_test.go
+0
-1
packer/rpc/ui.go
packer/rpc/ui.go
+1
-1
packer/rpc/ui_test.go
packer/rpc/ui_test.go
+4
-4
packer/template.go
packer/template.go
+2
-2
packer/template_test.go
packer/template_test.go
+2
-2
packer/ui.go
packer/ui.go
+1
-1
No files found.
builder/amazonebs/builder.go
View file @
44bd56c3
...
@@ -54,10 +54,10 @@ func (b *Builder) Run(build packer.Build, ui packer.Ui) {
...
@@ -54,10 +54,10 @@ func (b *Builder) Run(build packer.Build, ui packer.Ui) {
ec2conn
:=
ec2
.
New
(
auth
,
region
)
ec2conn
:=
ec2
.
New
(
auth
,
region
)
runOpts
:=
&
ec2
.
RunInstances
{
runOpts
:=
&
ec2
.
RunInstances
{
ImageId
:
b
.
config
.
SourceAmi
,
ImageId
:
b
.
config
.
SourceAmi
,
InstanceType
:
"m1.small"
,
InstanceType
:
"m1.small"
,
MinCount
:
0
,
MinCount
:
0
,
MaxCount
:
0
,
MaxCount
:
0
,
}
}
ui
.
Say
(
"Launching a source AWS instance...
\n
"
)
ui
.
Say
(
"Launching a source AWS instance...
\n
"
)
...
@@ -97,7 +97,7 @@ func (b *Builder) Run(build packer.Build, ui packer.Ui) {
...
@@ -97,7 +97,7 @@ func (b *Builder) Run(build packer.Build, ui packer.Ui) {
ui
.
Say
(
"Creating the AMI...
\n
"
)
ui
.
Say
(
"Creating the AMI...
\n
"
)
createOpts
:=
&
ec2
.
CreateImage
{
createOpts
:=
&
ec2
.
CreateImage
{
InstanceId
:
instance
.
InstanceId
,
InstanceId
:
instance
.
InstanceId
,
Name
:
b
.
config
.
AMIName
,
Name
:
b
.
config
.
AMIName
,
}
}
createResp
,
err
:=
ec2conn
.
CreateImage
(
createOpts
)
createResp
,
err
:=
ec2conn
.
CreateImage
(
createOpts
)
...
...
builder/amazonebs/builder_test.go
View file @
44bd56c3
...
@@ -17,7 +17,7 @@ func TestBuilder_Prepare_BadType(t *testing.T) {
...
@@ -17,7 +17,7 @@ func TestBuilder_Prepare_BadType(t *testing.T) {
assert
:=
asserts
.
NewTestingAsserts
(
t
,
true
)
assert
:=
asserts
.
NewTestingAsserts
(
t
,
true
)
b
:=
&
Builder
{}
b
:=
&
Builder
{}
c
:=
map
[
string
]
interface
{}
{
c
:=
map
[
string
]
interface
{}{
"access_key"
:
[]
string
{},
"access_key"
:
[]
string
{},
}
}
...
@@ -29,7 +29,7 @@ func TestBuilder_Prepare_Good(t *testing.T) {
...
@@ -29,7 +29,7 @@ func TestBuilder_Prepare_Good(t *testing.T) {
assert
:=
asserts
.
NewTestingAsserts
(
t
,
true
)
assert
:=
asserts
.
NewTestingAsserts
(
t
,
true
)
b
:=
&
Builder
{}
b
:=
&
Builder
{}
c
:=
map
[
string
]
interface
{}
{
c
:=
map
[
string
]
interface
{}{
"access_key"
:
"foo"
,
"access_key"
:
"foo"
,
"secret_key"
:
"bar"
,
"secret_key"
:
"bar"
,
"source_ami"
:
"123456"
,
"source_ami"
:
"123456"
,
...
...
command/build/command_test.go
View file @
44bd56c3
package
build
package
build
import
(
import
(
"bytes"
"bytes"
"cgl.tideland.biz/asserts"
"cgl.tideland.biz/asserts"
...
...
packer.go
View file @
44bd56c3
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
package
main
package
main
import
(
import
(
"fmt"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer/plugin"
"github.com/mitchellh/packer/packer/plugin"
"fmt"
"io/ioutil"
"io/ioutil"
"log"
"log"
"os"
"os"
...
...
packer/build.go
View file @
44bd56c3
...
@@ -15,8 +15,8 @@ type Build interface {
...
@@ -15,8 +15,8 @@ type Build interface {
// multiple files, of course, but it should be for only a single provider
// multiple files, of course, but it should be for only a single provider
// (such as VirtualBox, EC2, etc.).
// (such as VirtualBox, EC2, etc.).
type
coreBuild
struct
{
type
coreBuild
struct
{
name
string
name
string
builder
Builder
builder
Builder
rawConfig
interface
{}
rawConfig
interface
{}
prepareCalled
bool
prepareCalled
bool
...
...
packer/build_test.go
View file @
44bd56c3
...
@@ -8,9 +8,9 @@ import (
...
@@ -8,9 +8,9 @@ import (
type
TestBuilder
struct
{
type
TestBuilder
struct
{
prepareCalled
bool
prepareCalled
bool
prepareConfig
interface
{}
prepareConfig
interface
{}
runCalled
bool
runCalled
bool
runBuild
Build
runBuild
Build
runUi
Ui
runUi
Ui
}
}
func
(
tb
*
TestBuilder
)
Prepare
(
config
interface
{})
error
{
func
(
tb
*
TestBuilder
)
Prepare
(
config
interface
{})
error
{
...
@@ -27,8 +27,8 @@ func (tb *TestBuilder) Run(b Build, ui Ui) {
...
@@ -27,8 +27,8 @@ func (tb *TestBuilder) Run(b Build, ui Ui) {
func
testBuild
()
Build
{
func
testBuild
()
Build
{
return
&
coreBuild
{
return
&
coreBuild
{
name
:
"test"
,
name
:
"test"
,
builder
:
&
TestBuilder
{},
builder
:
&
TestBuilder
{},
rawConfig
:
42
,
rawConfig
:
42
,
}
}
}
}
...
...
packer/builder.go
View file @
44bd56c3
...
@@ -13,4 +13,3 @@ type Builder interface {
...
@@ -13,4 +13,3 @@ type Builder interface {
Prepare
(
config
interface
{})
error
Prepare
(
config
interface
{})
error
Run
(
build
Build
,
ui
Ui
)
Run
(
build
Build
,
ui
Ui
)
}
}
packer/command_test.go
View file @
44bd56c3
package
packer
package
packer
type
TestCommand
struct
{
type
TestCommand
struct
{
runArgs
[]
string
runArgs
[]
string
runCalled
bool
runCalled
bool
runEnv
Environment
runEnv
Environment
}
}
func
(
tc
*
TestCommand
)
Run
(
env
Environment
,
args
[]
string
)
int
{
func
(
tc
*
TestCommand
)
Run
(
env
Environment
,
args
[]
string
)
int
{
...
...
packer/environment.go
View file @
44bd56c3
...
@@ -31,17 +31,17 @@ type Environment interface {
...
@@ -31,17 +31,17 @@ type Environment interface {
// environment.
// environment.
type
coreEnvironment
struct
{
type
coreEnvironment
struct
{
builderFunc
BuilderFunc
builderFunc
BuilderFunc
commands
[]
string
commands
[]
string
commandFunc
CommandFunc
commandFunc
CommandFunc
ui
Ui
ui
Ui
}
}
// This struct configures new environments.
// This struct configures new environments.
type
EnvironmentConfig
struct
{
type
EnvironmentConfig
struct
{
BuilderFunc
BuilderFunc
BuilderFunc
BuilderFunc
CommandFunc
CommandFunc
CommandFunc
CommandFunc
Commands
[]
string
Commands
[]
string
Ui
Ui
Ui
Ui
}
}
// DefaultEnvironmentConfig returns a default EnvironmentConfig that can
// DefaultEnvironmentConfig returns a default EnvironmentConfig that can
...
...
packer/plugin/builder.go
View file @
44bd56c3
...
@@ -2,15 +2,15 @@ package plugin
...
@@ -2,15 +2,15 @@ package plugin
import
(
import
(
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
packrpc
"github.com/mitchellh/packer/packer/rpc"
"log"
"log"
"net/rpc"
"net/rpc"
"os/exec"
"os/exec"
packrpc
"github.com/mitchellh/packer/packer/rpc"
)
)
type
cmdBuilder
struct
{
type
cmdBuilder
struct
{
builder
packer
.
Builder
builder
packer
.
Builder
client
*
client
client
*
client
}
}
func
(
b
*
cmdBuilder
)
Prepare
(
config
interface
{})
error
{
func
(
b
*
cmdBuilder
)
Prepare
(
config
interface
{})
error
{
...
@@ -39,7 +39,6 @@ func (c *cmdBuilder) checkExit(p interface{}, cb func()) {
...
@@ -39,7 +39,6 @@ func (c *cmdBuilder) checkExit(p interface{}, cb func()) {
}
}
}
}
// Returns a valid packer.Builder where the builder is executed via RPC
// Returns a valid packer.Builder where the builder is executed via RPC
// to a plugin that is within a subprocess.
// to a plugin that is within a subprocess.
//
//
...
...
packer/plugin/builder_test.go
View file @
44bd56c3
...
@@ -28,4 +28,3 @@ func TestBuilder_Good(t *testing.T) {
...
@@ -28,4 +28,3 @@ func TestBuilder_Good(t *testing.T) {
_
,
err
:=
Builder
(
helperProcess
(
"builder"
))
_
,
err
:=
Builder
(
helperProcess
(
"builder"
))
assert
.
Nil
(
err
,
"should start builder properly"
)
assert
.
Nil
(
err
,
"should start builder properly"
)
}
}
packer/plugin/client.go
View file @
44bd56c3
...
@@ -16,8 +16,8 @@ import (
...
@@ -16,8 +16,8 @@ import (
var
managedClients
=
make
([]
*
client
,
0
,
5
)
var
managedClients
=
make
([]
*
client
,
0
,
5
)
type
client
struct
{
type
client
struct
{
cmd
*
exec
.
Cmd
cmd
*
exec
.
Cmd
exited
bool
exited
bool
doneLogging
bool
doneLogging
bool
}
}
...
...
packer/plugin/command.go
View file @
44bd56c3
...
@@ -2,15 +2,15 @@ package plugin
...
@@ -2,15 +2,15 @@ package plugin
import
(
import
(
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
packrpc
"github.com/mitchellh/packer/packer/rpc"
"log"
"log"
"net/rpc"
"net/rpc"
"os/exec"
"os/exec"
packrpc
"github.com/mitchellh/packer/packer/rpc"
)
)
type
cmdCommand
struct
{
type
cmdCommand
struct
{
command
packer
.
Command
command
packer
.
Command
client
*
client
client
*
client
}
}
func
(
c
*
cmdCommand
)
Run
(
e
packer
.
Environment
,
args
[]
string
)
(
exitCode
int
)
{
func
(
c
*
cmdCommand
)
Run
(
e
packer
.
Environment
,
args
[]
string
)
(
exitCode
int
)
{
...
...
packer/plugin/plugin.go
View file @
44bd56c3
...
@@ -10,11 +10,11 @@ package plugin
...
@@ -10,11 +10,11 @@ package plugin
import
(
import
(
"fmt"
"fmt"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
packrpc
"github.com/mitchellh/packer/packer/rpc"
"log"
"log"
"net"
"net"
"net/rpc"
"net/rpc"
"os"
"os"
packrpc
"github.com/mitchellh/packer/packer/rpc"
"strconv"
"strconv"
"strings"
"strings"
)
)
...
...
packer/plugin/plugin_test.go
View file @
44bd56c3
...
@@ -8,7 +8,7 @@ import (
...
@@ -8,7 +8,7 @@ import (
"time"
"time"
)
)
func
helperProcess
(
s
...
string
)
*
exec
.
Cmd
{
func
helperProcess
(
s
...
string
)
*
exec
.
Cmd
{
cs
:=
[]
string
{
"-test.run=TestHelperProcess"
,
"--"
}
cs
:=
[]
string
{
"-test.run=TestHelperProcess"
,
"--"
}
cs
=
append
(
cs
,
s
...
)
cs
=
append
(
cs
,
s
...
)
env
:=
[]
string
{
env
:=
[]
string
{
...
...
packer/rpc/build.go
View file @
44bd56c3
...
@@ -42,7 +42,7 @@ func (b *Build) Run(ui packer.Ui) {
...
@@ -42,7 +42,7 @@ func (b *Build) Run(ui packer.Ui) {
b
.
client
.
Call
(
"Build.Run"
,
args
,
new
(
interface
{}))
b
.
client
.
Call
(
"Build.Run"
,
args
,
new
(
interface
{}))
}
}
func
(
b
*
BuildServer
)
Name
(
args
*
interface
{},
reply
*
string
)
error
{
func
(
b
*
BuildServer
)
Name
(
args
*
interface
{},
reply
*
string
)
error
{
*
reply
=
b
.
build
.
Name
()
*
reply
=
b
.
build
.
Name
()
return
nil
return
nil
}
}
...
...
packer/rpc/build_test.go
View file @
44bd56c3
...
@@ -8,10 +8,10 @@ import (
...
@@ -8,10 +8,10 @@ import (
)
)
type
testBuild
struct
{
type
testBuild
struct
{
nameCalled
bool
nameCalled
bool
prepareCalled
bool
prepareCalled
bool
runCalled
bool
runCalled
bool
runUi
packer
.
Ui
runUi
packer
.
Ui
}
}
func
(
b
*
testBuild
)
Name
()
string
{
func
(
b
*
testBuild
)
Name
()
string
{
...
...
packer/rpc/builder_test.go
View file @
44bd56c3
...
@@ -10,9 +10,9 @@ import (
...
@@ -10,9 +10,9 @@ import (
type
testBuilder
struct
{
type
testBuilder
struct
{
prepareCalled
bool
prepareCalled
bool
prepareConfig
interface
{}
prepareConfig
interface
{}
runCalled
bool
runCalled
bool
runBuild
packer
.
Build
runBuild
packer
.
Build
runUi
packer
.
Ui
runUi
packer
.
Ui
}
}
func
(
b
*
testBuilder
)
Prepare
(
config
interface
{})
error
{
func
(
b
*
testBuilder
)
Prepare
(
config
interface
{})
error
{
...
...
packer/rpc/command.go
View file @
44bd56c3
...
@@ -19,7 +19,7 @@ type CommandServer struct {
...
@@ -19,7 +19,7 @@ type CommandServer struct {
type
CommandRunArgs
struct
{
type
CommandRunArgs
struct
{
RPCAddress
string
RPCAddress
string
Args
[]
string
Args
[]
string
}
}
type
CommandSynopsisArgs
byte
type
CommandSynopsisArgs
byte
...
...
packer/rpc/command_test.go
View file @
44bd56c3
...
@@ -8,9 +8,9 @@ import (
...
@@ -8,9 +8,9 @@ import (
)
)
type
TestCommand
struct
{
type
TestCommand
struct
{
runArgs
[]
string
runArgs
[]
string
runCalled
bool
runCalled
bool
runEnv
packer
.
Environment
runEnv
packer
.
Environment
}
}
func
(
tc
*
TestCommand
)
Run
(
env
packer
.
Environment
,
args
[]
string
)
int
{
func
(
tc
*
TestCommand
)
Run
(
env
packer
.
Environment
,
args
[]
string
)
int
{
...
...
packer/rpc/environment_test.go
View file @
44bd56c3
...
@@ -12,10 +12,10 @@ var testEnvUi = &testUi{}
...
@@ -12,10 +12,10 @@ var testEnvUi = &testUi{}
type
testEnvironment
struct
{
type
testEnvironment
struct
{
builderCalled
bool
builderCalled
bool
builderName
string
builderName
string
cliCalled
bool
cliCalled
bool
cliArgs
[]
string
cliArgs
[]
string
uiCalled
bool
uiCalled
bool
}
}
func
(
e
*
testEnvironment
)
Builder
(
name
string
)
(
packer
.
Builder
,
error
)
{
func
(
e
*
testEnvironment
)
Builder
(
name
string
)
(
packer
.
Builder
,
error
)
{
...
...
packer/rpc/port_test.go
View file @
44bd56c3
...
@@ -9,7 +9,7 @@ import (
...
@@ -9,7 +9,7 @@ import (
func
addrPort
(
address
net
.
Addr
)
string
{
func
addrPort
(
address
net
.
Addr
)
string
{
parts
:=
strings
.
Split
(
address
.
String
(),
":"
)
parts
:=
strings
.
Split
(
address
.
String
(),
":"
)
return
parts
[
len
(
parts
)
-
1
]
return
parts
[
len
(
parts
)
-
1
]
}
}
func
Test_netListenerInRange
(
t
*
testing
.
T
)
{
func
Test_netListenerInRange
(
t
*
testing
.
T
)
{
...
...
packer/rpc/server_test.go
View file @
44bd56c3
package
rpc
package
rpc
packer/rpc/ui.go
View file @
44bd56c3
...
@@ -19,7 +19,7 @@ type UiServer struct {
...
@@ -19,7 +19,7 @@ type UiServer struct {
type
UiSayArgs
struct
{
type
UiSayArgs
struct
{
Format
string
Format
string
Vars
[]
interface
{}
Vars
[]
interface
{}
}
}
func
(
u
*
Ui
)
Error
(
format
string
,
a
...
interface
{})
{
func
(
u
*
Ui
)
Error
(
format
string
,
a
...
interface
{})
{
...
...
packer/rpc/ui_test.go
View file @
44bd56c3
...
@@ -9,10 +9,10 @@ import (
...
@@ -9,10 +9,10 @@ import (
type
testUi
struct
{
type
testUi
struct
{
errorCalled
bool
errorCalled
bool
errorFormat
string
errorFormat
string
errorVars
[]
interface
{}
errorVars
[]
interface
{}
sayCalled
bool
sayCalled
bool
sayFormat
string
sayFormat
string
sayVars
[]
interface
{}
sayVars
[]
interface
{}
}
}
func
(
u
*
testUi
)
Error
(
format
string
,
a
...
interface
{})
{
func
(
u
*
testUi
)
Error
(
format
string
,
a
...
interface
{})
{
...
...
packer/template.go
View file @
44bd56c3
...
@@ -111,8 +111,8 @@ func (t *Template) Build(name string, bf BuilderFunc) (b Build, err error) {
...
@@ -111,8 +111,8 @@ func (t *Template) Build(name string, bf BuilderFunc) (b Build, err error) {
}
}
b
=
&
coreBuild
{
b
=
&
coreBuild
{
name
:
name
,
name
:
name
,
builder
:
builder
,
builder
:
builder
,
rawConfig
:
builderConfig
.
rawConfig
,
rawConfig
:
builderConfig
.
rawConfig
,
}
}
...
...
packer/template_test.go
View file @
44bd56c3
...
@@ -178,7 +178,7 @@ func TestTemplate_Build(t *testing.T) {
...
@@ -178,7 +178,7 @@ func TestTemplate_Build(t *testing.T) {
}
}
`
`
expectedConfig
:=
map
[
string
]
interface
{}
{
expectedConfig
:=
map
[
string
]
interface
{}{
"name"
:
"test1"
,
"name"
:
"test1"
,
"type"
:
"test-builder"
,
"type"
:
"test-builder"
,
}
}
...
@@ -187,7 +187,7 @@ func TestTemplate_Build(t *testing.T) {
...
@@ -187,7 +187,7 @@ func TestTemplate_Build(t *testing.T) {
assert
.
Nil
(
err
,
"should not error"
)
assert
.
Nil
(
err
,
"should not error"
)
builder
:=
testBuilder
()
builder
:=
testBuilder
()
builderMap
:=
map
[
string
]
Builder
{
builderMap
:=
map
[
string
]
Builder
{
"test-builder"
:
builder
,
"test-builder"
:
builder
,
}
}
...
...
packer/ui.go
View file @
44bd56c3
...
@@ -8,7 +8,7 @@ import "io"
...
@@ -8,7 +8,7 @@ import "io"
// is formatted and various levels of output.
// is formatted and various levels of output.
type
Ui
interface
{
type
Ui
interface
{
Say
(
format
string
,
a
...
interface
{})
Say
(
format
string
,
a
...
interface
{})
Error
(
format
string
,
a
...
interface
{})
Error
(
format
string
,
a
...
interface
{})
}
}
// The ReaderWriterUi is a UI that writes and reads from standard Go
// The ReaderWriterUi is a UI that writes and reads from standard Go
...
...
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