@@ -126,6 +126,11 @@ impl Lint {
126
126
root_type : None ,
127
127
}
128
128
}
129
+
130
+ const fn set_root_type ( mut self , v : RootType ) -> Self {
131
+ self . root_type = Some ( v) ;
132
+ self
133
+ }
129
134
}
130
135
131
136
pub ( crate ) fn lint_list ( output : impl std:: io:: Write ) -> Result < ( ) > {
@@ -245,17 +250,16 @@ fn check_var_run(root: &Dir) -> LintResult {
245
250
}
246
251
247
252
#[ distributed_slice( LINTS ) ]
248
- static LINT_BUILDAH_INJECTED : Lint = Lint {
249
- name : "buildah-injected" ,
250
- description : indoc:: indoc! { "
253
+ static LINT_BUILDAH_INJECTED : Lint = Lint :: new_warning (
254
+ "buildah-injected" ,
255
+ indoc:: indoc! { "
251
256
Check for an invalid /etc/hostname or /etc/resolv.conf that may have been injected by
252
257
a container build system." } ,
253
- ty : LintType :: Warning ,
254
- f : check_buildah_injected,
255
- // This one doesn't make sense to run looking at the running root,
256
- // because we do expect /etc/hostname to be injected as
257
- root_type : Some ( RootType :: Alternative ) ,
258
- } ;
258
+ check_buildah_injected,
259
+ )
260
+ // This one doesn't make sense to run looking at the running root,
261
+ // because we do expect /etc/hostname to be injected as
262
+ . set_root_type ( RootType :: Alternative ) ;
259
263
fn check_buildah_injected ( root : & Dir ) -> LintResult {
260
264
const RUNTIME_INJECTED : & [ & str ] = & [ "etc/hostname" , "etc/resolv.conf" ] ;
261
265
for ent in RUNTIME_INJECTED {
@@ -499,10 +503,9 @@ fn check_varlog(root: &Dir) -> LintResult {
499
503
}
500
504
501
505
#[ distributed_slice( LINTS ) ]
502
- static LINT_VAR_TMPFILES : Lint = Lint {
503
- name : "var-tmpfiles" ,
504
- ty : LintType :: Warning ,
505
- description : indoc ! { r#"
506
+ static LINT_VAR_TMPFILES : Lint = Lint :: new_warning (
507
+ "var-tmpfiles" ,
508
+ indoc ! { r#"
506
509
Check for content in /var that does not have corresponding systemd tmpfiles.d entries.
507
510
This can cause a problem across upgrades because content in /var from the container
508
511
image will only be applied on the initial provisioning.
@@ -511,9 +514,9 @@ Instead, it's recommended to have /var effectively empty in the container image,
511
514
and use systemd tmpfiles.d to generate empty directories and compatibility symbolic links
512
515
as part of each boot.
513
516
"# } ,
514
- f : check_var_tmpfiles,
515
- root_type : Some ( RootType :: Running ) ,
516
- } ;
517
+ check_var_tmpfiles,
518
+ )
519
+ . set_root_type ( RootType :: Running ) ;
517
520
fn check_var_tmpfiles ( _root : & Dir ) -> LintResult {
518
521
let r = bootc_tmpfiles:: find_missing_tmpfiles_current_root ( ) ?;
519
522
if r. tmpfiles . is_empty ( ) && r. unsupported . is_empty ( ) {
@@ -546,10 +549,9 @@ fn check_var_tmpfiles(_root: &Dir) -> LintResult {
546
549
}
547
550
548
551
#[ distributed_slice( LINTS ) ]
549
- static LINT_SYSUSERS : Lint = Lint {
550
- name : "sysusers" ,
551
- ty : LintType :: Warning ,
552
- description : indoc ! { r#"
552
+ static LINT_SYSUSERS : Lint = Lint :: new_warning (
553
+ "sysusers" ,
554
+ indoc ! { r#"
553
555
Check for users in /etc/passwd and groups in /etc/group that do not have corresponding
554
556
systemd sysusers.d entries in /usr/lib/sysusers.d.
555
557
This can cause a problem across upgrades because if /etc is not transient and is locally
@@ -560,10 +562,9 @@ Using systemd-sysusers to allocate users and groups will ensure that these are a
560
562
on system startup alongside other users.
561
563
562
564
More on this topic in <https://containers.github.io/bootc/building/users-and-groups.html>
563
- "# } ,
564
- f : check_sysusers,
565
- root_type : None ,
566
- } ;
565
+ "# } ,
566
+ check_sysusers,
567
+ ) ;
567
568
fn check_sysusers ( rootfs : & Dir ) -> LintResult {
568
569
let r = bootc_sysusers:: analyze ( rootfs) ?;
569
570
if r. is_empty ( ) {
0 commit comments