Commit 6194c63f authored by Joshua Tauberer's avatar Joshua Tauberer

add management comments for checking for updated Ubuntu packages and applying updates

parent cab7321d
#!/usr/bin/python3
import os, os.path
import os, os.path, subprocess
from flask import Flask, request, render_template
app = Flask(__name__)
......@@ -55,6 +55,20 @@ def dns_update():
from dns_update import do_dns_update
return do_dns_update(env)
# System
@app.route('/system/updates')
def show_updates():
subprocess.check_call("apt-get -qq update", shell=True)
return subprocess.check_output(
r"""apt-get -qq -s upgrade | grep -v ^Conf | sed "s/^Inst /Updated Package Available: /" | sed "s/\[\(.*\)\] (\(\S*\).*/\(\1 => \2\)/" """,
shell=True)
@app.route('/system/update-packages', methods=["POST"])
def do_updates():
subprocess.check_call("apt-get -qq update", shell=True)
return subprocess.check_output("DEBIAN_FRONTEND=noninteractive apt-get -y upgrade", shell=True)
# APP
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment