def parse_args():
    parser = OptionParser()
    parser.add_option("--fldr", dest="fldr",
                      help="folder to descend and add headers")
    parser.add_option("--conf", dest="confpath",
                      default="conf.ini",
                      help="Config file")

    (options, args) = parser.parse_args()
    return (options, args)


if __name__ == '__main__':
    
    opts, args = parse_args()
    confd = conf.get_config(opts.confpath)
    validexts = eval(confd['app']['validexts'])
    confd['app']['validexts'] = validexts
    files_to_process = llib.walk_tree(opts.fldr,
                                      confd['app']['validexts'])
    for f in files_to_process:
        
        if not os.path.isfile(f):
            raise OSError("%s must be a file" % f)

        llib.simplelog("Analyse %s" % f)
        FLAGS = llib.analyse_file(f, confd)
        llib.simplelog(FLAGS)

        if FLAGS['VALID_EXT'] is True:  # I cpould make different decisions here based on config
            llib.adjust_one_file(f, confd)
Exemplo n.º 2
0
import os
import json
import pprint
from rhaptos2.repo import backend, model
from rhaptos2.repo.tests import decl
from rhaptos2.repo.backend import db_session
from rhaptos2.common import conf

owner = decl.users['paul'].useruri


CONFD_PATH = os.path.join(".", "../../testing.ini")
confd = conf.get_config(CONFD_PATH)
# backend.clean_dbase(confd['app'])
backend.initdb(confd['app'])
intedned to solve a real problem - I want an image of a serever in
cloud to be reloaded, and then call out back.


todo - chaining multiple servers ...
todo - better state mgmt / mapping

"""

import datetime
from flask import Flask
import rackspace
import requests

from rhaptos2.common import conf
confd = conf.get_config("pantrybell")

class PantryBellError(Exception):
    pass

app = Flask(__name__)


    #jobname:([servers_to_reimage], jenkins_job_after)
LOOKUP={'test': (['www-baseserver', 'bare-server-log'], 
                 "http://jenkins.frozone.mikadosoftware.com:8080/job/build_racksapce_devweb/build"),
       }

messageq = {'www': "http://jenkins.frozone.mikadosoftware.com:8080/job/build_racksapce_devweb/build"} 

@app.route("/pantrybell/<key>/<hostname>")