[pkg-eucalyptus-commits] [SCM] managing cloud instances for Eucalyptus branch, master, updated. 3.0.0-alpha3-257-g1da8e3a
Garrett Holmstrom
gholms at fedoraproject.org
Sun Jun 16 02:30:07 UTC 2013
The following commit has been merged in the master branch:
commit 78527dbe301d0c1097026d224653378292228364
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date: Sat Feb 16 20:07:54 2013 -0800
Implement minimal create/delete bucket
diff --git a/euca2ools/commands/walrus/deleteobject.py b/euca2ools/commands/walrus/createbucket.py
similarity index 62%
copy from euca2ools/commands/walrus/deleteobject.py
copy to euca2ools/commands/walrus/createbucket.py
index 13947b9..73ed96d 100644
--- a/euca2ools/commands/walrus/deleteobject.py
+++ b/euca2ools/commands/walrus/createbucket.py
@@ -29,21 +29,28 @@
# POSSIBILITY OF SUCH DAMAGE.
from requestbuilder import Arg
-from . import WalrusRequest
+import xml.etree.ElementTree as ET
+from . import WalrusRequest, validate_generic_bucket_name
-class DeleteObject(WalrusRequest):
- DESCRIPTION = 'Delete objects from the server'
- ARGS = [Arg('paths', metavar='BUCKET/KEY', nargs='+', route_to=None)]
+class CreateBucket(WalrusRequest):
+ DESCRIPTION = 'Create a new bucket'
+ ARGS = [Arg('bucket', route_to=None, help='name of the new bucket')]
def configure(self):
WalrusRequest.configure(self)
- for path in self.args['paths']:
- if '/' not in path:
- self._cli_parser.error(
- "path '{0}' must include a key name")
+ validate_generic_bucket_name(self.args['bucket'])
def main(self):
- self.method = 'DELETE'
- for path in self.args['paths']:
- self.path = path
- self.send()
+ self.method = 'PUT'
+ self.path = self.args['bucket']
+ cb_config = ET.Element('CreateBucketConfiguration')
+ cb_config.set('xmlns', 'http://doc.s3.amazonaws.com/2006-03-01')
+ lconstraint = self.config.get_region_option('s3-location-constraint')
+ if lconstraint:
+ cb_lconstraint = ET.SubElement(cb_config, 'LocationConstraint')
+ cb_lconstraint.text = lconstraint
+ if len(cb_config.getchildren()):
+ cb_xml = ET.tostring(cb_config)
+ self.log.debug('bucket configuration: %s', cb_xml)
+ self.body = cb_xml
+ self.send()
diff --git a/euca2ools/commands/walrus/deleteobject.py b/euca2ools/commands/walrus/deletebucket.py
similarity index 77%
copy from euca2ools/commands/walrus/deleteobject.py
copy to euca2ools/commands/walrus/deletebucket.py
index 13947b9..f8ed998 100644
--- a/euca2ools/commands/walrus/deleteobject.py
+++ b/euca2ools/commands/walrus/deletebucket.py
@@ -29,21 +29,17 @@
# POSSIBILITY OF SUCH DAMAGE.
from requestbuilder import Arg
-from . import WalrusRequest
+from . import WalrusRequest, validate_generic_bucket_name
-class DeleteObject(WalrusRequest):
- DESCRIPTION = 'Delete objects from the server'
- ARGS = [Arg('paths', metavar='BUCKET/KEY', nargs='+', route_to=None)]
+class DeleteBucket(WalrusRequest):
+ DESCRIPTION = 'Delete a bucket'
+ ARGS = [Arg('bucket', route_to=None, help='name of the bucket to delete')]
def configure(self):
WalrusRequest.configure(self)
- for path in self.args['paths']:
- if '/' not in path:
- self._cli_parser.error(
- "path '{0}' must include a key name")
+ validate_generic_bucket_name(self.args['bucket'])
def main(self):
self.method = 'DELETE'
- for path in self.args['paths']:
- self.path = path
- self.send()
+ self.path = self.args['bucket']
+ self.send()
--
managing cloud instances for Eucalyptus
More information about the pkg-eucalyptus-commits
mailing list