]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: AuthMonitor: formatted output to 'auth get-or-create[-key]'
authorDan Mick <dan.mick@inktank.com>
Wed, 10 Jul 2013 23:47:15 +0000 (16:47 -0700)
committerDan Mick <dan.mick@inktank.com>
Thu, 11 Jul 2013 02:02:31 +0000 (19:02 -0700)
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/AuthMonitor.cc

index 9d6f26aa9dfe60a35ce80e2be5abee4a17a23512..c328d0c56ba88706ad2b361725ba3f8e408a82eb 100644 (file)
@@ -788,11 +788,19 @@ bool AuthMonitor::prepare_command(MMonCommand *m)
       }
 
       if (prefix == "auth get-or-create-key") {
-       ds << entity_auth.key;
+        if (f) {
+          entity_auth.key.encode_formatted("auth", f.get(), rdata);
+        } else {
+          ds << entity_auth.key;
+        }
       } else {
        KeyRing kr;
        kr.add(entity, entity_auth.key);
-       kr.encode_plaintext(rdata);
+        if (f) {
+          kr.encode_formatted("auth", f.get(), rdata);
+        } else {
+          kr.encode_plaintext(rdata);
+        }
       }
       err = 0;
       goto done;
@@ -827,11 +835,19 @@ bool AuthMonitor::prepare_command(MMonCommand *m)
     push_cephx_inc(auth_inc);
 
     if (prefix == "auth get-or-create-key") {
-      ds << auth_inc.auth.key;
+      if (f) {
+        auth_inc.auth.key.encode_formatted("auth", f.get(), rdata);
+      } else {
+        ds << auth_inc.auth.key;
+      }
     } else {
       KeyRing kr;
       kr.add(entity, auth_inc.auth.key);
-      kr.encode_plaintext(rdata);
+      if (f) {
+        kr.encode_formatted("auth", f.get(), rdata);
+      } else {
+        kr.encode_plaintext(rdata);
+      }
     }
 
     rdata.append(ds);