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
b9fb065d
Commit
b9fb065d
authored
Jun 18, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: Add Destroy method to artifact
[GH-18]
parent
42dc1938
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
1 deletion
+50
-1
builder/amazonebs/artifact.go
builder/amazonebs/artifact.go
+5
-0
builder/digitalocean/artifact.go
builder/digitalocean/artifact.go
+5
-0
builder/vmware/artifact.go
builder/vmware/artifact.go
+8
-1
packer/artifact.go
packer/artifact.go
+5
-0
packer/artifact_test.go
packer/artifact_test.go
+4
-0
packer/rpc/artifact.go
packer/rpc/artifact.go
+19
-0
packer/rpc/artifact_test.go
packer/rpc/artifact_test.go
+4
-0
No files found.
builder/amazonebs/artifact.go
View file @
b9fb065d
package
amazonebs
package
amazonebs
import
(
import
(
"errors"
"fmt"
"fmt"
"strings"
"strings"
)
)
...
@@ -33,3 +34,7 @@ func (a *artifact) String() string {
...
@@ -33,3 +34,7 @@ func (a *artifact) String() string {
return
fmt
.
Sprintf
(
"AMIs were created:
\n\n
%s"
,
strings
.
Join
(
amiStrings
,
"
\n
"
))
return
fmt
.
Sprintf
(
"AMIs were created:
\n\n
%s"
,
strings
.
Join
(
amiStrings
,
"
\n
"
))
}
}
func
(
a
*
artifact
)
Destroy
()
error
{
return
errors
.
New
(
"not implemented yet"
)
}
builder/digitalocean/artifact.go
View file @
b9fb065d
package
digitalocean
package
digitalocean
import
(
import
(
"errors"
"fmt"
"fmt"
)
)
...
@@ -25,3 +26,7 @@ func (a *Artifact) Id() string {
...
@@ -25,3 +26,7 @@ func (a *Artifact) Id() string {
func
(
a
*
Artifact
)
String
()
string
{
func
(
a
*
Artifact
)
String
()
string
{
return
fmt
.
Sprintf
(
"A snapshot was created: %v"
,
a
.
snapshotName
)
return
fmt
.
Sprintf
(
"A snapshot was created: %v"
,
a
.
snapshotName
)
}
}
func
(
a
*
Artifact
)
Destroy
()
error
{
return
errors
.
New
(
"not implemented yet"
)
}
builder/vmware/artifact.go
View file @
b9fb065d
package
vmware
package
vmware
import
"fmt"
import
(
"fmt"
"os"
)
// Artifact is the result of running the VMware builder, namely a set
// Artifact is the result of running the VMware builder, namely a set
// of files associated with the resulting machine.
// of files associated with the resulting machine.
...
@@ -24,3 +27,7 @@ func (*Artifact) Id() string {
...
@@ -24,3 +27,7 @@ func (*Artifact) Id() string {
func
(
a
*
Artifact
)
String
()
string
{
func
(
a
*
Artifact
)
String
()
string
{
return
fmt
.
Sprintf
(
"VM files in directory: %s"
,
a
.
dir
)
return
fmt
.
Sprintf
(
"VM files in directory: %s"
,
a
.
dir
)
}
}
func
(
a
*
Artifact
)
Destroy
()
error
{
return
os
.
RemoveAll
(
a
.
dir
)
}
packer/artifact.go
View file @
b9fb065d
...
@@ -24,4 +24,9 @@ type Artifact interface {
...
@@ -24,4 +24,9 @@ type Artifact interface {
// Returns human-readable output that describes the artifact created.
// Returns human-readable output that describes the artifact created.
// This is used for UI output. It can be multiple lines.
// This is used for UI output. It can be multiple lines.
String
()
string
String
()
string
// Destroy deletes the artifact. Packer calls this for various reasons,
// such as if a post-processor has processed this artifact and it is
// no longer needed.
Destroy
()
error
}
}
packer/artifact_test.go
View file @
b9fb065d
...
@@ -17,3 +17,7 @@ func (*TestArtifact) Id() string {
...
@@ -17,3 +17,7 @@ func (*TestArtifact) Id() string {
func
(
*
TestArtifact
)
String
()
string
{
func
(
*
TestArtifact
)
String
()
string
{
return
"string"
return
"string"
}
}
func
(
*
TestArtifact
)
Destroy
()
error
{
return
nil
}
packer/rpc/artifact.go
View file @
b9fb065d
...
@@ -41,6 +41,15 @@ func (a *artifact) String() (result string) {
...
@@ -41,6 +41,15 @@ func (a *artifact) String() (result string) {
return
return
}
}
func
(
a
*
artifact
)
Destroy
()
error
{
var
result
error
if
err
:=
a
.
client
.
Call
(
"Artifact.Destroy"
,
new
(
interface
{}),
&
result
);
err
!=
nil
{
return
err
}
return
result
}
func
(
s
*
ArtifactServer
)
BuilderId
(
args
*
interface
{},
reply
*
string
)
error
{
func
(
s
*
ArtifactServer
)
BuilderId
(
args
*
interface
{},
reply
*
string
)
error
{
*
reply
=
s
.
artifact
.
BuilderId
()
*
reply
=
s
.
artifact
.
BuilderId
()
return
nil
return
nil
...
@@ -60,3 +69,13 @@ func (s *ArtifactServer) String(args *interface{}, reply *string) error {
...
@@ -60,3 +69,13 @@ func (s *ArtifactServer) String(args *interface{}, reply *string) error {
*
reply
=
s
.
artifact
.
String
()
*
reply
=
s
.
artifact
.
String
()
return
nil
return
nil
}
}
func
(
s
*
ArtifactServer
)
Destroy
(
args
*
interface
{},
reply
*
error
)
error
{
err
:=
s
.
artifact
.
Destroy
()
if
err
!=
nil
{
err
=
NewBasicError
(
err
)
}
*
reply
=
err
return
nil
}
packer/rpc/artifact_test.go
View file @
b9fb065d
...
@@ -25,6 +25,10 @@ func (testArtifact) String() string {
...
@@ -25,6 +25,10 @@ func (testArtifact) String() string {
return
"string"
return
"string"
}
}
func
(
testArtifact
)
Destroy
()
error
{
return
nil
}
func
TestArtifactRPC
(
t
*
testing
.
T
)
{
func
TestArtifactRPC
(
t
*
testing
.
T
)
{
assert
:=
asserts
.
NewTestingAsserts
(
t
,
true
)
assert
:=
asserts
.
NewTestingAsserts
(
t
,
true
)
...
...
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