MCPcopy Create free account
hub / github.com/apache/solr / display_and_confirm

Method display_and_confirm

dev-tools/scripts/releaseWizard.py:863–916  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

861 return expand_jinja("%s%s" % (prefix, self.title), self.get_vars_and_state())
862
863 def display_and_confirm(self):
864 try:
865 if self.depends:
866 for dep in ensure_list(self.depends):
867 g = state.get_group_by_id(dep)
868 if not g:
869 g = state.get_todo_by_id(dep)
870 if not g.is_done():
871 print("This step depends on '%s'. Please complete that first\n" % g.title)
872 return
873 desc = self.get_description()
874 if desc:
875 print("%s" % desc)
876 try:
877 if self.function and not self.is_done():
878 if not eval(self.function)(self):
879 return
880 except Exception as e:
881 print("Function call to %s for todo %s failed: %s" % (self.function, self.id, e))
882 raise e
883 if self.user_input and not self.is_done():
884 ui_list = ensure_list(self.user_input)
885 for ui in ui_list:
886 ui.run(self.state)
887 print()
888 if self.links:
889 print("\nLinks:\n")
890 for link in self.links:
891 print("- %s" % expand_jinja(link, self.get_vars_and_state()))
892 print()
893 cmds = self.get_commands()
894 if cmds:
895 if not self.is_done():
896 if not cmds.logs_prefix:
897 cmds.logs_prefix = self.id
898 cmds.run()
899 else:
900 print("This step is already completed. You have to first set it to 'not completed' in order to execute commands again.")
901 print()
902 if self.post_description:
903 print("%s" % self.get_post_description())
904 todostate = self.get_state()
905 if self.is_done() and len(todostate) > 2:
906 print("Variables registered\n")
907 for k in todostate:
908 if k == 'done' or k == 'done_date':
909 continue
910 print("* %s = %s" % (k, todostate[k]))
911 print()
912 completed = ask_yes_no("Mark task '%s' as completed?" % self.get_title())
913 self.set_done(completed)
914 state.save()
915 except Exception as e:
916 print("ERROR while executing todo %s (%s)" % (self.get_title(), e))
917
918 def get_menu_item(self):
919 return FunctionItem(self.get_title, self.display_and_confirm)

Callers

nothing calls this directly

Calls 15

is_doneMethod · 0.95
get_descriptionMethod · 0.95
get_vars_and_stateMethod · 0.95
get_commandsMethod · 0.95
get_post_descriptionMethod · 0.95
get_stateMethod · 0.95
get_titleMethod · 0.95
set_doneMethod · 0.95
ensure_listFunction · 0.85
expand_jinjaFunction · 0.85
ask_yes_noFunction · 0.85
get_group_by_idMethod · 0.80

Tested by

no test coverage detected