jessedp / pihole5-list-tool

A tool for quickly and easily bulk adding allow and ad/block lists to a Pi-hole 5 installation
MIT License
312 stars 18 forks source link

Tool fails on a fresh install of Pi-Hole on a Raspberry Pi 4 #6

Closed Tristor closed 4 years ago

Tristor commented 4 years ago

Howdy,

It looks like a recent change to add auto-detection for Docker may be the cause of this, but I am not primarily a Python dev so I didn't dig super deep. If you aren't using Docker and instead installed directly on a Raspberry Pi with the latest release it fails.

    ┌──────────────────────────────────────────┐
    │       π-hole 5 list tool  v0.4.0         │
    └──────────────────────────────────────────┘
    https://github.com/jessedp/pihole5-list-tool

    Do not hit ENTER or Y if a step seems to hang!
    Use CTRL+C if you're sure it's hung and report it.

docker pihole image not found running, continuing...
Traceback (most recent call last):
  File "/usr/local/bin/pihole5-list-tool", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/ph5lt.py", line 99, in main
    if not use_docker:
UnboundLocalError: local variable 'use_docker' referenced before assignment

Steps to Reproduce:

  1. From a fresh Raspbian 10 image, install Pi-Hole
  2. Run apt-get install python3-pip -y
  3. Run sudo pip3 install pihole5-list-tool --update
  4. Run sudo pihole5-list-tool
Tristor commented 4 years ago

I'm pretty sure the issue is that https://github.com/jessedp/pihole5-list-tool/blob/95f6f77f6211bb360481d4fa166174b407f41aba/ph5lt.py#L99 is the codepath when the Docker image isn't present and it's checking for a variable that was never declared, since it's declared in the conditional codepath above that is never followed.

jessedp commented 4 years ago

Yeah, that was pretty dumb of me.

Tristor commented 4 years ago

Thanks for the quick fix :)