Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | cmd/hancock: adjust verbosity of messages |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
776783b92d2aa2810139fad5cd22563e |
User & Date: | dnc 2020-03-02 02:03:05 |
Context
2020-03-02
| ||
02:03 | cmd/hancock: encode manifest with newlines and tabs check-in: 7fa912b1c1 user: dnc tags: trunk | |
02:03 | cmd/hancock: adjust verbosity of messages check-in: 776783b92d user: dnc tags: trunk | |
2020-01-09
| ||
22:00 | minor updates to README check-in: ebbf8a6065 user: dnc tags: trunk | |
Changes
Changes to cmd/hancock/testimony.go.
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
...
157
158
159
160
161
162
163
164
165
166
167
168
169
|
var authorityEncoded model.Authority err = dec.Decode(&authorityEncoded) command.Check(err) // ensure key parses public, _, _, _, err := ssh.ParseAuthorizedKey([]byte(authorityEncoded)) // NOT ssh.ParsePublicKey() command.Check(err) _ = public // may be used in filename // following the public key, we read pairs; each pair a manifest followed by testimony for { var rawMan json.RawMessage err = dec.Decode(&rawMan) if err == io.EOF { break ................................................................................ if !*noopFlag { tkey, err := remote.PutTestimony(testimony) if err != nil { command.Errorf("failed to publish testimony (%q) to %q: %s", man.Path, remote, err) continue } command.V(1).Infof("%q testimony key: %s", man.Path, tkey) } } return nil } |
|
>
>
>
>
>
|
|
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
...
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
var authorityEncoded model.Authority err = dec.Decode(&authorityEncoded) command.Check(err) // ensure key parses public, _, _, _, err := ssh.ParseAuthorizedKey([]byte(authorityEncoded)) // NOT ssh.ParsePublicKey() command.Check(err) _ = public // might want to include this in filename count := 0 // for summary message // following the public key, we read pairs; each pair a manifest followed by testimony for { var rawMan json.RawMessage err = dec.Decode(&rawMan) if err == io.EOF { break ................................................................................ if !*noopFlag { tkey, err := remote.PutTestimony(testimony) if err != nil { command.Errorf("failed to publish testimony (%q) to %q: %s", man.Path, remote, err) continue } count++ command.V(1).Infof("%q testimony key: %s", man.Path, tkey) } } if count > 0 { command.Infof("published testimony (%d items)", count) } return nil } |
Changes to cmd/hancock/verify.go.
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
currentDir := filepath.Dir(currentFile) _, ok := summary[currentDir] if !ok { summary[currentDir] = make(SummaryMessages) } timestamp := time.Unix(manifest.Time, 0) for _, m := range manifest.Message { msg := fmt.Sprintf("%s (%s) by %s: %s", typ, model.QualityString(manifest.Quality), authorityName, m) count, _ := summary[currentDir][msg] summary[currentDir][msg] = count + 1 if command.V(1) { // control verbosity if currentFile == manifest.Path { command.Errorf("%q %s on %s: %s", currentFile, manifest.Role, timestamp.Format(time.RFC850), msg) } else { command.Errorf("%q (as %q) %s on %s: %s", currentFile, manifest.Path, manifest.Role, timestamp.Format(time.RFC850), msg) } } } if len(manifest.Message) == 0 { // no explicit message msg := fmt.Sprintf("%s (%s) by %s", typ, model.QualityString(manifest.Quality), authorityName) count, _ := summary[currentDir][msg] summary[currentDir][msg] = count + 1 if command.V(1) { // control verbosity if currentFile == manifest.Path { command.Errorf("%q %s on %s: %s", currentFile, manifest.Role, timestamp.Format(time.RFC850), msg) } else { command.Errorf("%q (as %q) %s on %s: %s", currentFile, manifest.Path, manifest.Role, timestamp.Format(time.RFC850), msg) } } } } ................................................................................ verifyStoreFlag command.StringSet ) func verifyMain() error { cfg, err := command.Config() command.Check(err) defaultStore := cfg.Section("").Key("store").MustString("http://localhost:3344") strictFlag := command.OperationFlagSet.Bool("strict", false, "strict mode requires source to be endorsed") command.OperationFlagSet.Var(&verifyStoreFlag, "store", fmt.Sprintf("URL of testimony store (default %s)", defaultStore)) recurseFlag := command.OperationFlagSet.Bool("r", false, "verify all files in directory") err = command.ParseOperationFlagSet() if err != nil { return err } |
>
>
>
>
>
|
|
|
|
|
|
|
|
>
|
>
>
>
|
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
currentDir := filepath.Dir(currentFile) _, ok := summary[currentDir] if !ok { summary[currentDir] = make(SummaryMessages) } timestamp := time.Unix(manifest.Time, 0) verbosityThreshold := 2 // less verbose when endorsed if manifest.Quality != model.Valid { verbosityThreshold = 1 // more verbose when repudiated } for _, m := range manifest.Message { msg := fmt.Sprintf("%s (%s) by %s (%s): %q on %s", typ, model.QualityString(manifest.Quality), authorityName, manifest.Role, m, timestamp.Format(time.RFC850)) count, _ := summary[currentDir][msg] summary[currentDir][msg] = count + 1 if command.V(verbosityThreshold) { // control verbosity if currentFile == manifest.Path { command.Errorf("%q: %s", currentFile, msg) } else { command.Errorf("%q (as %q): %s", currentFile, manifest.Path, msg) } } } if len(manifest.Message) == 0 { // no explicit message msg := fmt.Sprintf("%s (%s) by %s (%s)", typ, model.QualityString(manifest.Quality), authorityName, manifest.Role) count, _ := summary[currentDir][msg] summary[currentDir][msg] = count + 1 if command.V(verbosityThreshold) { // control verbosity if currentFile == manifest.Path { command.Errorf("%q: %s on %s", currentFile, msg, timestamp.Format(time.RFC850)) } else { command.Errorf("%q (as %q): %s on %s", currentFile, manifest.Path, msg, timestamp.Format(time.RFC850)) } } } } ................................................................................ verifyStoreFlag command.StringSet ) func verifyMain() error { cfg, err := command.Config() command.Check(err) // defaults cfgTop := cfg.Section("") cfgOp := cfg.Section("verify") defaultStore := cfgOp.Key("store").MustString(cfgTop.Key("store").MustString("https://hancock.beyondcentral.com")) strictFlag := command.OperationFlagSet.Bool("strict", true, "strict mode requires source to be endorsed") command.OperationFlagSet.Var(&verifyStoreFlag, "store", fmt.Sprintf("URL of testimony store (default %s)", defaultStore)) recurseFlag := command.OperationFlagSet.Bool("r", false, "verify all files in directory") err = command.ParseOperationFlagSet() if err != nil { return err } |