@@ -127,7 +127,7 @@ export const cockpitApi = contentSourcesApi.injectEndpoints({
127
127
...parsed ,
128
128
id,
129
129
version : version ,
130
- last_modified_at : new Date ( bpInfo ! . mtime * 1000 ) . toString ( ) ,
130
+ last_modified_at : new Date ( bpInfo ! . mtime ! * 1000 ) . toString ( ) ,
131
131
// linting is not supported on prem
132
132
lint : {
133
133
errors : [ ] ,
@@ -517,37 +517,36 @@ export const cockpitApi = contentSourcesApi.injectEndpoints({
517
517
try {
518
518
const workerConfig = cockpit . file (
519
519
'/etc/osbuild-worker/osbuild-worker.toml' ,
520
- {
521
- superuser : 'required' ,
522
- } ,
523
520
) ;
524
521
525
- const contents = await workerConfig . modify ( ( prev : string ) => {
526
- if ( ! updateWorkerConfigRequest ) {
527
- return prev ;
528
- }
529
-
530
- const merged = {
531
- ...TOML . parse ( prev ) ,
532
- ...updateWorkerConfigRequest ,
533
- } as WorkerConfigFile ;
534
-
535
- const contents : WorkerConfigFile = { } ;
536
- Object . keys ( merged ) . forEach ( ( key : string ) => {
537
- // this check helps prevent saving empty objects
538
- // into the osbuild-worker.toml config file.
539
- if ( merged [ key ] !== undefined ) {
540
- contents [ key ] = Section ( {
541
- ...merged [ key ] ,
542
- } ) ;
522
+ const contents = await workerConfig . modify (
523
+ ( prev : string | null ) => {
524
+ if ( ! updateWorkerConfigRequest ) {
525
+ return prev ;
543
526
}
544
- } ) ;
545
527
546
- return TOML . stringify ( contents , {
547
- newline : '\n' ,
548
- newlineAround : 'document' ,
549
- } ) ;
550
- } ) ;
528
+ const merged = {
529
+ ...TOML . parse ( prev ?? '' ) ,
530
+ ...updateWorkerConfigRequest ,
531
+ } as WorkerConfigFile ;
532
+
533
+ const contents : WorkerConfigFile = { } ;
534
+ Object . keys ( merged ) . forEach ( ( key : string ) => {
535
+ // this check helps prevent saving empty objects
536
+ // into the osbuild-worker.toml config file.
537
+ if ( merged [ key ] !== undefined ) {
538
+ contents [ key ] = Section ( {
539
+ ...merged [ key ] ,
540
+ } ) ;
541
+ }
542
+ } ) ;
543
+
544
+ return TOML . stringify ( contents , {
545
+ newline : '\n' ,
546
+ newlineAround : 'document' ,
547
+ } ) ;
548
+ } ,
549
+ ) ;
551
550
552
551
const systemServices = [
553
552
'osbuild-composer.socket' ,
0 commit comments