(args []string)
| 92 | } |
| 93 | |
| 94 | func (c *syncCmd) RunCommand(args []string) error { |
| 95 | if c.loop && !c.removeSrc { |
| 96 | return cmdmain.UsageError("Can't use --loop without --removesrc") |
| 97 | } |
| 98 | if c.dumpConfigFlag { |
| 99 | err := c.dumpConfig() |
| 100 | if err != nil { |
| 101 | return fmt.Errorf("dumb-config failed: %v", err) |
| 102 | } |
| 103 | return nil |
| 104 | } |
| 105 | if c.all { |
| 106 | err := c.syncAll() |
| 107 | if err != nil { |
| 108 | return fmt.Errorf("sync all failed: %v", err) |
| 109 | } |
| 110 | return nil |
| 111 | } |
| 112 | |
| 113 | ss, err := c.storageFromParam("src", c.src) |
| 114 | if err != nil { |
| 115 | return err |
| 116 | } |
| 117 | ds, err := c.storageFromParam("dest", c.dest) |
| 118 | if err != nil { |
| 119 | return err |
| 120 | } |
| 121 | ts, err := c.storageFromParam("thirdleg", c.third) |
| 122 | if err != nil { |
| 123 | return err |
| 124 | } |
| 125 | |
| 126 | differentKeyIDs := fmt.Sprintf("WARNING: the source server GPG key ID (%v) and the destination's (%v) differ. All blobs will be synced, but because the indexer at the other side is indexing claims by a different user, you may not see what you expect in that server's web UI, etc.", c.srcKeyID, c.destKeyID) |
| 127 | |
| 128 | if c.dest != "stdout" && !c.oneIsDisk && c.srcKeyID != c.destKeyID { // both blank is ok. |
| 129 | // Warn at the top (and hope the user sees it and can abort if it was a mistake): |
| 130 | fmt.Fprintln(cmdmain.Stderr, differentKeyIDs) |
| 131 | // Warn also at the end (in case the user missed the first one) |
| 132 | defer fmt.Fprintln(cmdmain.Stderr, differentKeyIDs) |
| 133 | } |
| 134 | |
| 135 | passNum := 0 |
| 136 | for { |
| 137 | passNum++ |
| 138 | stats, err := c.doPass(ss, ds, ts) |
| 139 | cmdmain.Logf("sync stats - pass: %d, blobs: %d, bytes %d\n", passNum, stats.BlobsCopied, stats.BytesCopied) |
| 140 | if err != nil { |
| 141 | return fmt.Errorf("sync failed: %v", err) |
| 142 | } |
| 143 | if !c.loop { |
| 144 | break |
| 145 | } |
| 146 | } |
| 147 | return nil |
| 148 | } |
| 149 | |
| 150 | // A storageType is one of "src", "dest", or "thirdleg". These match the flag names. |
| 151 | type storageType string |
nothing calls this directly
no test coverage detected