Verified Commit de26ffde authored by Karel Koci's avatar Karel Koci 🤘
Browse files

approvals: fix exception on approval required

The autorun.auto_approve_time() returns None in case of approvals are
required. Instead of checking if it is not None we checked old condition
and that if it is larger than 0.

This was casing update blockage in case approvals were configured as
required.
parent 7e3b9b0f
......@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- exception raised when "approvals needed" was configured there was pending
approval
## [1.3.2] - 2020-08-17
### Changed
- pkgupdate is now not run with `--task-log`
......
......@@ -154,7 +154,7 @@ def _approved():
with open(const.APPROVALS_STAT_FILE, 'r') as file:
cols = file.readline().split(' ')
auto_grant_time = autorun.auto_approve_time()
if cols[1].strip() == 'granted' or (auto_grant_time > 0 and int(cols[2]) < (time.time() - (auto_grant_time * 3600))):
if cols[1].strip() == 'granted' or (auto_grant_time and int(cols[2]) < (time.time() - (auto_grant_time * 3600))):
return cols[0]
return None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment