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
946f7458
Commit
946f7458
authored
May 26, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command: don't use packer.Template
parent
2fb08be1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
command/inspect.go
command/inspect.go
+5
-6
command/push.go
command/push.go
+5
-5
No files found.
command/inspect.go
View file @
946f7458
...
...
@@ -2,10 +2,10 @@ package command
import
(
"fmt"
"github.com/mitchellh/packer/packer"
"log"
"sort"
"strings"
"github.com/mitchellh/packer/template"
)
type
InspectCommand
struct
{
...
...
@@ -13,7 +13,7 @@ type InspectCommand struct {
}
func
(
c
*
InspectCommand
)
Run
(
args
[]
string
)
int
{
flags
:=
c
.
Meta
.
FlagSet
(
"
build
"
,
FlagSetNone
)
flags
:=
c
.
Meta
.
FlagSet
(
"
inspect
"
,
FlagSetNone
)
flags
.
Usage
=
func
()
{
c
.
Ui
.
Say
(
c
.
Help
())
}
if
err
:=
flags
.
Parse
(
args
);
err
!=
nil
{
return
1
...
...
@@ -25,9 +25,8 @@ func (c *InspectCommand) Run(args []string) int {
return
1
}
// Read the file into a byte array so that we can parse the template
log
.
Printf
(
"Reading template: %#v"
,
args
[
0
])
tpl
,
err
:=
packer
.
ParseTemplateFile
(
args
[
0
],
nil
)
// Parse the template
tpl
,
err
:=
template
.
ParseFile
(
args
[
0
])
if
err
!=
nil
{
c
.
Ui
.
Error
(
fmt
.
Sprintf
(
"Failed to parse template: %s"
,
err
))
return
1
...
...
command/push.go
View file @
946f7458
...
...
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/atlas-go/archive"
"github.com/hashicorp/atlas-go/v1"
"github.com/mitchellh/packer/
packer
"
"github.com/mitchellh/packer/
template
"
)
// archiveTemplateEntry is the name the template always takes within the slug.
...
...
@@ -58,15 +58,15 @@ func (c *PushCommand) Run(args []string) int {
"longer used. It will be removed in the next version."
))
}
//
Read
the template
tpl
,
err
:=
packer
.
ParseTemplateFile
(
args
[
0
],
nil
)
//
Parse
the template
tpl
,
err
:=
template
.
ParseFile
(
args
[
0
]
)
if
err
!=
nil
{
c
.
Ui
.
Error
(
fmt
.
Sprintf
(
"Failed to parse template: %s"
,
err
))
return
1
}
// Validate some things
if
tpl
.
Push
.
Name
==
""
{
if
tpl
.
Push
==
nil
||
tpl
.
Push
.
Name
==
""
{
c
.
Ui
.
Error
(
fmt
.
Sprintf
(
"The 'push' section must be specified in the template with
\n
"
+
"at least the 'name' option set."
))
...
...
@@ -131,7 +131,7 @@ func (c *PushCommand) Run(args []string) int {
}
// Find the Atlas post-processors, if possible
var
atlasPPs
[]
packer
.
RawPostProcessorConfig
var
atlasPPs
[]
*
template
.
PostProcessor
for
_
,
list
:=
range
tpl
.
PostProcessors
{
for
_
,
pp
:=
range
list
{
if
pp
.
Type
==
"atlas"
{
...
...
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