@@ -16,7 +16,7 @@ fn main() {
16
16
// Display start time
17
17
let start_ts = timestamp();
18
18
let start_time = datetime_local();
19
- print(` Starting at ${start_time}`);
19
+ debug(`info| Starting at ${start_time}`);
20
20
21
21
let conf = process_cli(argv);
22
22
switch type_of(conf) {
@@ -58,7 +58,7 @@ fn main() {
58
58
print(`The SP probably needs to be reset before continuing`);
59
59
print(`Trying to abort the update with id=${id}`);
60
60
let r = faux_mgs(["update-abort", component, `${id}`]);
61
- debug(`update-abort = ${r}`);
61
+ debug(`info| update-abort = ${r}`);
62
62
}
63
63
}
64
64
if problems == 0 {
@@ -107,7 +107,7 @@ fn main() {
107
107
}
108
108
109
109
// Update RoT with baseline image
110
- debug(`Flash baseline rot hubris`);
110
+ debug(`info| Flash baseline rot hubris`);
111
111
if flash_rot && !update_rot_hubris(conf.base.rot_a, conf.base.rot_b) {
112
112
return 1
113
113
}
@@ -120,7 +120,7 @@ fn main() {
120
120
let result = image_check("base", images);
121
121
if result?.error != () || result.ok.sp || result.ok.rot {
122
122
// Not able to check images or one or both base images not installed.
123
- debug(`image_check error or failed BASE image updates: ${result}`);
123
+ debug(`warn| image_check error or failed BASE image updates: ${result}`);
124
124
return 1;
125
125
}
126
126
}
@@ -145,21 +145,24 @@ fn main() {
145
145
}
146
146
] {
147
147
print("");
148
+
149
+ debug(`info|${v.up_down} Rot Hubris to ${v.label} image`);
150
+ if !update_rot_hubris(v.rot_a_path, v.rot_b_path) {
151
+ debug(`error|Failed to ${v.up_down} RoT Hubris to ${v.label} image: ${r}`);
152
+ return 1
153
+ }
154
+
148
155
print(`## ${v.up_down} to ${v.label} images`);
149
- debug(`${v.up_down} SP Hubris to ${v.label} image`);
156
+ debug(`info| ${v.up_down} SP Hubris to ${v.label} image`);
150
157
if !update_sp(v.sp_path) {
151
- print(` Failed to ${v.up_down} SP Hubris to ${v.label} image: ${r}`);
158
+ debug(`error| Failed to ${v.up_down} SP Hubris to ${v.label} image: ${r}`);
152
159
return 1;
153
160
}
154
- debug(`${v.up_down} Rot Hubris to ${v.label} image`);
155
- if !update_rot_hubris(v.rot_a_path, v.rot_b_path) {
156
- print(`Failed to ${v.up_down} RoT Hubris to ${v.label} image: ${r}`);
157
- return 1
158
- }
161
+
159
162
let result = image_check(v.branch, images);
160
163
if result?.error != () || result.ok.sp || result.ok.rot {
161
164
// Not able to check images or one or both ${branch} images not installed.
162
- debug(`image_check error or failed ${label} image updates: ${result}`);
165
+ debug(`error| image_check error or failed ${label} image updates: ${result}`);
163
166
return 1;
164
167
}
165
168
print(`### SUCCESS: ${v.up_down} to SP and RoT ${v.label} images`);
@@ -242,15 +245,37 @@ fn process_cli(argv) {
242
245
print(`No configuration for image ${branch}.${image}`);
243
246
} else {
244
247
conf[branch][image] = zip_path;
245
- debug(`conf.${branch}.${image}=${zip_path}`);
248
+ debug(`info| conf.${branch}.${image}=${zip_path}`);
246
249
}
247
250
};
248
251
}
249
252
253
+ // If ipcc has been specified, then include that as well
254
+ let faux_ipcc_path = config?.ipcc?.faux_ipcc;
255
+ let x = 1;
256
+ let a = if x == 2 {
257
+ 3
258
+ } else {
259
+ 4
260
+ };
261
+ print(x);
262
+ conf.ipcc = if faux_ipcc_path != () {
263
+ #{
264
+ "use_ipcc": true,
265
+ "faux_ipcc": util::env_expand(config.ipcc.faux_ipcc, config),
266
+ "port": util::env_expand(config.ipcc?.port, config),
267
+ }
268
+ } else {
269
+ #{
270
+ "use_ipcc": false,
271
+ }
272
+ };
273
+
250
274
if conf.verbose {
251
275
print("");
252
276
print(`Parsed conf=${conf}`);
253
277
}
278
+
254
279
conf
255
280
}
256
281
@@ -350,7 +375,7 @@ fn check_update_in_progress(component) {
350
375
let r = faux_mgs(["update-status", component]);
351
376
debug(`update_status(${component})=${r}`);
352
377
if r?.Err != () {
353
- debug(`failed update-status: ${r}`);
378
+ debug(`error| failed update-status: ${r}`);
354
379
return r;
355
380
}
356
381
if r?.Ok == "None" {
@@ -374,7 +399,7 @@ fn check_update_in_progress(component) {
374
399
"id": util::to_hexstring(r.Complete),
375
400
};
376
401
}
377
- debug(`update-status: ${r}`);
402
+ debug(`error| update-status: ${r}`);
378
403
return #{"Err": `unknown update-status: ${r}`};
379
404
}
380
405
@@ -388,7 +413,7 @@ fn update_sp(sp_zip) {
388
413
if r?.ack == "updated" {
389
414
print("flash_sp updated");
390
415
} else {
391
- debug("#### FAILED flash_sp update");
416
+ debug("error| #### FAILED flash_sp update");
392
417
print("FAIL\n");
393
418
return false;
394
419
}
@@ -404,7 +429,7 @@ fn update_sp(sp_zip) {
404
429
let r = faux_mgs(["component-active-slot", "--persist", "-s", "0", "sp"]);
405
430
debug(`persist result = ${r}`);
406
431
if r?["ack"] == () || r.ack != "set" || r.slot != 0 {
407
- debug("Failed to persist");
432
+ debug("error| Failed to persist");
408
433
print("FAIL\n");
409
434
return false;
410
435
}
@@ -414,7 +439,7 @@ fn update_sp(sp_zip) {
414
439
let r = faux_mgs(["reset"]);
415
440
debug(`faux-mgs reset => ${r}`);
416
441
if r?.ack != "reset" {
417
- debug(`unexpected sp reset response: ${r}`);
442
+ debug(`warn| unexpected sp reset response: ${r}`);
418
443
print("FAIL\n");
419
444
return false;
420
445
}
@@ -463,13 +488,13 @@ fn update_rot_hubris(path_a, path_b) {
463
488
let r = faux_mgs(["component-active-slot", "-p", "-s", `${rot_update_slot}`, "rot"]);
464
489
debug(`persist result = ${r}`);
465
490
if r?.ack == () || r.ack != "set" || r.slot != rot_update_slot {
466
- debug(`Failed to persist rot: r=${r}`);
491
+ debug(`error| Failed to persist rot: r=${r}`);
467
492
print("");
468
493
return false;
469
494
}
470
495
let r = faux_mgs(["reset-component", "rot"]);
471
496
if r?.ack != "reset" {
472
- debug(`reset failed: ${r}`);
497
+ debug(`error| reset failed: ${r}`);
473
498
print("");
474
499
return false;
475
500
}
@@ -535,7 +560,7 @@ fn image_check(branch, images) {
535
560
536
561
let need_flash = rot_needs_flashing(`${branch}`, images.by_gitc);
537
562
if need_flash?.error != () {
538
- debug(`Error: ${need_flash}`);
563
+ debug(`error| ${need_flash}`);
539
564
error["rot"] = `${flash_rot}`;
540
565
} else {
541
566
ok["rot"] = need_flash.ok;
@@ -583,13 +608,13 @@ fn rot_needs_flashing(branch, gitc) {
583
608
debug(`gitc[${rot_gitc}]=${gitc?[rot_gitc]}`);
584
609
let known_gitc = gitc?[rot_gitc];
585
610
if known_gitc == () {
586
- print(" the RoT is not running a BASE or UNDER-TEST image.");
611
+ debug("info| the RoT is not running a BASE or UNDER-TEST image.");
587
612
#{"ok": true}
588
613
} else if branch_rot_name in known_gitc {
589
- debug(`${branch_rot_name} IS in ${known_gitc}`);
614
+ debug(`info| ${branch_rot_name} IS in ${known_gitc}`);
590
615
#{"ok": false}
591
616
} else {
592
- debug(`${branch_rot_name} IS NOT in ${known_gitc}`);
617
+ debug(`info| ${branch_rot_name} IS NOT in ${known_gitc}`);
593
618
#{"ok": true}
594
619
}
595
620
}
0 commit comments