Index: openacs-4/packages/acs-admin/tcl/acs-admin-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/tcl/acs-admin-procs.tcl,v diff -u -N -r1.2 -r1.2.2.1 --- openacs-4/packages/acs-admin/tcl/acs-admin-procs.tcl 27 Sep 2018 09:01:24 -0000 1.2 +++ openacs-4/packages/acs-admin/tcl/acs-admin-procs.tcl 4 Sep 2019 17:38:04 -0000 1.2.2.1 @@ -9,11 +9,14 @@ namespace eval acs_admin { ad_proc ::acs_admin::check_expired_certificates {} { + Check expire-dates of certificates and send warning emails to + the admin. In case HTTPS is not configured via the "nsssl" + driver, or the command line tool "openssl" openssl is + installed, the proc does nothing. - Check expire-dates of certificates and send warning - emails to the admin. In case HTTPS is not configured via the - "nsssl" driver, or the command line tool "openssl" openssl is - installed, the proc does nothing. } { + @return boolean telling whether expired certificates existed + (true) or not (false) + } { set openssl [util::which openssl] if {[info commands ns_driver] ne "" && $openssl ne ""} { @@ -77,6 +80,8 @@ "Your friendly daemon" \n] } } + + return [expr {[llength $critCertInfo] > 0}] } } } Index: openacs-4/packages/acs-admin/tcl/test/acs-admin-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/tcl/test/acs-admin-procs.tcl,v diff -u -N -r1.6 -r1.6.2.1 --- openacs-4/packages/acs-admin/tcl/test/acs-admin-procs.tcl 19 Jul 2018 12:15:19 -0000 1.6 +++ openacs-4/packages/acs-admin/tcl/test/acs-admin-procs.tcl 4 Sep 2019 17:38:04 -0000 1.6.2.1 @@ -27,6 +27,31 @@ } } +aa_register_case -cats { + api smoke +} -procs { + acs_admin::check_expired_certificates +} acs_admin_check_expired_certificates { + Check acs_admin::check_expired_certificates +} { + nsv_set __acs_admin_get_expired_certificates email_sent_p false + aa_stub acs_mail_lite::send { + nsv_set __acs_admin_get_expired_certificates email_sent_p true + } + + set expired_certificates_p [::acs_admin::check_expired_certificates] + + if {$expired_certificates_p} { + aa_true "Expired certificates have been found. Need to send an email." \ + [nsv_get __acs_admin_get_expired_certificates email_sent_p] + } else { + aa_log "No expired certificates... Nothing to do." + } + + nsv_unset __acs_admin_get_expired_certificates +} + + # Local variables: # mode: tcl # tcl-indent-level: 4