Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only compare OS versions if dig was successful #5050

Closed
wants to merge 11 commits into from

Conversation

rdwebdesign
Copy link
Member

What does this PR aim to accomplish?:

On the current Debug Log code, if the dig command fails it is impossible to check if the OS is supported, but the log prints an error message saying the OS is unsupported (even when that's not true), like this:

*** [ DIAGNOSING ]: Operating system
[i] dig return code:  10
[i] dig response:  dig: couldn't get address for 'ns1.pi-hole.net': failure
[✗] Distro:  Debian
[✗] Error: Debian is not a supported distro (https://docs.pi-hole.net/main/prerequisites/)

How does this PR accomplish the above?:

Modifying the os_check() function to compare versions only if dig returns without error.
Also, adding a new error message for this case:

*** [ DIAGNOSING ]: Operating system
[i] dig return code:  10
[i] dig response:  dig: couldn't get address for 'ns1.pi-hole.net': failure
[✗] Distro:  Debian
[✗] Error:  dig command failed - Unable to check OS

Link documentation PRs if any are needed to support this PR:
none


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)
  6. I have checked that another pull request for this purpose does not exist.
  7. I have considered, and confirmed that this submission will be valuable to others.
  8. I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  9. I give this submission freely, and claim no ownership to its content.

  • I have read the above and my PR is ready for review. Check this box to confirm

yubiuser and others added 2 commits November 24, 2022 22:06
Signed-off-by: Christian König <ckoenig@posteo.de>
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
@rdwebdesign rdwebdesign requested review from dschaper and a team December 6, 2022 17:58
also use INFO instead of CROSS, because it's not an error.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
@yubiuser
Copy link
Member

yubiuser commented Dec 6, 2022

As your working on this part of the code, I think the order of the output should be changed in general

*** [ DIAGNOSING ]: Operating system
[i] dig return code:  0
[i] dig response:  "Raspbian=10,11 Ubuntu=20,22 Debian=10,11 Fedora=35,36 CentOS=8,9"
[✓] Distro:  Debian
[✓] Version: 11

I would print Distro/Version first (only with an [i]) then the dig code/return and a new additional line with the result of the comparison.

*** [ DIAGNOSING ]: Operating system
[i] Distro:  Debian
[i] Version: 11
[i] dig return code:  0
[i] dig response:  "Raspbian=10,11 Ubuntu=20,22 Debian=10,11 Fedora=35,36 CentOS=8,9"
[✓] Distro and version supported

- add red color to dig errors
- reorder some output lines
- add "Distro and version supported" on success

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
@yubiuser
Copy link
Member

yubiuser commented Dec 8, 2022

Current output

*** [ DIAGNOSING ]: Operating system
[✓] Distro:  Debian
[✓] Version: 11
[i] dig return code: 0
[i] dig response: "Raspbian=10,11 Ubuntu=20,22 Debian=10,11 Fedora=35,36 CentOS=8,9"
[✓] Distro and version supported
*** [ DIAGNOSING ]: Operating system
[✓] Distro:  Debian
[✗] Version: 21
[i] dig return code: 0
[i] dig response: "Raspbian=10,11 Ubuntu=20,22 Debian=10,11 Fedora=35,36 CentOS=8,9"
[✗] Error: Debian is supported but version 21 is currently unsupported (https://docs.pi-hole.net/main/prerequisites/)

*** [ DIAGNOSING ]: Operating system
[i] Distro: Debian
[✗] dig return code: 10
[✗] dig response: dig: couldn't get address for 'ns1.pi-hole.net': not found
[✗] Error: dig command failed - Unable to check OS

advanced/Scripts/piholeDebug.sh Outdated Show resolved Hide resolved
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
advanced/Scripts/piholeDebug.sh Show resolved Hide resolved
advanced/Scripts/piholeDebug.sh Show resolved Hide resolved
advanced/Scripts/piholeDebug.sh Outdated Show resolved Hide resolved
dependabot bot and others added 4 commits December 10, 2022 10:00
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.3.0 to 4.3.1.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v4.3.0...v4.3.1)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: yubiuser <ckoenig@posteo.de>
Signed-off-by: Adam Warner <github@adamwarner.co.uk>
@PromoFaux PromoFaux dismissed yubiuser’s stale review December 11, 2022 14:32

Applied suggestions

@PromoFaux PromoFaux closed this Dec 11, 2022
@PromoFaux PromoFaux deleted the tweak/os_check_error branch December 11, 2022 14:46
@PromoFaux PromoFaux restored the tweak/os_check_error branch December 11, 2022 14:46
@PromoFaux PromoFaux deleted the tweak/os_check_error branch December 11, 2022 14:47
@PromoFaux
Copy link
Member

For people here in the future - some sort of oddity happened here in that PR was merged (check dev, the commits are there!) but for some reason it got marked as closed.

Initially it was saying there were merge conflicts that needed to be adjusted on the command line.. and then I just followed the instructions:

  • checkout tweak/os_check_error locally
  • merge development into it
  • resolve conflicts (there were none!)
  • push back to tweak/os_check_error

Then github got confused and closed the PR.

75308e4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants