コード例 #1
0
def deleteAppl(name, group_name, url_back):
    """
    delete application-site

    delete an existing application-site

    arguments:
        app_list: the id number of the application-site groups

    return: renders the show application-sites page
    """
    appl = APIObject(name, 'application-site')
    appl.name = appl.name[5:]
    appl_to_delete = appl.show()

    if request.method == 'POST':

        appl.delete_from_group('set-application-site-group', group_name)

        api.api_call('publish')
        flash(u'Application Removed')
        return redirect(url_for(url_back))

    return render_template('delete-appl.html',
                           group_name=group_name,
                           appl_to_delete=appl_to_delete,
                           url_back=url_back)
コード例 #2
0
def addExistingAppl(group_name, url_back):
    """
    add existing application

    adds an existing host to a group

    arguments:
        host_id: the id of the host to be added to the group
        group_id: the id of the group where the host has to be added

    return: when POST adds the host to the group, if NO renders the
        show groups page
    """
    form = ApplicationSelectForm(request.form)

    appl = APIObject(form.name.data, 'application-site')
    appl.name = appl.name[5:]
    appl.add_to_group('set-application-site-group', group_name)

    api.api_call('publish')
    flash(u'Application added')
    return redirect(url_for(url_back))