This repository has been archived by the owner on Mar 6, 2023. It is now read-only.
Refactor: Unnecessary call to github if node_exporter already installed #262
Labels
enhancement
New feature or request
Current logic implemented in the final block of tasks/preflight.yml (
Get checksum list from github
andGet checksum for {{ go_arch }} architecture
) are unnecessary to execute ifnode_exporter
is already installed and at the desired version.Potential refactoring solutions:
1 - Move block to tasks/install.yml. Since the inclusion of this task list is dependent on "is node_exporter already at the correct version" logic in tasks/main.yml, they would only be run if installation is required.
2 - Replicate logic for calling block to only call if installation will be required. Seems smelly and not DRY, as it would require duplication of logic already present in tasks/main.yml.
3 - Further refactor "is node_exporter already at the correct version" logic currently in tasks/main.yml and use this logic to set a Boolean value which could then be inspected elsewhere (in the current preflight logic to pull the checksum list as well as the logic to include the install tasks).
Option 1 is arguably easiest. Option 2 is smelly and only mentioned for the sake of discussion. Option 3 may be most flexible, at the cost of some additional complexity. It is attractive, however, as it decouples logic from
main.yml
, leaving an arguably more elegant main task list for the role.The logic for "is node_exporter already the correct version" appears to be in flux related to some other issues and PRs I see open, so I have not authored any specific update for this request.
I would happy to author a PR for whichever option (or another solution) the project maintainer prefers, if desired.
The text was updated successfully, but these errors were encountered: