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
29a22591
Commit
29a22591
authored
Nov 05, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
post-processor/vagrant: support compression level for DO
parent
c6392481
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
post-processor/vagrant/digitalocean.go
post-processor/vagrant/digitalocean.go
+13
-1
No files found.
post-processor/vagrant/digitalocean.go
View file @
29a22591
package
vagrant
import
(
"compress/flate"
"fmt"
"github.com/mitchellh/packer/common"
"github.com/mitchellh/packer/packer"
...
...
@@ -8,6 +9,7 @@ import (
"log"
"os"
"path/filepath"
"strconv"
"strings"
)
...
...
@@ -16,6 +18,7 @@ type DigitalOceanBoxConfig struct {
OutputPath
string
`mapstructure:"output"`
VagrantfileTemplate
string
`mapstructure:"vagrantfile_template"`
CompressionLevel
string
`mapstructure:"compression_level"`
tpl
*
packer
.
ConfigTemplate
}
...
...
@@ -47,6 +50,7 @@ func (p *DigitalOceanBoxPostProcessor) Configure(rDigitalOcean ...interface{}) e
validates
:=
map
[
string
]
*
string
{
"output"
:
&
p
.
config
.
OutputPath
,
"vagrantfile_template"
:
&
p
.
config
.
VagrantfileTemplate
,
"compression_level"
:
&
p
.
config
.
CompressionLevel
,
}
for
n
,
ptr
:=
range
validates
{
...
...
@@ -132,7 +136,15 @@ func (p *DigitalOceanBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer
}
// Compress the directory to the given output path
if
err
:=
DirToBox
(
outputPath
,
dir
,
ui
);
err
!=
nil
{
var
level
int
=
flate
.
DefaultCompression
if
p
.
config
.
CompressionLevel
!=
""
{
level
,
err
=
strconv
.
Atoi
(
p
.
config
.
CompressionLevel
)
if
err
!=
nil
{
return
nil
,
false
,
err
}
}
if
err
:=
DirToBox
(
outputPath
,
dir
,
ui
,
level
);
err
!=
nil
{
err
=
fmt
.
Errorf
(
"error creating box: %s"
,
err
)
return
nil
,
false
,
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