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
6bb480e2
Commit
6bb480e2
authored
Jun 24, 2015
by
Chris Bednarski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2313 from mitchellh/b-compress-crash
parents
f765d570
eba28519
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
20 deletions
+13
-20
post-processor/compress/post-processor.go
post-processor/compress/post-processor.go
+13
-14
post-processor/compress/post-processor_test.go
post-processor/compress/post-processor_test.go
+0
-6
No files found.
post-processor/compress/post-processor.go
View file @
6bb480e2
...
...
@@ -19,6 +19,18 @@ import (
"github.com/pierrec/lz4"
)
var
(
// ErrInvalidCompressionLevel is returned when the compression level passed
// to gzip is not in the expected range. See compress/flate for details.
ErrInvalidCompressionLevel
=
fmt
.
Errorf
(
"Invalid compression level. Expected an integer from -1 to 9."
)
ErrWrongInputCount
=
fmt
.
Errorf
(
"Can only have 1 input file when not using tar/zip"
)
filenamePattern
=
regexp
.
MustCompile
(
`(?:\.([a-z0-9]+))`
)
)
type
Config
struct
{
common
.
PackerConfig
`mapstructure:",squash"`
...
...
@@ -35,21 +47,9 @@ type Config struct {
}
type
PostProcessor
struct
{
config
*
Config
config
Config
}
var
(
// ErrInvalidCompressionLevel is returned when the compression level passed
// to gzip is not in the expected range. See compress/flate for details.
ErrInvalidCompressionLevel
=
fmt
.
Errorf
(
"Invalid compression level. Expected an integer from -1 to 9."
)
ErrWrongInputCount
=
fmt
.
Errorf
(
"Can only have 1 input file when not using tar/zip"
)
filenamePattern
=
regexp
.
MustCompile
(
`(?:\.([a-z0-9]+))`
)
)
func
(
p
*
PostProcessor
)
Configure
(
raws
...
interface
{})
error
{
err
:=
config
.
Decode
(
&
p
.
config
,
&
config
.
DecodeOpts
{
Interpolate
:
true
,
...
...
@@ -109,7 +109,6 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
}
return
nil
}
func
(
p
*
PostProcessor
)
PostProcess
(
ui
packer
.
Ui
,
artifact
packer
.
Artifact
)
(
packer
.
Artifact
,
bool
,
error
)
{
...
...
post-processor/compress/post-processor_test.go
View file @
6bb480e2
...
...
@@ -9,7 +9,6 @@ import (
"testing"
"github.com/mitchellh/packer/builder/file"
env
"github.com/mitchellh/packer/helper/builder/testing"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/template"
)
...
...
@@ -187,11 +186,6 @@ func setup(t *testing.T) (packer.Ui, packer.Artifact, error) {
}
func
testArchive
(
t
*
testing
.
T
,
config
string
)
packer
.
Artifact
{
if
os
.
Getenv
(
env
.
TestEnvVar
)
==
""
{
t
.
Skip
(
fmt
.
Sprintf
(
"Acceptance tests skipped unless env '%s' set"
,
env
.
TestEnvVar
))
}
ui
,
artifact
,
err
:=
setup
(
t
)
if
err
!=
nil
{
t
.
Fatalf
(
"Error bootstrapping test: %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