Add dependencies command

This commit is contained in:
Luke Murphy 2020-04-07 15:43:53 +02:00
parent 7803fa1b02
commit 86d3e19c9b
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 55 additions and 0 deletions

View File

@ -1 +1,44 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os
import sys
import subprocess
from .funtions import error, info
def main(args):
packages = " ".join([
"ansible",
"python3",
"python3-dev",
"python3-pip",
])
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])

View File

@ -1 +1,13 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from pprint import pprint
def info(msg):
"""Info level logging output."""
pprint("-----> INFO: dokku-deploy: {}".format(msg))
def error(msg):
"""Error level logging output."""
pprint("-----> ERROR: dokku-deploy: {}".format(msg))