From 3e284a729d04e70c0c5c932eb86e4af4ce8b8ff9 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Fri, 10 Jun 2011 14:55:35 -0700 Subject: [PATCH] boto_tool: add put_bucket_acl Signed-off-by: Colin McCabe --- src/obsync/boto_tool | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/obsync/boto_tool b/src/obsync/boto_tool index 06b149c12d87e..17328682b5850 100755 --- a/src/obsync/boto_tool +++ b/src/obsync/boto_tool @@ -82,6 +82,17 @@ def get_bucket_acl(conn, opts): finally: f.close() +def put_bucket_acl(conn, opts): + bucket = conn.get_bucket(opts.bucket_name) + print "setting bucket acl..." + f = open(opts.putacl_file, "r") + try: + xml = f.read() + finally: + f.close() + bucket.set_xml_acl(xml) + return 0 + def bucket_exists(conn, opts): bucket = conn.get_bucket(opts.bucket_name) if (bucket == None): @@ -242,6 +253,8 @@ elif opts.rmbucket: elif not opts.obj_name: if opts.getacl_file: sys.exit(get_bucket_acl(conn, opts)) + elif opts.putacl_file: + sys.exit(put_bucket_acl(conn, opts)) else: sys.exit(bucket_exists(conn, opts)) elif opts.put_file: -- 2.39.5