def ConfirmOperation(names, list_type, text, extra=""):
  count = len(names)
  msg = ("The %s will operate on %d %s.\n%s"
         "Do you want to continue?" % (text, count, list_type, extra))
  affected = (("\nAffected %s:\n" % list_type) +
              "\n".join(["  %s" % name for name in names]))

  choices = [("y", True, "Yes, execute the %s" % text),
             ("n", False, "No, abort the %s" % text)]

  if count > 20:
    choices.insert(1, ("v", "v", "View the list of affected %s" % list_type))
    question = msg
  else:
    question = msg + affected

  choice = AskUser(question, choices)
  if choice == "v":
    choices.pop(1)
    choice = AskUser(msg + affected, choices)
  return choice
Gets the host name.
dataset/ETHPy150Open ganeti/ganeti/lib/cli.py/ConfirmOperation--crossover with--dataset/ETHPy150Open viniciuschiele/flask-apscheduler/flask_apscheduler/scheduler.py/APScheduler.host_name