Commit 6b16a21
authored
fix(cli):
Fixes #370
Fixes #440
Previously when the `--no-notices` option was passed, the CLI would
still attempt to refresh notices in the background. This is unnecessary
and an unexpected behavior to users, especially when running the CLI in
environments with no internet access.
On the other hand, running the explicit `cdk notices` command did
previously not fail if the command failed to refresh notices. Instead
the command would pretend no notices are found and complete
successfully.
This PR updates the code to not refresh notices when notices are
disabled. Unless the explicit `cdk notices` command is called, which
will always refresh and now error if fetching notices fails. It also
removes a double refresh of the notices (which didn't have an effect
because they were cached, but still).
`cdk notices` with an error now looks like this:
<img width="775" alt="image"
src="https://github.com/user-attachments/assets/5c09263c-a775-49c9-8dcf-e4feeefb10ac"
/>
Before the command would incorrectly and silently succeed and not show
any notices:
<img width="118" alt="image"
src="https://github.com/user-attachments/assets/dd93c1bf-4b6a-4fa9-8c9a-1fbacccc0156"
/>
Only when run with the `-v` flag, it would hint at the failure:
```console
$ cdk notices -v
...
[12:38:29] Could not refresh notices: Error: getaddrinfo ENOTFOUND cli.cdk.dev-tools
```
---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 licensecdk notices ignores failures and calling cli with --no-notices makes an unexpected network call (#399)1 parent bd4ad74 commit 6b16a21
File tree
13 files changed
+273
-95
lines changed- packages
- @aws-cdk/toolkit-lib
- lib
- api/notices
- util
- test/api
- environment
- aws-cdk
- .projen
- lib/cli
- test/commands
13 files changed
+273
-95
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1010 | 1010 | | |
1011 | 1011 | | |
1012 | 1012 | | |
| 1013 | + | |
1013 | 1014 | | |
1014 | 1015 | | |
1015 | 1016 | | |
| |||
Lines changed: 22 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
30 | 44 | | |
31 | 45 | | |
32 | 46 | | |
33 | 47 | | |
34 | 48 | | |
35 | 49 | | |
36 | 50 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
49 | 55 | | |
50 | 56 | | |
51 | 57 | | |
| |||
Lines changed: 51 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 22 | | |
29 | 23 | | |
30 | 24 | | |
| |||
48 | 42 | | |
49 | 43 | | |
50 | 44 | | |
51 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
52 | 53 | | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| |||
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
101 | | - | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
115 | | - | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | 139 | | |
142 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
143 | 144 | | |
144 | 145 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
153 | 150 | | |
154 | 151 | | |
155 | 152 | | |
156 | | - | |
| 153 | + | |
157 | 154 | | |
158 | | - | |
159 | | - | |
160 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
161 | 158 | | |
162 | 159 | | |
163 | 160 | | |
164 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
165 | 169 | | |
166 | 170 | | |
167 | | - | |
| 171 | + | |
168 | 172 | | |
169 | 173 | | |
170 | 174 | | |
| |||
173 | 177 | | |
174 | 178 | | |
175 | 179 | | |
176 | | - | |
| 180 | + | |
177 | 181 | | |
178 | 182 | | |
179 | | - | |
| 183 | + | |
180 | 184 | | |
181 | 185 | | |
182 | | - | |
| 186 | + | |
183 | 187 | | |
184 | 188 | | |
185 | 189 | | |
186 | | - | |
| 190 | + | |
187 | 191 | | |
188 | 192 | | |
189 | 193 | | |
190 | 194 | | |
191 | 195 | | |
192 | | - | |
| 196 | + | |
193 | 197 | | |
194 | 198 | | |
195 | 199 | | |
196 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
197 | 216 | | |
| 217 | + | |
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
67 | | - | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
0 commit comments