@@ -126,6 +126,11 @@ impl Lint {
126126 root_type : None ,
127127 }
128128 }
129+
130+ const fn set_root_type ( mut self , v : RootType ) -> Self {
131+ self . root_type = Some ( v) ;
132+ self
133+ }
129134}
130135
131136pub ( crate ) fn lint_list ( output : impl std:: io:: Write ) -> Result < ( ) > {
@@ -245,17 +250,16 @@ fn check_var_run(root: &Dir) -> LintResult {
245250}
246251
247252#[ 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! { "
251256 Check for an invalid /etc/hostname or /etc/resolv.conf that may have been injected by
252257 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 ) ;
259263fn check_buildah_injected ( root : & Dir ) -> LintResult {
260264 const RUNTIME_INJECTED : & [ & str ] = & [ "etc/hostname" , "etc/resolv.conf" ] ;
261265 for ent in RUNTIME_INJECTED {
@@ -499,10 +503,9 @@ fn check_varlog(root: &Dir) -> LintResult {
499503}
500504
501505#[ 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#"
506509Check for content in /var that does not have corresponding systemd tmpfiles.d entries.
507510This can cause a problem across upgrades because content in /var from the container
508511image 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,
511514and use systemd tmpfiles.d to generate empty directories and compatibility symbolic links
512515as part of each boot.
513516"# } ,
514- f : check_var_tmpfiles,
515- root_type : Some ( RootType :: Running ) ,
516- } ;
517+ check_var_tmpfiles,
518+ )
519+ . set_root_type ( RootType :: Running ) ;
517520fn check_var_tmpfiles ( _root : & Dir ) -> LintResult {
518521 let r = bootc_tmpfiles:: find_missing_tmpfiles_current_root ( ) ?;
519522 if r. tmpfiles . is_empty ( ) && r. unsupported . is_empty ( ) {
@@ -546,10 +549,9 @@ fn check_var_tmpfiles(_root: &Dir) -> LintResult {
546549}
547550
548551#[ 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#"
553555Check for users in /etc/passwd and groups in /etc/group that do not have corresponding
554556systemd sysusers.d entries in /usr/lib/sysusers.d.
555557This 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
560562on system startup alongside other users.
561563
562564More 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+ ) ;
567568fn check_sysusers ( rootfs : & Dir ) -> LintResult {
568569 let r = bootc_sysusers:: analyze ( rootfs) ?;
569570 if r. is_empty ( ) {
0 commit comments