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

whitelist.py errors for Docker installation (without Python3) and /etc/pihole on different directory #188

Open
akseidel opened this issue Nov 22, 2020 · 4 comments
Labels

Comments

@akseidel
Copy link

Running pihole 5.1.2 in docker container.
/etc/pihole is /home/pi/IOTstack/volumes/pihole/etc-pihole/
python 3.7.3 is installed

The installation instructions are interpreted to use the following to install, based upon how this pihole is running, after performing a successful git clone.

sudo python3 whitelist/scripts/whitelist.py --dir /home/pi/IOTstack/volumes/pihole/etc-pihole/ --docker

The script starts.
Result is:

This script will download and add domains from the repo to whitelist.
All the domains in this list are safe to add and does not contain any tracking or adserving domains.

[i] Pi-hole path exists
[i] Write access to /home/pi/IOTstack/volumes/pihole/etc-pihole/ verified
Traceback (most recent call last):
File "whitelist/scripts/whitelist.py", line 141, in
if os.path.isfile(gravity_db_location) and os.path.getsize(gravity_db_location) > 0 and getPiholeVersion() >= 51:
File "whitelist/scripts/whitelist.py", line 61, in getPiholeVersion
pihole_version = subprocess.Popen(['pihole', 'version', '-p', '-c'], stdout=subprocess.PIPE)
File "/usr/lib/python3.7/subprocess.py", line 775, in init
restore_signals, start_new_session)
File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pihole': 'pihole'

@nicgord
Copy link

nicgord commented Nov 24, 2020

I am experiencing the same issue above.

getPiholeVersion() is failing as we are not in pihole when running docker.

Change line 141 as a quick and dirty to get working...

if os.path.isfile(gravity_db_location) and os.path.getsize(gravity_db_location) > 0 :

@anudeepND
Copy link
Owner

I have reverted the changes now but I don't have a docker setup to test it out, I will update the script after I finish testing on different configurations

@hursey013
Copy link
Contributor

hursey013 commented Dec 8, 2020

@anudeepND I think the presence of the --docker flag needs to be checked in getPiholeVersion() so the command can be run with docker exec. So basically the same if/then that is found in restartPihole(): https://github.com/anudeepND/whitelist/pull/190/files#diff-0f183000aee364e40c320c278fd691b213cd8f60c33d3b3e498f9dbc6af6f22fL52-L57

So this line: https://github.com/anudeepND/whitelist/pull/190/files#diff-0f183000aee364e40c320c278fd691b213cd8f60c33d3b3e498f9dbc6af6f22fL61 would become:

    if docker is True:
        pihole_version = subprocess.call("docker exec -it pihole pihole version -p -c", shell=True, stdout=subprocess.PIPE)
    else:
        pihole_version = subprocess.Popen(['pihole', 'version', '-p', '-c'], stdout=subprocess.PIPE)

@Adil80079634
Copy link

51.36.175.105

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

No branches or pull requests

5 participants