Esempio n. 1
0
 def delete(cls, id):
     tgt = RasTarget.get(RasTarget.id == id)
     with database.database.atomic():
         for act in tgt.actions:
             RasActionForm.delete(act.id)
         tgt.delete_instance()
     tgt.teardown()
Esempio n. 2
0
 def delete(cls, id):
     tgt = RasTarget.get(RasTarget.id == id)
     with database.database.atomic():
         for act in tgt.actions:
             RasActionForm.delete(act.id)
         tgt.delete_instance()
     tgt.teardown()
Esempio n. 3
0
def rastgt_delete(grpid, typ, tgtid):
    tgt = RasTarget.get(RasTarget.id == tgtid)
    fclass = _TARGET_FORMS[typ]
    form = fclass(data=fclass.obj2dict(tgt))
    return render_template(
        'ras/target_delete.html',
        form=form, grpid=grpid, typ=typ, tgtid=tgtid,
        group_name=tgt.group.name)
Esempio n. 4
0
def rasact_create(grpid, tgtid, atype):
    form = _ACTION_FORMS[atype]()
    tgt = RasTarget.get(RasTarget.id == tgtid)
    return render_template('ras/action_create.html',
                           form=form,
                           grpid=grpid,
                           target=tgt,
                           atype=atype)
Esempio n. 5
0
 def _save(self, action, tgtid, script_data=None):
     tgt = RasTarget.get(RasTarget.id == tgtid)
     action.target = tgtid
     action.name = self.name.data
     action.mode = 1 << 1
     action.type = 'restart'
     action.data = json.dumps(
         {'type': tgt.type, 'retry': int(self.retry.data),
          'interval': int(self.interval.data)})
     action.save()
Esempio n. 6
0
def rastgt_delete(grpid, typ, tgtid):
    tgt = RasTarget.get(RasTarget.id == tgtid)
    fclass = _TARGET_FORMS[typ]
    form = fclass(data=fclass.obj2dict(tgt))
    return render_template('ras/target_delete.html',
                           form=form,
                           grpid=grpid,
                           typ=typ,
                           tgtid=tgtid,
                           group_name=tgt.group.name)
Esempio n. 7
0
 def _save(self, action, tgtid, script_data=None):
     tgt = RasTarget.get(RasTarget.id == tgtid)
     action.target = tgtid
     action.name = self.name.data
     action.mode = 1 << 1
     action.type = 'restart'
     action.data = json.dumps({
         'type': tgt.type,
         'retry': int(self.retry.data),
         'interval': int(self.interval.data)
     })
     action.save()
Esempio n. 8
0
def rasact_list(grpid, tgtid):
    atype = request.form['type']
    form = _ACTION_FORMS[atype](request.form)
    if not form.validate():
        tgt = RasTarget.get(RasTarget.id == tgtid)
        return render_template(
            'ras/action_create.html',
            form=form, grpid=grpid, target=tgt, atype=atype)
    script = request.files['script'] if 'script' in request.files else None
    form.create(tgtid, script)
    return redirect(url_for(
        'rastgt_detail', grpid=grpid, tgtid=tgtid))
Esempio n. 9
0
def rasact_list(grpid, tgtid):
    atype = request.form['type']
    form = _ACTION_FORMS[atype](request.form)
    if not form.validate():
        tgt = RasTarget.get(RasTarget.id == tgtid)
        return render_template('ras/action_create.html',
                               form=form,
                               grpid=grpid,
                               target=tgt,
                               atype=atype)
    script = request.files['script'] if 'script' in request.files else None
    form.create(tgtid, script)
    return redirect(url_for('rastgt_detail', grpid=grpid, tgtid=tgtid))
Esempio n. 10
0
def rastgt_detail(grpid, tgtid):
    tgt = RasTarget.get(RasTarget.id == tgtid)
    return render_template('ras/target_show.html', target=tgt)
Esempio n. 11
0
def rasact_create(grpid, tgtid, atype):
    form = _ACTION_FORMS[atype]()
    tgt = RasTarget.get(RasTarget.id == tgtid)
    return render_template(
        'ras/action_create.html',
        form=form, grpid=grpid, target=tgt, atype=atype)
Esempio n. 12
0
def rastgt_detail(grpid, tgtid):
    tgt = RasTarget.get(RasTarget.id == tgtid)
    return render_template('ras/target_show.html', target=tgt)