← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/juju-core/mpv-storage-remove into lp:~maas-maintainers/juju-core/maas-provider-skeleton

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/juju-core/mpv-storage-remove into lp:~maas-maintainers/juju-core/maas-provider-skeleton with lp:~jtv/juju-core/mpv-storage as a prerequisite.

Commit message:
Implement file deletion in the MAAS provider's storage implementation.

Requested reviews:
  MAAS Maintainers (maas-maintainers)

For more details, see:
https://code.launchpad.net/~jtv/juju-core/mpv-storage-remove/+merge/151709

This builds on two preceding branches: lp:~jtv/juju-core/mpv-storage-list and lp:~jtv/juju-core/mpv-storage

There's not much to see here, especially compared to the preceding branch, but that's exactly why I didn't want to grow the preceding branch any further.


Jeroen
-- 
https://code.launchpad.net/~jtv/juju-core/mpv-storage-remove/+merge/151709
Your team MAAS Maintainers is requested to review the proposed merge of lp:~jtv/juju-core/mpv-storage-remove into lp:~maas-maintainers/juju-core/maas-provider-skeleton.
=== modified file 'environs/maas/storage.go'
--- environs/maas/storage.go	2013-03-05 09:46:24 +0000
+++ environs/maas/storage.go	2013-03-05 09:46:24 +0000
@@ -169,6 +169,10 @@
 	return err
 }
 
-func (*maasStorage) Remove(name string) error {
-	panic("Not implemented.")
+func (stor *maasStorage) Remove(name string) error {
+	// The only thing that can go wrong here, really, is that the file
+	// does not exist.  But deletion is idempotent: deleting a file that
+	// is no longer there anyway is success, not failure.
+	stor.getSnapshot().maasClientUnlocked.GetSubObject(name).Delete()
+	return nil
 }

=== modified file 'environs/maas/storage_test.go'
--- environs/maas/storage_test.go	2013-03-05 09:46:24 +0000
+++ environs/maas/storage_test.go	2013-03-05 09:46:24 +0000
@@ -324,8 +324,6 @@
 	c.Check(buf, DeepEquals, newContents)
 }
 
-// These tests not satisfied yet.  Coming in next branch!
-/*
 func (s *StorageSuite) TestRemoveDeletesFile(c *C) {
 	const filename = "doomed.txt"
 	storage := NewStorage(s.environ)
@@ -353,4 +351,3 @@
 	err = storage.Remove(filename)
 	c.Assert(err, IsNil)
 }
-*/