mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-18 04:38:09 +00:00
address help issues in the expanded reset command (#182)
This commit is contained in:
@ -1290,10 +1290,10 @@ class Onefuzz:
|
|||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def _user_confirmation(self, message: List[str]) -> bool:
|
def _user_confirmation(self, message: str) -> bool:
|
||||||
answer: Optional[str] = None
|
answer: Optional[str] = None
|
||||||
while answer not in ["y", "n"]:
|
while answer not in ["y", "n"]:
|
||||||
answer = input(" ".join(message)).strip()
|
answer = input(message).strip()
|
||||||
|
|
||||||
if answer == "n":
|
if answer == "n":
|
||||||
self.logger.info("not stopping")
|
self.logger.info("not stopping")
|
||||||
@ -1389,19 +1389,6 @@ class Onefuzz:
|
|||||||
:param bool tasks: Stop all tasks.
|
:param bool tasks: Stop all tasks.
|
||||||
:param bool yes: Ignoring to specify "y" in prompt.
|
:param bool yes: Ignoring to specify "y" in prompt.
|
||||||
"""
|
"""
|
||||||
delete_options = [
|
|
||||||
containers,
|
|
||||||
jobs,
|
|
||||||
pools,
|
|
||||||
notifications,
|
|
||||||
repros,
|
|
||||||
scalesets,
|
|
||||||
tasks,
|
|
||||||
]
|
|
||||||
arguments = [everything]
|
|
||||||
arguments.extend(delete_options)
|
|
||||||
if not any(arguments):
|
|
||||||
jobs, notifications, repros, tasks = True, True, True, True
|
|
||||||
|
|
||||||
if everything:
|
if everything:
|
||||||
containers, jobs, pools, notifications, repros, scalesets, tasks = (
|
containers, jobs, pools, notifications, repros, scalesets, tasks = (
|
||||||
@ -1413,10 +1400,13 @@ class Onefuzz:
|
|||||||
True,
|
True,
|
||||||
True,
|
True,
|
||||||
)
|
)
|
||||||
|
elif not any(
|
||||||
|
[containers, jobs, pools, notifications, repros, scalesets, tasks]
|
||||||
|
):
|
||||||
|
jobs, notifications, repros, tasks = True, True, True, True
|
||||||
|
|
||||||
if containers and not (tasks or jobs):
|
if containers and not (tasks or jobs):
|
||||||
print("Use --jobs or --tasks with containers")
|
raise Exception("Resetting containers requires resetting jobs or tasks")
|
||||||
return
|
|
||||||
|
|
||||||
to_delete = []
|
to_delete = []
|
||||||
argument_str = {
|
argument_str = {
|
||||||
@ -1431,8 +1421,9 @@ class Onefuzz:
|
|||||||
for k, v in locals().items():
|
for k, v in locals().items():
|
||||||
if k in argument_str and v:
|
if k in argument_str and v:
|
||||||
to_delete.append(k)
|
to_delete.append(k)
|
||||||
message = ["Confirm stopping %s " % (", ".join(to_delete))]
|
message = "Confirm stopping %s (specify y or n): " % (
|
||||||
message += ["(specify y or n): "]
|
", ".join(sorted(to_delete))
|
||||||
|
)
|
||||||
if not yes and not self._user_confirmation(message):
|
if not yes and not self._user_confirmation(message):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -335,6 +335,8 @@ class Builder:
|
|||||||
class_result = self.parse_annotation_class(name, annotation, default)
|
class_result = self.parse_annotation_class(name, annotation, default)
|
||||||
if class_result is not None:
|
if class_result is not None:
|
||||||
result.update(class_result)
|
result.update(class_result)
|
||||||
|
if help_doc and result["help"] != help_doc:
|
||||||
|
result["help"] = "%s %s" % (help_doc, result["help"])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# isinstance type signatures doesn't support TypeVar
|
# isinstance type signatures doesn't support TypeVar
|
||||||
|
Reference in New Issue
Block a user