commit 91fc9266af186199e91c78cf8c3c48ab59e7ef53
Author: Sofia Papagiannaki <spapagian@grnet.gr>
Date:   Tue Dec 3 15:58:37 2013 +0200

    pithos: Slight modifications in file-show command
    
    * Search by object UUID
    * Do not display hashmap by default

diff --git a/snf-pithos-app/pithos/api/management/commands/file-show.py b/snf-pithos-app/pithos/api/management/commands/file-show.py
index 17d4a8a..35d6c20 100644
--- a/snf-pithos-app/pithos/api/management/commands/file-show.py
+++ b/snf-pithos-app/pithos/api/management/commands/file-show.py
@@ -38,11 +38,11 @@ from optparse import make_option
 from snf_django.management.commands import SynnefoCommand
 from snf_django.management import utils
 
-from pithos.api.util import get_backend, update_public_meta
+from pithos.api.util import get_backend, update_public_meta, is_uuid
 
 
 class Command(SynnefoCommand):
-    args = "<account> <container> <object>"
+    args = "<account> <container> <object> or <object uuid>"
     help = """Show file information"""
 
     option_list = SynnefoCommand.option_list + (
@@ -52,18 +52,30 @@ class Command(SynnefoCommand):
         make_option("--domain", dest="domain",
                     default='pithos',
                     help="Show file attributes from the specific domain."),
+        make_option("--hashmap", dest="hashmap",
+                    default=False,
+                    action='store_true',
+                    help="Display also the object hashmap")
     )
 
     def handle(self, *args, **options):
-        if len(args) != 3:
-            raise CommandError("Invalid number of arguments")
-
         success_status = False
         try:
             b = get_backend()
             b.pre_exec()
 
-            account, container, name = args
+            if len(args) == 3:
+                account, container, name = args
+            elif len(args) == 1:
+                if not is_uuid(args[0]):
+                    raise CommandError('Invalid UUID')
+                try:
+                    account, container, name = b.get_uuid(
+                        None, args[0], check_permissions=False)
+                except NameError:
+                    raise CommandError('Unknown UUID')
+            else:
+                raise CommandError("Invalid number of arguments")
 
             kv = b.get_object_meta(account, account, container, name,
                                    options['domain'], options['obj_version'])
@@ -80,9 +92,10 @@ class Command(SynnefoCommand):
                 if public is not None:
                     update_public_meta(public, kv)
 
-            kv['hashmap'] = b.get_object_hashmap(account, account, container,
-                                                 name,
-                                                 options['obj_version'])[-1]
+            if options['hashmap']:
+                _, kv['hashmap'] = b.get_object_hashmap(account, account,
+                                                        container, name,
+                                                        options['obj_version'])
 
             utils.pprint_table(self.stdout, [kv.values()], kv.keys(),
                                options["output_format"], vertical=True)
diff --git a/snf-pithos-backend/pithos/backends/modular.py b/snf-pithos-backend/pithos/backends/modular.py
index 2f4bd92..7d2d513 100644
--- a/snf-pithos-backend/pithos/backends/modular.py
+++ b/snf-pithos-backend/pithos/backends/modular.py
@@ -1367,7 +1367,7 @@ class ModularBackend(BaseBackend):
 
     @debug_method
     @backend_method
-    def get_uuid(self, user, uuid):
+    def get_uuid(self, user, uuid, check_permissions=True):
         """Return the (account, container, name) for the UUID given."""
 
         info = self.node.latest_uuid(uuid, CLUSTER_NORMAL)
@@ -1375,7 +1375,8 @@ class ModularBackend(BaseBackend):
             raise NameError
         path, serial = info
         account, container, name = path.split('/', 2)
-        self._can_read(user, account, container, name)
+        if check_permissions:
+            self._can_read(user, account, container, name)
         return (account, container, name)
 
     @debug_method
