Skip Python mess and go with bash
This commit is contained in:
50
dependencies
50
dependencies
@ -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 "$@"
|
||||
|
Reference in New Issue
Block a user