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/setup/setup.py b/setup/setup.py
index 93d3c3d..aaa272c 100644
--- a/setup/setup.py
+++ b/setup/setup.py
@@ -23,11 +23,17 @@
from acloud.internal.lib import utils
from acloud.setup import host_setup_runner
+from acloud.setup import gcp_setup_runner
-def Run():
+def Run(args):
"""Run setup.
+ Setup options:
+ -host: Setup host settings.
+ -gcp_init: Setup gcp settings.
+ -None, default behavior will setup host and gcp settings.
+
Args:
args: Namespace object from argparse.parse_args.
"""
@@ -36,8 +42,15 @@
_PrintWelcomeMessage()
# 2.Init all subtasks in queue and traverse them.
- task_queue = [host_setup_runner.CuttlefishPkgInstaller(),
- host_setup_runner.CuttlefishHostSetup(),]
+ host_runner = host_setup_runner.CuttlefishPkgInstaller()
+ host_env_runner = host_setup_runner.CuttlefishHostSetup()
+ gcp_runner = gcp_setup_runner.GcpTaskRunner(args.config_file)
+ task_queue = []
+ if args.host or not args.gcp_init:
+ task_queue.append(host_runner)
+ task_queue.append(host_env_runner)
+ if args.gcp_init or not args.host:
+ task_queue.append(gcp_runner)
for subtask in task_queue:
subtask.Run()
@@ -63,4 +76,6 @@
def _PrintUsage():
"""Print cmd usage hints when acloud setup been finished."""
- utils.PrintColorString("\nIf you'd like more info, run '#acloud create --help'")
+ utils.PrintColorString("")
+ utils.PrintColorString("Setup process finished")
+ utils.PrintColorString("To get started creating AVDs, run '#acloud create'")