Skip to content

Commit 9290444

Browse files
committed
utils: Limit scope of limit variable
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
1 parent 3c6a83f commit 9290444

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ def prepare_initrd(architecture, rootfs_format='cpio'):
187187
# First, make sure that the current user is not rate limited by GitHub,
188188
# otherwise the next API call will not return valid information.
189189
gh_json_rl = get_gh_json('https://api.github.com/rate_limit')
190-
limit = gh_json_rl['resources']['core']['limit']
191190
remaining = gh_json_rl['resources']['core']['remaining']
192191

193192
# If we have API calls remaining, we can query for the latest release to
@@ -206,6 +205,7 @@ def prepare_initrd(architecture, rootfs_format='cpio'):
206205
if cur_rel != latest_rel:
207206
download_initrd(gh_json_rel, src)
208207
elif not src.exists():
208+
limit = gh_json_rl['resources']['core']['limit']
209209
raise RuntimeError(
210210
f"Cannot query GitHub API for latest images release due to rate limit (remaining: {remaining}, limit: {limit}) and {src} does not exist already! "
211211
'Download it manually or supply a GitHub personal access token via the GITHUB_TOKEN environment variable to make an authenticated GitHub API request.'

0 commit comments

Comments
 (0)