Example #1
0
 def populate_choices(form, g, machine):
     bmcs = BMC.query.all() if g.user.admin else []
     images = Image.all_visible(g.user)
     preseeds = Preseed.all_visible(g.user)
     form.bmc_id.choices = [("", "(None)")] + \
         [(bmc.id, "%s - %s - %s" % (bmc.name, bmc.ip, bmc.bmc_type)) for bmc in bmcs]
     form.kernel_id.choices = [("", "(None)")] + \
         [(i.id, "%s - %s" % (i.description, i.filename)) for i in images if i.file_type == "Kernel"]
     form.initrd_id.choices = [("", "(None)")] + \
         [(i.id, "%s - %s" % (i.description, i.filename)) for i in images if i.file_type == "Initrd"]
     form.preseed_id.choices = [("", "(None)")] + \
         [(p.id, "%s - %s%s" % (p.description, p.filename, " (known good)" if p.known_good else ""))
             for p in preseeds]
     form.assignee.user_id.choices = [("", "(None)")] + \
         [(u.id, u.username) for u in User.query.all()]
Example #2
0
def get_images_admin():
    form = validations.CreateImageForm()
    return render_template("admin-images.html",
                           form=form,
                           images=Image.all_visible(g.user))