Browse code

FEATBL-665 Fix: bm-cli move index

David Phan authored on 05/12/2018 06:04:35
Showing 1 changed files
... ...
@@ -80,9 +80,8 @@ public class MoveCommand implements ICmdLet, Runnable {
80 80
 			throw new ServerFault("Mailbox not found");
81 81
 		}
82 82
 
83
-		IMailboxMgmt mboxMgmtApi = ctx.adminApi().instance(IMailboxMgmt.class, domain.uid);
84
-
85 83
 		if (dest == null || dest.isEmpty()) {
84
+			IMailboxMgmt mboxMgmtApi = ctx.adminApi().instance(IMailboxMgmt.class, "global.virt");
86 85
 			List<ShardStats> shards = mboxMgmtApi.getShardsStats();
87 86
 			ShardStats shard = null;
88 87
 			Iterator<ShardStats> it = shards.iterator();
... ...
@@ -100,8 +99,10 @@ public class MoveCommand implements ICmdLet, Runnable {
100 100
 			}
101 101
 
102 102
 			dest = shard.indexName;
103
-		}
104 103
 
104
+			System.out.println(String.format("Move index %s to %s", mailbox, dest));
105
+		}
106
+		IMailboxMgmt mboxMgmtApi = ctx.adminApi().instance(IMailboxMgmt.class, domain.uid);
105 107
 		TaskRef tr = mboxMgmtApi.moveIndex(mailbox, dest);
106 108
 		Tasks.follow(ctx, tr);
107 109
 	}