File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -90,13 +90,16 @@ def _write_autoremove_pending(registry, cache):
90
90
def _write_cache_timestamps (registry ):
91
91
g = Gauge ('apt_package_cache_timestamp_seconds' , "Apt update last run time." , registry = registry )
92
92
apt_pkg .init_config ()
93
- if apt_pkg .config .find_b ("APT::Periodic::Update-Package-Lists" ):
93
+ if (
94
+ apt_pkg .config .find_b ("APT::Periodic::Update-Package-Lists" ) and
95
+ os .path .isfile ("/var/lib/apt/periodic/update-success-stamp" )
96
+ ):
94
97
# if we run updates automatically with APT::Periodic, we can
95
- # check this timestamp file
98
+ # check this timestamp file if it exists
96
99
stamp_file = "/var/lib/apt/periodic/update-success-stamp"
97
100
else :
98
- # if not, let's just fallback on the lists directory
99
- stamp_file = '/var/lib/apt/lists'
101
+ # if not, let's just fallback on the partial file of the lists directory
102
+ stamp_file = '/var/lib/apt/lists/partial '
100
103
try :
101
104
g .set (os .stat (stamp_file ).st_mtime )
102
105
except OSError :
You can’t perform that action at this time.
0 commit comments