Skip to content

Comments

Remove printlog from downloadURLFromGit function#978

Merged
scriptingosx merged 1 commit intoInstallomator:mainfrom
KretZoR:patch-2
May 26, 2023
Merged

Remove printlog from downloadURLFromGit function#978
scriptingosx merged 1 commit intoInstallomator:mainfrom
KretZoR:patch-2

Conversation

@KretZoR
Copy link
Contributor

@KretZoR KretZoR commented Apr 6, 2023

The printlog function uses echo which causes unexpected output from the function "downloadURLFromGit".

Example:
In function "downloadURLFromGit", if the downloadURL cannot be read from Github API (which it can't very often because of the Github API ratelimit being set to 60 requests per 60 minutes from the same IP) the "printlog" function used will use an echo to write message to console. However this echo:d message will also be the final output of the function "downloadURLFromGit" since the variable "$downloadURL" is not empty. When running Installomator in DEBUG mode and trying to download dockutil and the x-ratelimit-limit is reached for the IP I request from the function "downloadURLFromGit" will output the following to the variable $downloadURL: "2023-04-05 14:58:22 : INFO : dockutil : GitHub API not returning URL, trying https://github.com/kcrawford/dockutil/releases/latest."

This can also be seen in the console DEBUG output for the $downloadURL variable: 2023-04-05 14:58:23 : DEBUG : dockutil : downloadURL=2023-04-05 14:58:22 : INFO : dockutil : GitHub API not returning URL, trying https://github.com/kcrawford/dockutil/releases/latest.

Source:
https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting

The printlog function uses echo which causes unexpected output from the function "downloadURLFromGit".

Example:
In function "downloadURLFromGit", if the downloadURL cannot be read from Github API (which it can't very often because of the Github API ratelimit being set to 60 requests per 60 minutes from the same IP) the "printlog" function used will use an echo to write message to console. However this echo:d  message will also be the final output of the function "downloadURLFromGit" since the variable "$downloadURL" is not empty. When running Installomator in DEBUG mode and trying to download dockutil and the x-ratelimit-limit is reached for the IP I request from the function "downloadURLFromGit" will output the following to the variable $downloadURL:
"2023-04-05 14:58:22 : INFO  : dockutil : GitHub API not returning URL, trying https://github.com/kcrawford/dockutil/releases/latest."

This can also be seen in the console DEBUG output for the $downloadURL variable:
2023-04-05 14:58:23 : DEBUG : dockutil : downloadURL=2023-04-05 14:58:22 : INFO  : dockutil : GitHub API not returning URL, trying https://github.com/kcrawford/dockutil/releases/latest.

Source:
https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting
@scriptingosx scriptingosx added the application adds or improves an application label label Apr 12, 2023
@scriptingosx scriptingosx added this to the v10.4 milestone Apr 12, 2023
@scriptingosx
Copy link
Collaborator

Thank you!

@scriptingosx scriptingosx added bug Something isn't working bug-fix and removed application adds or improves an application label labels May 26, 2023
@scriptingosx scriptingosx merged commit ec9355b into Installomator:main May 26, 2023
@KretZoR KretZoR deleted the patch-2 branch July 5, 2023 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working bug-fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants