11#!/usr/bin/env python3
22# -*- coding: utf-8; py-indent-offset: 4; max-line-length: 100 -*-
33
4- # Copyright (C) 2025 Christopher Pommer <cp.software@outlook.de>
4+ # Copyright (C) 2024, 2025 Christopher Pommer <cp.software@outlook.de>
55
66# This program is free software; you can redistribute it and/or
77# modify it under the terms of the GNU General Public License
@@ -94,25 +94,24 @@ def check_ms_intune_apple_ade_tokens(
9494 item : str , params : Mapping [str , Any ], section : Section
9595) -> CheckResult :
9696 token = section .get (item )
97- if not token :
97+ if token is None :
9898 return
9999
100100 params_levels_token_expiration = params .get ("token_expiration" )
101101
102- token_expiration_datetime = datetime .fromisoformat (token .token_expiration )
103- token_expiration_timestamp = token_expiration_datetime .timestamp ()
104- token_expiration_timestamp_render = render .datetime (int (token_expiration_timestamp ))
102+ token_expiration_timestamp = datetime .fromisoformat (token .token_expiration ).timestamp ()
103+ token_expiration_timestamp_render = render .datetime (token_expiration_timestamp )
105104
106105 token_expiration_timespan = token_expiration_timestamp - datetime .now ().timestamp ()
107106
108- result_details = (
109- f"Expiration time: { token_expiration_timestamp_render } "
110- f"\n Token name: { token .token_name } "
111- f"\n Token ID: { token .token_id } "
112- f"\n Token type: { token .token_type } "
113- f"\n Apple ID: { token .token_appleid } "
114- )
115- result_summary = f"Expiration time: { token_expiration_timestamp_render } "
107+ token_details_list = [
108+ f"Expiration time: { token_expiration_timestamp_render } " ,
109+ f"Token name: { token .token_name } " ,
110+ f"Token ID: { token .token_id } " ,
111+ f"Token type: { token .token_type } " ,
112+ f"Apple ID: { token .token_appleid } " ,
113+ ]
114+ result_details = " \n " . join ( token_details_list )
116115
117116 if token_expiration_timespan > 0 :
118117 yield from check_levels (
@@ -131,7 +130,7 @@ def check_ms_intune_apple_ade_tokens(
131130
132131 yield Result (
133132 state = State .OK ,
134- summary = result_summary ,
133+ summary = f"Expiration time: { token_expiration_timestamp_render } " ,
135134 details = result_details ,
136135 )
137136
0 commit comments