parent
ce1900c477
commit
0f354c79d1
|
@ -1,6 +1,7 @@
|
|||
package amazonebs
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
@ -33,3 +34,7 @@ func (a *artifact) String() string {
|
|||
|
||||
return fmt.Sprintf("AMIs were created:\n\n%s", strings.Join(amiStrings, "\n"))
|
||||
}
|
||||
|
||||
func (a *artifact) Destroy() error {
|
||||
return errors.New("not implemented yet")
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package digitalocean
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
|
@ -25,3 +26,7 @@ func (a *Artifact) Id() string {
|
|||
func (a *Artifact) String() string {
|
||||
return fmt.Sprintf("A snapshot was created: %v", a.snapshotName)
|
||||
}
|
||||
|
||||
func (a *Artifact) Destroy() error {
|
||||
return errors.New("not implemented yet")
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package vmware
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Artifact is the result of running the VMware builder, namely a set
|
||||
// of files associated with the resulting machine.
|
||||
|
@ -24,3 +27,7 @@ func (*Artifact) Id() string {
|
|||
func (a *Artifact) String() string {
|
||||
return fmt.Sprintf("VM files in directory: %s", a.dir)
|
||||
}
|
||||
|
||||
func (a *Artifact) Destroy() error {
|
||||
return os.RemoveAll(a.dir)
|
||||
}
|
||||
|
|
|
@ -24,4 +24,9 @@ type Artifact interface {
|
|||
// Returns human-readable output that describes the artifact created.
|
||||
// This is used for UI output. It can be multiple lines.
|
||||
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
|
||||
}
|
||||
|
|
|
@ -17,3 +17,7 @@ func (*TestArtifact) Id() string {
|
|||
func (*TestArtifact) String() string {
|
||||
return "string"
|
||||
}
|
||||
|
||||
func (*TestArtifact) Destroy() error {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -41,6 +41,15 @@ func (a *artifact) String() (result string) {
|
|||
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 {
|
||||
*reply = s.artifact.BuilderId()
|
||||
return nil
|
||||
|
@ -60,3 +69,13 @@ func (s *ArtifactServer) String(args *interface{}, reply *string) error {
|
|||
*reply = s.artifact.String()
|
||||
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
|
||||
}
|
||||
|
|
|
@ -25,6 +25,10 @@ func (testArtifact) String() string {
|
|||
return "string"
|
||||
}
|
||||
|
||||
func (testArtifact) Destroy() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestArtifactRPC(t *testing.T) {
|
||||
assert := asserts.NewTestingAsserts(t, true)
|
||||
|
||||
|
|
Loading…
Reference in New Issue