Skip Python mess and go with bash

This commit is contained in:
Luke Murphy
2020-04-07 16:10:31 +02:00
parent 86d3e19c9b
commit 4e4999a6d6
6 changed files with 38 additions and 324 deletions

View File

@ -1,44 +1,16 @@
#!/usr/bin/env python3
#!/usr/bin/env bash
import os
import sys
import subprocess
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
from .funtions import error, info
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
dokku-ansible-deploy-dependencies() {
export DEBIAN_FRONTEND=noninteractive
def main(args):
packages = " ".join([
"ansible",
"python3",
"python3-dev",
"python3-pip",
])
if ! command -v "ansible" &>/dev/null; then
dokku_col_log_info1_quiet "installing ansible"
apt install -qq -y ansible
fi
}
command = [
'apt',
'install',
'-y',
'--no-remove',
'-o Dpkg::Options::=--force-confdef',
'-o Dpkg::Options::=--force-confold',
'install',
packages
]
environment = os.environ.copy()
environment.update({'DEBIAN_FRONTEND': 'noninteractive'})
try:
subprocess.check_output(
command,
env=environment,
stderr=subprocess.STDOUT
)
info("dependencies installed successfully")
except subprocess.CalledProcessError as exception:
error("dependencies: {}".format(str(exception)))
if __name__ == '__main__':
main(sys.argv[:1])
dokku-ansible-deploy-dependencies "$@"