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
6dd36075
Commit
6dd36075
authored
Jun 29, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2352 from mitchellh/b-amazon-bundle
builder/amazon/instance: set valid bundle prefix [GH-2328]
parents
782d6930
98db68e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
builder/amazon/instance/builder.go
builder/amazon/instance/builder.go
+7
-5
builder/amazon/instance/builder_test.go
builder/amazon/instance/builder_test.go
+0
-1
No files found.
builder/amazon/instance/builder.go
View file @
6dd36075
...
@@ -50,6 +50,12 @@ type Builder struct {
...
@@ -50,6 +50,12 @@ type Builder struct {
}
}
func
(
b
*
Builder
)
Prepare
(
raws
...
interface
{})
([]
string
,
error
)
{
func
(
b
*
Builder
)
Prepare
(
raws
...
interface
{})
([]
string
,
error
)
{
configs
:=
make
([]
interface
{},
len
(
raws
)
+
1
)
configs
[
0
]
=
map
[
string
]
interface
{}{
"bundle_prefix"
:
"image-{{timestamp}}"
,
}
copy
(
configs
[
1
:
],
raws
)
b
.
config
.
ctx
.
Funcs
=
awscommon
.
TemplateFuncs
b
.
config
.
ctx
.
Funcs
=
awscommon
.
TemplateFuncs
err
:=
config
.
Decode
(
&
b
.
config
,
&
config
.
DecodeOpts
{
err
:=
config
.
Decode
(
&
b
.
config
,
&
config
.
DecodeOpts
{
Interpolate
:
true
,
Interpolate
:
true
,
...
@@ -60,7 +66,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
...
@@ -60,7 +66,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
"bundle_vol_command"
,
"bundle_vol_command"
,
},
},
},
},
},
raw
s
...
)
},
config
s
...
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -69,10 +75,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
...
@@ -69,10 +75,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
b
.
config
.
BundleDestination
=
"/tmp"
b
.
config
.
BundleDestination
=
"/tmp"
}
}
if
b
.
config
.
BundlePrefix
==
""
{
b
.
config
.
BundlePrefix
=
"image-{{timestamp}}"
}
if
b
.
config
.
BundleUploadCommand
==
""
{
if
b
.
config
.
BundleUploadCommand
==
""
{
if
b
.
config
.
IamInstanceProfile
!=
""
{
if
b
.
config
.
IamInstanceProfile
!=
""
{
b
.
config
.
BundleUploadCommand
=
"sudo -i -n ec2-upload-bundle "
+
b
.
config
.
BundleUploadCommand
=
"sudo -i -n ec2-upload-bundle "
+
...
...
builder/amazon/instance/builder_test.go
View file @
6dd36075
...
@@ -130,7 +130,6 @@ func TestBuilderPrepare_BundlePrefix(t *testing.T) {
...
@@ -130,7 +130,6 @@ func TestBuilderPrepare_BundlePrefix(t *testing.T) {
b
:=
&
Builder
{}
b
:=
&
Builder
{}
config
:=
testConfig
()
config
:=
testConfig
()
config
[
"bundle_prefix"
]
=
""
warnings
,
err
:=
b
.
Prepare
(
config
)
warnings
,
err
:=
b
.
Prepare
(
config
)
if
len
(
warnings
)
>
0
{
if
len
(
warnings
)
>
0
{
t
.
Fatalf
(
"bad: %#v"
,
warnings
)
t
.
Fatalf
(
"bad: %#v"
,
warnings
)
...
...
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