Ejemplo n.º 1
0
def printer_delete(ip):
    printer = printers.get_printer(ip)
    if printer is None:
        return abort(404)
    printers.delete_printer(ip)
    for device in network_devices.get_network_devices(printer["ip"]):
        device["disabled"] = True
        network_devices.upsert_network_device(**device)
    return "", 204
Ejemplo n.º 2
0
 def setUp(self):
     printers.delete_printer("1.2.3.4")
     printers.add_printer(
         name="name",
         hostname="hostname",
         ip="1.2.3.4",
         client="octoprint",
         client_props={"version": "123"},
     )
Ejemplo n.º 3
0
def printer_delete(uuid):
    try:
        uuidmodule.UUID(uuid, version=4)
    except ValueError:
        return abort(make_response("", 400))
    printer = printers.get_printer(uuid)
    if printer is None:
        return abort(make_response("", 404))
    printers.delete_printer(uuid)
    return "", 204
Ejemplo n.º 4
0
def printer_delete(org_uuid, uuid):
    validate_uuid(uuid)
    printer = printers.get_printer(uuid)
    if printer is None or printer.get("organization_uuid") != org_uuid:
        return abort(make_response(jsonify(message="Not found"), 404))
    printers.delete_printer(uuid)
    network_client_records = printers.get_printers_by_network_client_uuid(
        printer["network_client_uuid"])
    if len(network_client_records) == 0:
        network_clients.delete_network_client(printer["network_client_uuid"])
    return "", 204
Ejemplo n.º 5
0
 def setUp(self):
     self.uuid = uuid.uuid4()
     printers.delete_printer(self.uuid)
     printers.add_printer(
         uuid=self.uuid,
         name="name",
         hostname="hostname",
         ip="192.168.%s" %
         ".".join([str(random.randint(0, 255)) for _ in range(2)]),
         client="octoprint",
         client_props={"version": "123"},
         printer_props={"filament_type": "PLA"},
     )
Ejemplo n.º 6
0
 def tearDown(self):
     printers.delete_printer(self.uuid)
Ejemplo n.º 7
0
 def tearDown(self):
     printers.delete_printer("1.2.3.4")