コード例 #1
0
ファイル: _app.py プロジェクト: hivesolutions/tiberium_soul
def delete_app(id):
    # retrieves both the directory to used as the
    # base for the sun files and the directory used
    # to store the repositories
    suns_folder = util.get_suns_folder()
    repos_folder = util.get_repos_folder()

    # retrieves the current mongo database and removes the
    # app entry contained in it
    db = quorum.get_mongo_db()
    db.apps.remove({"id" : id})

    # retrieves the (complete) repository path for the current app
    # and removes the repository directory
    repo_path = os.path.join(repos_folder, "%s.git" % id)
    shutil.rmtree(repo_path)

    # retrieves the (complete) sun path for the current app and
    # removes the sun file from the file system
    sun_path = os.path.join(suns_folder, "%s.sun" % id)
    if os.path.exists(sun_path): os.remove(sun_path)

    return flask.redirect(
        flask.url_for("list_app")
    )
コード例 #2
0
ファイル: _app.py プロジェクト: hivesolutions/tiberium_soul
def restart_app(id):
    # retrieves the directory to be used as the
    # based for the sun files
    suns_folder = util.get_suns_folder()

    # creates the "full" path to the sun file associated
    # with the app with the provided id
    file_path = os.path.join(suns_folder, "%s.sun" % id)

    # retrieves the "clojure method" to be used in the
    # execution (restart) of the sun file and uses it
    # to execute the restart of the application
    execute_sun = util.get_execute_sun(id, file_path)
    quorum.run_back(execute_sun)

    return flask.redirect(
        flask.url_for("show_app", id = id)
    )
コード例 #3
0
ファイル: base.py プロジェクト: hivesolutions/tiberium_soul
def deploy():
    # retrieves the name of the sun file to be deployed
    # and the contents of the file to be deployed
    name = quorum.get_field("name")
    file = quorum.get_field("file")

    # retrieves the directory to be used as the
    # based for the sun files
    suns_folder = util.get_suns_folder()

    # reads the complete file contents from the request and
    # then retrieves the associated sun file to update it
    contents = file.read()
    file_path = os.path.join(suns_folder, "%s.sun" % name)
    file = open(file_path, "wb")
    try: file.write(contents)
    finally: file.close()

    # retrieves the "clojure method" to be used in the
    # execution (deployment) of the sun file and uses it
    # to execute the deployment of the application
    execute_sun = util.get_execute_sun(name, file_path)
    quorum.run_back(execute_sun)
    return "success"