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
806a8e01
Commit
806a8e01
authored
Sep 08, 2014
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move checkpoint into its own file to make it easy
parent
1c380ea5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
17 deletions
+34
-17
checkpoint.go
checkpoint.go
+33
-0
packer.go
packer.go
+1
-17
No files found.
checkpoint.go
0 → 100644
View file @
806a8e01
package
main
import
(
"fmt"
"log"
"path/filepath"
"github.com/hashicorp/go-checkpoint"
"github.com/mitchellh/packer/packer"
)
func
runCheckpoint
(
c
*
config
)
{
configDir
,
err
:=
ConfigDir
()
if
err
!=
nil
{
log
.
Printf
(
"[ERR] Checkpoint setup error: %s"
,
err
)
return
}
version
:=
packer
.
Version
if
packer
.
VersionPrerelease
!=
""
{
version
+=
fmt
.
Sprintf
(
".%s"
,
packer
.
VersionPrerelease
)
}
_
,
err
=
checkpoint
.
Check
(
&
checkpoint
.
CheckParams
{
Product
:
"packer"
,
Version
:
version
,
SignatureFile
:
filepath
.
Join
(
configDir
,
"checkpoint_signature"
),
CacheFile
:
filepath
.
Join
(
configDir
,
"checkpoint_cache"
),
})
if
err
!=
nil
{
log
.
Printf
(
"[ERR] Checkpoint error: %s"
,
err
)
}
}
packer.go
View file @
806a8e01
...
...
@@ -10,7 +10,6 @@ import (
"path/filepath"
"runtime"
"github.com/hashicorp/go-checkpoint"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer/plugin"
"github.com/mitchellh/panicwrap"
...
...
@@ -95,23 +94,8 @@ func wrappedMain() int {
}
log
.
Printf
(
"Packer config: %+v"
,
config
)
configDir
,
err
:=
ConfigDir
()
if
err
!=
nil
{
fmt
.
Fprintf
(
os
.
Stderr
,
"Error loading config dir:
\n\n
%s
\n
"
,
err
)
return
1
}
// Fire off the checkpoint.
version
:=
packer
.
Version
if
packer
.
VersionPrerelease
!=
""
{
version
+=
fmt
.
Sprintf
(
".%s"
,
packer
.
VersionPrerelease
)
}
go
checkpoint
.
Check
(
&
checkpoint
.
CheckParams
{
Product
:
"packer"
,
Version
:
version
,
SignatureFile
:
filepath
.
Join
(
configDir
,
"checkpoint_signature"
),
CacheFile
:
filepath
.
Join
(
configDir
,
"checkpoint_cache"
),
})
go
runCheckpoint
(
config
)
cacheDir
:=
os
.
Getenv
(
"PACKER_CACHE_DIR"
)
if
cacheDir
==
""
{
...
...
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