Пример #1
0
def deleteHost(name, group_name, url_back):
    """delete host

    Delete an existing host

    Arguments:
        name - the name of the host to be deleted
        group_name - the name of the group where the host belongs
        url_back - url for redirecting when finished

    Return: if POST delete the host, if GET render the delete host page
    """
    host = APIObject(name, 'host')
    host_to_delete = host.show()

    if request.method == 'POST':
        host.delete_from_group('set-group', group_name)
        host.delete()

        api.api_call('publish')
        flash('Equipment removed')
        return redirect(url_for(url_back))

    return render_template('delete-host.html',
                           group_name=group_name,
                           host_to_delete=host_to_delete,
                           url_back=url_back)
Пример #2
0
def deleteApplicationSite(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_to_delete = appl.show()

    if request.method == 'POST':

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

        if appl.where_used() >= 2:
            api.api_call('publish')
            flash(
                u"The URL belongs to more lists, it is not completely deleted")
            return redirect(url_for(url_back))

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

        appl.delete()

        api.api_call('publish')
        flash(u'URL removed')
        return redirect(url_for(url_back))

    return render_template('delete-application-site.html',
                           group_name=group_name,
                           appl_to_delete=appl_to_delete,
                           url_back=url_back)
Пример #3
0
def deleteApplicationSite(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_to_delete = appl.show()

    if request.method == 'POST':

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

        if appl.where_used() >= 2:
            api.api_call('publish')
            flash(u"La URL pertany a més llistes, no s'elimina totalment")
            return redirect(url_for(url_back))

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

        appl.delete()

        api.api_call('publish')
        flash(u'URL eliminada')
        return redirect(url_for(url_back))

    return render_template(
        'delete-application-site.html',
        group_name=group_name,
        appl_to_delete=appl_to_delete,
        url_back=url_back)