Exemple #1
0
def images_get():
    show_all = True if request.args.get('show_all', 'false').lower() == 'true' else False

    if show_all:
        images = Image.all_visible(g.user)
    else:
        images = Image.query.filter(Image.user_id == g.user.id).all()

    return jsonify([serialize_image(i) for i in images]), 200
Exemple #2
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()]
Exemple #3
0
def get_images_admin():
    form = validations.CreateImageForm()
    return render_template("admin-images.html", form=form, images=Image.all_visible(g.user))