Add new option "gcp_init" for acloud setup
- Setup user information in gcloud config file
- Enable gcloud API service
- Generate SSH key
Bug: 110856450
Test: ./run_tests.sh, m acloud && acloud setup --gcp_init
acloud setup
Change-Id: I88d6e52cb5164e023023bf9c5c62b93c87c8bc3f
diff --git a/internal/lib/utils.py b/internal/lib/utils.py
index 4d32f8f..b15d46d 100755
--- a/internal/lib/utils.py
+++ b/internal/lib/utils.py
@@ -31,6 +31,7 @@
import time
import uuid
+from acloud.internal import constants
from acloud.public import errors
logger = logging.getLogger(__name__)
@@ -399,6 +400,19 @@
"""
return str(raw_input(colors + question + TextColors.ENDC).strip())
+def GetUserAnswerYes(question):
+ """Ask user about acloud setup question.
+
+ Args:
+ question: String, ask question for user.
+ Ex: "Are you sure to change bucket name:[y/n]"
+
+ Returns:
+ Boolean, True if answer is "Yes", False otherwise.
+ """
+ answer = InteractWithQuestion(question)
+ return answer.lower() in constants.USER_ANSWER_YES
+
class BatchHttpRequestExecutor(object):
"""A helper class that executes requests in batch with retry.