@responder(pattern="delete (?P<hostname>.+)", form="delete <hostname>", help="Remove a server from the model")
def delete(conversation, hostname):
  server = Server(hostname)

  DroneD.delete(server.droned)

  for app in list(server.apps):
    app.shouldRunOn.discard(server)

  for appinstance in list(server.appinstances):
    AppInstance.delete(appinstance)

  for appversion in list(AppVersion.objects):
    appversion.services.applicableServers.discard(server)

  for scab in list(server.scabs):
    Scab.delete(scab)

  Server.delete(server)

  conversation.say("All serializable references to %s have been deleted" % hostname)

  if server.listed:
    conversation.say("However this server is listed in my server list, you must remove it manually before restarting gov.")
dataset/ETHPy150Open OrbitzWorldwide/droned/droned/lib/droned/responders/debug.py/delete/original