summaryrefslogtreecommitdiff
path: root/compute/gcloud.py
AgeCommit message (Collapse)Author
2015-05-07cros lint: check the indentation level of section argumentsMike Frysinger
Sometimes the indentation of things like "Args:" is incorrect. Add a linter check for it and fix up all the existing errors. BUG=chromium:485005 TEST=`cros lint` on all files pass, and catches some bad cases Change-Id: I79ea60d1e07c40d9283284bdaebfcda5af4e6246 Reviewed-on: https://chromium-review.googlesource.com/269642 Trybot-Ready: Mike Frysinger <vapier@chromium.org> Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
2015-04-20gcloud: Fix issues from gcloud flexible auth CLRichard Larocque
Fixes a handful of issues in 86279bea0a40d8f9d20b459729e8fd5fe02d30f2 that were pointed out after the commit landed. The fixes include: - Replace some bits of shell with a Python regex. - Use DoZoneSpecificCommand in implementation of GetInstanceIP(). - Fix spacing between methods. - Add a more informative exception message. BUG=brillo:782 TEST=Manual: Apply this patch to the top of the stack and run tests. Change-Id: I20fb7fd532bdfe7a8e72afc0b3fc71bbae1c204d Reviewed-on: https://chromium-review.googlesource.com/266046 Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Richard Larocque <rlarocque@chromium.org> Tested-by: Richard Larocque <rlarocque@chromium.org>
2015-04-14Make authentication more flexible in gcloud libRichard Larocque
This commit contains various improvements to gcloud, most of which are focused on allowing SSH to VMs that don't meet typical GCE standards. Adds a special exception type for errors thrown by this library. Adds support for username and ssh_key_file parameters to various commands. This allows for more options when authenticating to the VM and is particularly useful when the VM is not based on a typical GCE image. Makes instance creation's wait_until_sshable parameter behave differently. It used to wait for a successful SSH login to the VM. This didn't work for VMs that required specific usernames or SSH keys. The function now waits for the VM to accept connections on port 22, and does't bother trying to authenticate until later. Handles failures in wait_until_sshable during instance creation by deleting the VM. It is assumed that callers who set that parameter have no interest in a VM that is not responsive to SSH, and asking them to clean it up themselves would get messy. BUG=brillo:782 Change-Id: I36dbf1cd0e49cfc33a9e2381b820c81fc523c2fa Reviewed-on: https://chromium-review.googlesource.com/264770 Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org> Commit-Queue: Richard Larocque <rlarocque@chromium.org> Tested-by: Richard Larocque <rlarocque@chromium.org>
2015-03-31cros_compute: Add a quiet flag.Prathmesh Prabhu
gcloud cli has a quiet flag to supress user prompts. Add it to our own cli to allow scripting. BUG=None. TEST=Used the new flag in a contrib script. Change-Id: I4bedd06f379e8b4609e6f6dd9297f066b752470b Reviewed-on: https://chromium-review.googlesource.com/262307 Tested-by: Prathmesh Prabhu <pprabhu@chromium.org> Trybot-Ready: Prathmesh Prabhu <pprabhu@chromium.org> Reviewed-by: Fang Deng <fdeng@chromium.org> Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
2015-03-24cros_compute: Tag instances with the seed image.Prathmesh Prabhu
We currently have no way of knowing which cros_compute image any bot on our GCE build farm is running. Add custom metadata when creating instances to remember the image used to create an instance. We could later use this tag to automate deployment. BUG=chromium:470240 TEST=Create a new instance, manually verify metadata. Change-Id: I02b146f42ae9c0f6c8110b85be74a452326f6955 Reviewed-on: https://chromium-review.googlesource.com/262257 Reviewed-by: Fang Deng <fdeng@chromium.org> Reviewed-by: Aviv Keshet <akeshet@chromium.org> Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
2015-03-20logging: use cros_logging instead of loggingRalph Nathan
Replace all instances of import logging in chromite with cros_logging. BUG=brillo:615 TEST=unittests + trybot CQ-DEPEND=CL:260455 Change-Id: I3cf7ad9301290e736de2eebea00e9085656a2d5b Reviewed-on: https://chromium-review.googlesource.com/261311 Reviewed-by: Don Garrett <dgarrett@chromium.org> Commit-Queue: Ralph Nathan <ralphnathan@chromium.org> Tested-by: Ralph Nathan <ralphnathan@chromium.org>
2014-11-27lint: compute: fix whitespace issuesMike Frysinger
BUG=chromium:431514 TEST=no more lint errors Change-Id: I41486c2f473f80143ec6f548863794ae75f50534 Reviewed-on: https://chromium-review.googlesource.com/231961 Reviewed-by: Yu-Ju Hong <yjhong@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
2014-11-25compute: fix several buildbot-related issuesYu-Ju Hong
* Append buildbot master hostname and IP address to /etc/hosts. * Fixed the path of buildbot password file. * Specify IP address to use when creating a cros GCE bot. BUG=chromium:432716 TEST=launched an instance using the new image Change-Id: If0a7e346789013a16e6966e69003456c05d1700a Reviewed-on: https://chromium-review.googlesource.com/231727 Tested-by: Yu-Ju Hong <yjhong@chromium.org> Reviewed-by: Aviv Keshet <akeshet@chromium.org>
2014-11-21lint: update support for pylint-1.xMike Frysinger
This doesn't fix the new warnings, but makes `cros lint` work. BUG=chromium:431514 TEST=`cros lint <files>` no longer crashes TEST=`cros/commands/lint_unittest.py` passes Change-Id: I908abd03027cfc348ed3e74454d9cc0e556ca29d Reviewed-on: https://chromium-review.googlesource.com/228721 Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
2014-10-29compute: add scripts to botify a GCE instanceYu-Ju Hong
This CL includes basic commands to launch a Google Compute Engine instance, botify the instance (i.e., configuring it to be capable of running Chrome OS builds), and create an image from the instance. This CL does not include automatic buildbot integration (e.g. adding the new instance to buildbot configs), which will be addressed in a separate CL. The new directory chromite/compute containing the following scripts: * bot_constants.py: Constants used to botify an instance. * compute_configs.py: The GCE constants/configs. * cros_compute.py: The main script to create instances/images. * gcloud.py: A basic wrapper around `gcloud compute`. * setup_bot.py: The script to run on an instance during botifying. BUG=chromium:399075 TEST=`manually testing each command Change-Id: Ia7eb656465715af501be9dde8e7f900e801a0758 Reviewed-on: https://chromium-review.googlesource.com/223366 Reviewed-by: Yu-Ju Hong <yjhong@chromium.org> Commit-Queue: Yu-Ju Hong <yjhong@chromium.org> Tested-by: Yu-Ju Hong <yjhong@chromium.org>