# rest.py # # Provide a VERY simple REST endpoint against which a proxy minion can be tested # # Requires that the bottle Python packages are available import argparse import os from bottle import route, run, template, static_file, request, Bottle, redirect app = Bottle() app.PACKAGES = {'coreutils': '1.05'} app.UPGRADE_PACKAGES = {} app.SERVICES = {'apache': 'stopped', 'postgresql': 'stopped', 'redbull': 'running'} app.INFO = {'os': 'RestExampleOS', 'kernel': '0.0000001', 'housecat': 'Are you kidding?', 'osversion': '0.01'} app.outage_mode = {'state': False} @app.route('/package/uptodate') def index(): if app.UPGRADE_PACKAGES != {}: return app.UPGRADE_PACKAGES for k, v in app.PACKAGES.iteritems(): app.UPGRADE_PACKAGES[k] = str(float(v) + 1) return app.UPGRADE_PACKAGES
# Provide a VERY simple REST endpoint against which a proxy minion can be tested # # Requires that the bottle Python packages are available import argparse import os from bottle import route, run, template, static_file, request, Bottle, redirect app = Bottle() app.PACKAGES = {'coreutils': '1.05'} app.UPGRADE_PACKAGES = {} app.SERVICES = { 'apache': 'stopped', 'postgresql': 'stopped', 'redbull': 'running' } app.INFO = { 'os': 'RestExampleOS', 'kernel': '0.0000001', 'housecat': 'Are you kidding?', 'osversion': '0.01' } app.outage_mode = {'state': False} @app.route('/package/uptodate') def index(): if app.UPGRADE_PACKAGES != {}: return app.UPGRADE_PACKAGES