Skip to content

Commit

Permalink
Merge branch 'master' into fix-root-err
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroProfundis committed Apr 14, 2021
2 parents e87f392 + 3a1296b commit d899163
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions cmd/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func newMirrorSignCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "sign <manifest-file>",
Short: "Add signatures to a manifest file",
Long: fmt.Sprintf("Add signatures to a manifest file, if no key file specified, the ~/.tiup/keys/%s will be used", localdata.DefaultPrivateKeyName),
Long: fmt.Sprintf("Add signatures to a manifest file; if no key file is specified, ~/.tiup/keys/%s will be used", localdata.DefaultPrivateKeyName),
RunE: func(cmd *cobra.Command, args []string) error {
env := environment.GlobalEnv()
if len(args) < 1 {
Expand Down Expand Up @@ -167,7 +167,7 @@ The root manifest in $TIUP_HOME will be replaced with the one in given repositor
log.Errorf("Failed to set mirror: %s\n", err.Error())
return err
}
fmt.Printf("Set mirror to %s success\n", addr)
fmt.Printf("Successfully set mirror to %s\n", addr)
return nil
},
}
Expand All @@ -193,7 +193,7 @@ func newMirrorGrantCmd() *cobra.Command {

id := args[0]
if name == "" {
fmt.Printf("The --name is not specified, using %s as default\n", id)
fmt.Printf("No --name is given, using %s as default\n", id)
name = id
}

Expand Down Expand Up @@ -610,7 +610,7 @@ func newMirrorGenkeyCmd() *cobra.Command {
fmt.Printf("KeyID: %s\nKeyContent: \n%s\n", id, string(content))
} else {
if utils.IsExist(privPath) {
log.Warnf("Warning: private key already exists(%s), skip", privPath)
log.Warnf("Warning: private key already exists (%s), skipped", privPath)
return nil
}

Expand All @@ -634,7 +634,7 @@ func newMirrorGenkeyCmd() *cobra.Command {
return err
}

fmt.Printf("Private key has been writeen to %s\n", privPath)
fmt.Printf("Private key has been written to %s\n", privPath)
}

if saveKey {
Expand All @@ -652,9 +652,9 @@ func newMirrorGenkeyCmd() *cobra.Command {
},
}

cmd.Flags().BoolVarP(&showPublic, "public", "p", showPublic, "show public content")
cmd.Flags().BoolVar(&saveKey, "save", false, "Save public key to a file at current working dir")
cmd.Flags().StringVarP(&name, "name", "n", "private", "the file name of the key")
cmd.Flags().BoolVarP(&showPublic, "public", "p", showPublic, "Show public content")
cmd.Flags().BoolVar(&saveKey, "save", false, "Save public key to a file in the current working dir")
cmd.Flags().StringVarP(&name, "name", "n", "private", "The file name of the key")

return cmd
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/environment/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func Mirror() string {
m := os.Getenv(repository.EnvMirrors)
if m != "" {
if cfg.Mirror != m {
fmt.Printf(`WARNING: both mirror config(%s)
and TIUP_MIRRORS(%s) have been set.
Setting mirror to TIUP_MIRRORS(%s)
fmt.Printf(`WARNING: both mirror config (%s)
and TIUP_MIRRORS (%s) have been set.
Setting mirror to TIUP_MIRRORS (%s)
`, cfg.Mirror, m, m)
reset(m)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/repository/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ func (l *httpMirror) prepareURL(resource string) string {

// Grant implements the model.Backend interface
func (l *httpMirror) Grant(id, name string, key *v1manifest.KeyInfo) error {
return errors.Errorf("introduce a fresher via the internet is not allowd, please set you mirror to a local one")
return errors.Errorf("cannot add a user for a remote mirror, please set your mirror to a local directory")
}

// Rotate implements the model.Backend interface
Expand All @@ -383,7 +383,7 @@ func (l *httpMirror) Rotate(m *v1manifest.Manifest) error {
}
switch resp.StatusCode {
case http.StatusConflict:
return errors.Errorf("The manifest has been modified after you fetch it, please try again")
return errors.Errorf("The manifest has been modified after you fetched it, please try again")
case http.StatusBadRequest:
return errors.Errorf("The server rejected the manifest, please check if it's a valid root manifest")
default:
Expand Down
2 changes: 1 addition & 1 deletion pkg/repository/v1manifest/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,5 +300,5 @@ func (e *LoadManifestError) Is(target error) bool {
}

return (e.manifest == t.manifest || t.manifest == "") &&
(errors.Is(e.err, t) || t.err == nil)
(errors.Is(e.err, t.err) || t.err == nil)
}

0 comments on commit d899163

Please sign in to comment.