mirror of https://github.com/pi-hole/pi-hole
commit
bef0a2fef0
@ -1,3 +0,0 @@
|
||||
engines:
|
||||
shellcheck:
|
||||
enabled: true
|
@ -1 +1,7 @@
|
||||
.DS_Store
|
||||
*.pyc
|
||||
*.swp
|
||||
__pycache__
|
||||
.cache
|
||||
.pullapprove.yml
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectCodeStyleSettingsManager">
|
||||
<option name="PER_PROJECT_SETTINGS">
|
||||
<value>
|
||||
<option name="OTHER_INDENT_OPTIONS">
|
||||
<value>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
<option name="USE_TAB_CHARACTER" value="false" />
|
||||
<option name="SMART_TABS" value="false" />
|
||||
<option name="LABEL_INDENT_SIZE" value="0" />
|
||||
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
|
||||
<option name="USE_RELATIVE_INDENTS" value="false" />
|
||||
</value>
|
||||
</option>
|
||||
</value>
|
||||
</option>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,10 @@
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
install:
|
||||
- pip install -r requirements.txt
|
||||
|
||||
script: py.test -vv
|
@ -0,0 +1,242 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pi-hole: A black hole for Internet advertisements
|
||||
# Network-wide ad blocking via your Raspberry Pi
|
||||
# http://pi-hole.net
|
||||
# Web interface settings
|
||||
#
|
||||
# Pi-hole is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
args=("$@")
|
||||
|
||||
helpFunc() {
|
||||
cat << EOM
|
||||
::: Set admin options for the web interface of pihole
|
||||
:::
|
||||
::: Usage: pihole -a [options]
|
||||
:::
|
||||
::: Options:
|
||||
::: -p, password Set web interface password, an empty input will remove any previously set password
|
||||
::: -c, celsius Set Celsius temperature unit
|
||||
::: -f, fahrenheit Set Fahrenheit temperature unit
|
||||
::: -k, kelvin Set Kelvin temperature unit
|
||||
::: -h, --help Show this help dialog
|
||||
EOM
|
||||
exit 0
|
||||
}
|
||||
|
||||
SetTemperatureUnit(){
|
||||
|
||||
# Remove setting from file (create backup setupVars.conf.bak)
|
||||
sed -i.bak '/TEMPERATUREUNIT/d' /etc/pihole/setupVars.conf
|
||||
# Save setting to file
|
||||
echo "TEMPERATUREUNIT=${unit}" >> /etc/pihole/setupVars.conf
|
||||
|
||||
}
|
||||
|
||||
SetWebPassword(){
|
||||
|
||||
if [ "${SUDO_USER}" == "www-data" ]; then
|
||||
echo "Security measure: user www-data is not allowed to change webUI password!"
|
||||
echo "Exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${SUDO_USER}" == "lighttpd" ]; then
|
||||
echo "Security measure: user lighttpd is not allowed to change webUI password!"
|
||||
echo "Exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove password from file (create backup setupVars.conf.bak)
|
||||
sed -i.bak '/WEBPASSWORD/d' /etc/pihole/setupVars.conf
|
||||
# Set password only if there is one to be set
|
||||
if (( ${#args[2]} > 0 )) ; then
|
||||
# Compute password hash twice to avoid rainbow table vulnerability
|
||||
hash=$(echo -n ${args[2]} | sha256sum | sed 's/\s.*$//')
|
||||
hash=$(echo -n ${hash} | sha256sum | sed 's/\s.*$//')
|
||||
# Save hash to file
|
||||
echo "WEBPASSWORD=${hash}" >> /etc/pihole/setupVars.conf
|
||||
echo "New password set"
|
||||
else
|
||||
echo "Password removed"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
SetDNSServers(){
|
||||
|
||||
# Remove setting from file (create backup setupVars.conf.bak)
|
||||
sed -i.bak '/PIHOLE_DNS_1/d;/PIHOLE_DNS_2/d;/DNS_FQDN_REQUIRED/d;' /etc/pihole/setupVars.conf
|
||||
# Save setting to file
|
||||
echo "PIHOLE_DNS_1=${args[2]}" >> /etc/pihole/setupVars.conf
|
||||
if [[ "${args[3]}" != "none" ]]; then
|
||||
echo "PIHOLE_DNS_2=${args[3]}" >> /etc/pihole/setupVars.conf
|
||||
else
|
||||
echo "PIHOLE_DNS_2=" >> /etc/pihole/setupVars.conf
|
||||
fi
|
||||
|
||||
# Replace within actual dnsmasq config file
|
||||
sed -i '/server=/d;' /etc/dnsmasq.d/01-pihole.conf
|
||||
echo "server=${args[2]}" >> /etc/dnsmasq.d/01-pihole.conf
|
||||
if [[ "${args[3]}" != "none" ]]; then
|
||||
echo "server=${args[3]}" >> /etc/dnsmasq.d/01-pihole.conf
|
||||
fi
|
||||
|
||||
# Remove domain-needed entry
|
||||
sed -i '/domain-needed/d;' /etc/dnsmasq.d/01-pihole.conf
|
||||
|
||||
# Readd it if required
|
||||
if [[ "${args[4]}" == "domain-needed" ]]; then
|
||||
echo "domain-needed" >> /etc/dnsmasq.d/01-pihole.conf
|
||||
echo "DNS_FQDN_REQUIRED=true" >> /etc/pihole/setupVars.conf
|
||||
else
|
||||
# Leave it deleted if not wanted
|
||||
echo "DNS_FQDN_REQUIRED=false" >> /etc/pihole/setupVars.conf
|
||||
fi
|
||||
|
||||
# Remove bogus-priv entry
|
||||
sed -i '/bogus-priv/d;' /etc/dnsmasq.d/01-pihole.conf
|
||||
|
||||
# Readd it if required
|
||||
if [[ "${args[5]}" == "bogus-priv" ]]; then
|
||||
echo "bogus-priv" >> /etc/dnsmasq.d/01-pihole.conf
|
||||
echo "DNS_BOGUS_PRIV=true" >> /etc/pihole/setupVars.conf
|
||||
else
|
||||
# Leave it deleted if not wanted
|
||||
echo "DNS_BOGUS_PRIV=false" >> /etc/pihole/setupVars.conf
|
||||
fi
|
||||
|
||||
# Restart dnsmasq to load new configuration
|
||||
RestartDNS
|
||||
|
||||
}
|
||||
|
||||
SetExcludeDomains(){
|
||||
|
||||
# Remove setting from file (create backup setupVars.conf.bak)
|
||||
sed -i.bak '/API_EXCLUDE_DOMAINS/d;' /etc/pihole/setupVars.conf
|
||||
# Save setting to file
|
||||
echo "API_EXCLUDE_DOMAINS=${args[2]}" >> /etc/pihole/setupVars.conf
|
||||
}
|
||||
|
||||
SetExcludeClients(){
|
||||
|
||||
# Remove setting from file (create backup setupVars.conf.bak)
|
||||
sed -i.bak '/API_EXCLUDE_CLIENTS/d;' /etc/pihole/setupVars.conf
|
||||
# Save setting to file
|
||||
echo "API_EXCLUDE_CLIENTS=${args[2]}" >> /etc/pihole/setupVars.conf
|
||||
}
|
||||
|
||||
Reboot(){
|
||||
|
||||
nohup bash -c "sleep 5; reboot" &> /dev/null </dev/null &
|
||||
|
||||
}
|
||||
|
||||
RestartDNS(){
|
||||
|
||||
if [ -x "$(command -v systemctl)" ]; then
|
||||
systemctl restart dnsmasq &> /dev/null
|
||||
else
|
||||
service dnsmasq restart &> /dev/null
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
SetQueryLogOptions(){
|
||||
|
||||
# Remove setting from file (create backup setupVars.conf.bak)
|
||||
sed -i.bak '/API_QUERY_LOG_SHOW/d;' /etc/pihole/setupVars.conf
|
||||
# Save setting to file
|
||||
echo "API_QUERY_LOG_SHOW=${args[2]}" >> /etc/pihole/setupVars.conf
|
||||
}
|
||||
|
||||
EnableDHCP(){
|
||||
|
||||
# Remove setting from file (create backup setupVars.conf.bak)
|
||||
sed -i.bak '/DHCP_/d;' /etc/pihole/setupVars.conf
|
||||
echo "DHCP_ACTIVE=true" >> /etc/pihole/setupVars.conf
|
||||
echo "DHCP_START=${args[2]}" >> /etc/pihole/setupVars.conf
|
||||
echo "DHCP_END=${args[3]}" >> /etc/pihole/setupVars.conf
|
||||
echo "DHCP_ROUTER=${args[4]}" >> /etc/pihole/setupVars.conf
|
||||
|
||||
# Remove setting from file
|
||||
sed -i '/dhcp-/d;/quiet-dhcp/d;' /etc/dnsmasq.d/01-pihole.conf
|
||||
# Save setting to file
|
||||
echo "dhcp-range=${args[2]},${args[3]},infinite" >> /etc/dnsmasq.d/01-pihole.conf
|
||||
echo "dhcp-option=option:router,${args[4]}" >> /etc/dnsmasq.d/01-pihole.conf
|
||||
# Changes the behaviour from strict RFC compliance so that DHCP requests on unknown leases from unknown hosts are not ignored. This allows new hosts to get a lease without a tedious timeout under all circumstances. It also allows dnsmasq to rebuild its lease database without each client needing to reacquire a lease, if the database is lost.
|
||||
echo "dhcp-authoritative" >> /etc/dnsmasq.d/01-pihole.conf
|
||||
# Use the specified file to store DHCP lease information
|
||||
echo "dhcp-leasefile=/etc/pihole/dhcp.leases" >> /etc/dnsmasq.d/01-pihole.conf
|
||||
# Suppress logging of the routine operation of these protocols. Errors and problems will still be logged, though.
|
||||
echo "quiet-dhcp" >> /etc/dnsmasq.d/01-pihole.conf
|
||||
echo "quiet-dhcp6" >> /etc/dnsmasq.d/01-pihole.conf
|
||||
|
||||
RestartDNS
|
||||
}
|
||||
|
||||
DisableDHCP(){
|
||||
|
||||
# Remove setting from file (create backup setupVars.conf.bak)
|
||||
sed -i.bak '/DHCP_ACTIVE/d;' /etc/pihole/setupVars.conf
|
||||
echo "DHCP_ACTIVE=false" >> /etc/pihole/setupVars.conf
|
||||
|
||||
# Remove setting from file
|
||||
sed -i '/dhcp-/d;/quiet-dhcp/d;' /etc/dnsmasq.d/01-pihole.conf
|
||||
|
||||
RestartDNS
|
||||
}
|
||||
|
||||
SetWebUILayout(){
|
||||
|
||||
# Remove setting from file (create backup setupVars.conf.bak)
|
||||
sed -i.bak '/WEBUIBOXEDLAYOUT/d;' /etc/pihole/setupVars.conf
|
||||
echo "WEBUIBOXEDLAYOUT=${args[2]}" >> /etc/pihole/setupVars.conf
|
||||
|
||||
}
|
||||
|
||||
SetDNSDomainName(){
|
||||
|
||||
# Remove setting from file (create backup setupVars.conf.bak)
|
||||
sed -i.bak '/PIHOLE_DOMAIN/d;' /etc/pihole/setupVars.conf
|
||||
# Save setting to file
|
||||
echo "PIHOLE_DOMAIN=${args[2]}" >> /etc/pihole/setupVars.conf
|
||||
|
||||
# Replace within actual dnsmasq config file
|
||||
sed -i '/domain=/d;' /etc/dnsmasq.d/01-pihole.conf
|
||||
echo "domain=${args[2]}" >> /etc/dnsmasq.d/01-pihole.conf
|
||||
|
||||
# Restart dnsmasq to load new configuration
|
||||
RestartDNS
|
||||
|
||||
}
|
||||
|
||||
case "${args[1]}" in
|
||||
"-p" | "password" ) SetWebPassword;;
|
||||
"-c" | "celsius" ) unit="C"; SetTemperatureUnit;;
|
||||
"-f" | "fahrenheit" ) unit="F"; SetTemperatureUnit;;
|
||||
"-k" | "kelvin" ) unit="K"; SetTemperatureUnit;;
|
||||
"setdns" ) SetDNSServers;;
|
||||
"setexcludedomains" ) SetExcludeDomains;;
|
||||
"setexcludeclients" ) SetExcludeClients;;
|
||||
"reboot" ) Reboot;;
|
||||
"restartdns" ) RestartDNS;;
|
||||
"setquerylog" ) SetQueryLogOptions;;
|
||||
"enabledhcp" ) EnableDHCP;;
|
||||
"disabledhcp" ) DisableDHCP;;
|
||||
"layout" ) SetWebUILayout;;
|
||||
"-h" | "--help" ) helpFunc;;
|
||||
"domainname" ) SetDNSDomainName;;
|
||||
* ) helpFunc;;
|
||||
esac
|
||||
|
||||
shift
|
||||
|
||||
if [[ $# = 0 ]]; then
|
||||
helpFunc
|
||||
fi
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,5 @@
|
||||
docker-compose
|
||||
pytest
|
||||
pytest-xdist
|
||||
pytest-cov
|
||||
testinfra
|
@ -0,0 +1,16 @@
|
||||
FROM centos:7
|
||||
|
||||
ENV GITDIR /etc/.pihole
|
||||
ENV SCRIPTDIR /opt/pihole
|
||||
|
||||
RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole
|
||||
ADD . $GITDIR
|
||||
RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $SCRIPTDIR/
|
||||
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
|
||||
|
||||
RUN true && \
|
||||
chmod +x $SCRIPTDIR/*
|
||||
|
||||
ENV PH_TEST true
|
||||
|
||||
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \
|
@ -0,0 +1,61 @@
|
||||
import pytest
|
||||
import testinfra
|
||||
|
||||
check_output = testinfra.get_backend(
|
||||
"local://"
|
||||
).get_module("Command").check_output
|
||||
|
||||
@pytest.fixture
|
||||
def Pihole(Docker):
|
||||
''' used to contain some script stubbing, now pretty much an alias.
|
||||
Also provides bash as the default run function shell '''
|
||||
def run_bash(self, command, *args, **kwargs):
|
||||
cmd = self.get_command(command, *args)
|
||||
if self.user is not None:
|
||||
out = self.run_local(
|
||||
"docker exec -u %s %s /bin/bash -c %s",
|
||||
self.user, self.name, cmd)
|
||||
else:
|
||||
out = self.run_local(
|
||||
"docker exec %s /bin/bash -c %s", self.name, cmd)
|
||||
out.command = self.encode(cmd)
|
||||
return out
|
||||
|
||||
funcType = type(Docker.run)
|
||||
Docker.run = funcType(run_bash, Docker, testinfra.backend.docker.DockerBackend)
|
||||
return Docker
|
||||
|
||||
@pytest.fixture
|
||||
def Docker(request, args, image, cmd):
|
||||
''' combine our fixtures into a docker run command and setup finalizer to cleanup '''
|
||||
assert 'docker' in check_output('id'), "Are you in the docker group?"
|
||||
docker_run = "docker run {} {} {}".format(args, image, cmd)
|
||||
docker_id = check_output(docker_run)
|
||||
|
||||
def teardown():
|
||||
check_output("docker rm -f %s", docker_id)
|
||||
request.addfinalizer(teardown)
|
||||
|
||||
docker_container = testinfra.get_backend("docker://" + docker_id)
|
||||
docker_container.id = docker_id
|
||||
return docker_container
|
||||
|
||||
@pytest.fixture
|
||||
def args(request):
|
||||
''' -t became required when tput began being used '''
|
||||
return '-t -d'
|
||||
|
||||
@pytest.fixture(params=['debian', 'centos'])
|
||||
def tag(request):
|
||||
''' consumed by image to make the test matrix '''
|
||||
return request.param
|
||||
|
||||
@pytest.fixture()
|
||||
def image(request, tag):
|
||||
''' built by test_000_build_containers.py '''
|
||||
return 'pytest_pihole:{}'.format(tag)
|
||||
|
||||
@pytest.fixture()
|
||||
def cmd(request):
|
||||
''' default to doing nothing by tailing null, but don't exit '''
|
||||
return 'tail -f /dev/null'
|
@ -0,0 +1,16 @@
|
||||
FROM debian:jessie
|
||||
|
||||
ENV GITDIR /etc/.pihole
|
||||
ENV SCRIPTDIR /opt/pihole
|
||||
|
||||
RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole
|
||||
ADD . $GITDIR
|
||||
RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $SCRIPTDIR/
|
||||
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
|
||||
|
||||
RUN true && \
|
||||
chmod +x $SCRIPTDIR/*
|
||||
|
||||
ENV PH_TEST true
|
||||
|
||||
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \
|
@ -0,0 +1,18 @@
|
||||
''' This file starts with 000 to make it run first '''
|
||||
import pytest
|
||||
import testinfra
|
||||
|
||||
run_local = testinfra.get_backend(
|
||||
"local://"
|
||||
).get_module("Command").run
|
||||
|
||||
@pytest.mark.parametrize("image,tag", [
|
||||
( 'test/debian.Dockerfile', 'pytest_pihole:debian' ),
|
||||
( 'test/centos.Dockerfile', 'pytest_pihole:centos' ),
|
||||
])
|
||||
def test_build_pihole_image(image, tag):
|
||||
build_cmd = run_local('docker build -f {} -t {} .'.format(image, tag))
|
||||
if build_cmd.rc != 0:
|
||||
print build_cmd.stdout
|
||||
print build_cmd.stderr
|
||||
assert build_cmd.rc == 0
|
@ -0,0 +1,102 @@
|
||||
import pytest
|
||||
from textwrap import dedent
|
||||
|
||||
SETUPVARS = {
|
||||
'PIHOLE_INTERFACE' : 'eth99',
|
||||
'IPV4_ADDRESS' : '1.1.1.1',
|
||||
'IPV6_ADDRESS' : 'FE80::240:D0FF:FE48:4672',
|
||||
'PIHOLE_DNS_1' : '4.2.2.1',
|
||||
'PIHOLE_DNS_2' : '4.2.2.2'
|
||||
}
|
||||
|
||||
def test_setupVars_are_sourced_to_global_scope(Pihole):
|
||||
''' currently update_dialogs sources setupVars with a dot,
|
||||
then various other functions use the variables.
|
||||
This confirms the sourced variables are in scope between functions '''
|
||||
setup_var_file = 'cat <<EOF> /etc/pihole/setupVars.conf\n'
|
||||
for k,v in SETUPVARS.iteritems():
|
||||
setup_var_file += "{}={}\n".format(k, v)
|
||||
setup_var_file += "EOF\n"
|
||||
Pihole.run(setup_var_file)
|
||||
|
||||
script = dedent('''\
|
||||
set -e
|
||||
printSetupVars() {
|
||||
# Currently debug test function only
|
||||
echo "Outputting sourced variables"
|
||||
echo "PIHOLE_INTERFACE=${PIHOLE_INTERFACE}"
|
||||
echo "IPV4_ADDRESS=${IPV4_ADDRESS}"
|
||||
echo "IPV6_ADDRESS=${IPV6_ADDRESS}"
|
||||
echo "PIHOLE_DNS_1=${PIHOLE_DNS_1}"
|
||||
echo "PIHOLE_DNS_2=${PIHOLE_DNS_2}"
|
||||
}
|
||||
update_dialogs() {
|
||||
. /etc/pihole/setupVars.conf
|
||||
}
|
||||
update_dialogs
|
||||
printSetupVars
|
||||
''')
|
||||
|
||||
output = run_script(Pihole, script).stdout
|
||||
|
||||
for k,v in SETUPVARS.iteritems():
|
||||
assert "{}={}".format(k, v) in output
|
||||
|
||||
def test_setupVars_saved_to_file(Pihole):
|
||||
''' confirm saved settings are written to a file for future updates to re-use '''
|
||||
set_setup_vars = '\n' # dedent works better with this and padding matching script below
|
||||
for k,v in SETUPVARS.iteritems():
|
||||
set_setup_vars += " {}={}\n".format(k, v)
|
||||
Pihole.run(set_setup_vars).stdout
|
||||
|
||||
script = dedent('''\
|
||||
set -e
|
||||
echo start
|
||||
TERM=xterm
|
||||
source /opt/pihole/basic-install.sh
|
||||
{}
|
||||
finalExports
|
||||
cat /etc/pihole/setupVars.conf
|
||||
'''.format(set_setup_vars))
|
||||
|
||||
output = run_script(Pihole, script).stdout
|
||||
|
||||
for k,v in SETUPVARS.iteritems():
|
||||
assert "{}={}".format(k, v) in output
|
||||
|
||||
def test_configureFirewall_firewalld_no_errors(Pihole):
|
||||
''' confirms firewalld rules are applied when appopriate '''
|
||||
mock_command('firewall-cmd', '0', Pihole)
|
||||
configureFirewall = Pihole.run('''
|
||||
source /opt/pihole/basic-install.sh
|
||||
configureFirewall
|
||||
''')
|
||||
expected_stdout = '::: Configuring firewalld for httpd and dnsmasq.'
|
||||
assert expected_stdout in configureFirewall.stdout
|
||||
firewall_calls = Pihole.run('cat /var/log/firewall-cmd').stdout
|
||||
assert 'firewall-cmd --state' in firewall_calls
|
||||
assert 'firewall-cmd --permanent --add-port=80/tcp' in firewall_calls
|
||||
assert 'firewall-cmd --permanent --add-port=53/tcp' in firewall_calls
|
||||
assert 'firewall-cmd --permanent --add-port=53/udp' in firewall_calls
|
||||
assert 'firewall-cmd --reload' in firewall_calls
|
||||
|
||||
|
||||
# Helper functions
|
||||
def mock_command(script, result, container):
|
||||
''' Allows for setup of commands we don't really want to have to run for real in unit tests '''
|
||||
''' TODO: support array of results that enable the results to change over multiple executions of a command '''
|
||||
full_script_path = '/usr/local/bin/{}'.format(script)
|
||||
mock_script = dedent('''\
|
||||
#!/bin/bash -e
|
||||
echo "\$0 \$@" >> /var/log/{script}
|
||||
exit {retcode}
|
||||
'''.format(script=script, retcode=result))
|
||||
container.run('''
|
||||
cat <<EOF> {script}\n{content}\nEOF
|
||||
chmod +x {script}
|
||||
'''.format(script=full_script_path, content=mock_script))
|
||||
|
||||
def run_script(Pihole, script):
|
||||
result = Pihole.run(script)
|
||||
assert result.rc == 0
|
||||
return result
|
@ -0,0 +1,13 @@
|
||||
import pytest
|
||||
import testinfra
|
||||
|
||||
run_local = testinfra.get_backend(
|
||||
"local://"
|
||||
).get_module("Command").run
|
||||
|
||||
def test_scripts_pass_shellcheck():
|
||||
''' Make sure shellcheck does not find anything wrong with our shell scripts '''
|
||||
shellcheck = "find . -type f \( -name 'update.sh' -o -name 'piholeDebug.sh' \) | while read file; do shellcheck \"$file\"; done;"
|
||||
results = run_local(shellcheck)
|
||||
print results.stdout
|
||||
assert '' == results.stdout
|
Loading…
Reference in new issue