Fix typos, add some missed args and ensure consistency on where logger is defined.
Bug: None
Test: acloud-dev create --local-image
acloud-dev create --local-image --local-instance
Change-Id: I272cd82d68139e7d6ac27b84fdf725ce9818df3d
diff --git a/internal/lib/android_build_client.py b/internal/lib/android_build_client.py
index 9eb3a0a..2f46347 100644
--- a/internal/lib/android_build_client.py
+++ b/internal/lib/android_build_client.py
@@ -25,8 +25,8 @@
from acloud import errors
from acloud.internal.lib import base_cloud_client
-logger = logging.getLogger(__name__)
+logger = logging.getLogger(__name__)
# The BuildInfo namedtuple data structure.
# It will be the data structure returned by GetBuildInfo method.
diff --git a/internal/lib/android_build_client_test.py b/internal/lib/android_build_client_test.py
index c60a182..e2c49d2 100644
--- a/internal/lib/android_build_client_test.py
+++ b/internal/lib/android_build_client_test.py
@@ -28,6 +28,7 @@
from acloud.internal.lib import android_build_client
from acloud.internal.lib import driver_test_lib
+
# pylint: disable=protected-access
class AndroidBuildClientTest(driver_test_lib.BaseDriverTest):
"""Test AndroidBuildClient."""
diff --git a/internal/lib/android_compute_client.py b/internal/lib/android_compute_client.py
index 03f6759..3369807 100755
--- a/internal/lib/android_compute_client.py
+++ b/internal/lib/android_compute_client.py
@@ -42,6 +42,7 @@
from acloud.internal.lib import gcompute_client
from acloud.internal.lib import utils
+
logger = logging.getLogger(__name__)
diff --git a/internal/lib/auth.py b/internal/lib/auth.py
index 819abc8..5066878 100644
--- a/internal/lib/auth.py
+++ b/internal/lib/auth.py
@@ -49,6 +49,7 @@
from acloud import errors
+
logger = logging.getLogger(__name__)
HOME_FOLDER = os.path.expanduser("~")
# If there is no specific scope use case, we will always use this default full
diff --git a/internal/lib/base_cloud_client.py b/internal/lib/base_cloud_client.py
index 9f851da..346b590 100755
--- a/internal/lib/base_cloud_client.py
+++ b/internal/lib/base_cloud_client.py
@@ -32,6 +32,7 @@
from acloud import errors
from acloud.internal.lib import utils
+
logger = logging.getLogger(__name__)
diff --git a/internal/lib/cheeps_compute_client.py b/internal/lib/cheeps_compute_client.py
index 2909ff7..62b1126 100644
--- a/internal/lib/cheeps_compute_client.py
+++ b/internal/lib/cheeps_compute_client.py
@@ -42,8 +42,10 @@
from acloud.internal.lib import android_compute_client
from acloud.internal.lib import gcompute_client
+
logger = logging.getLogger(__name__)
+
class CheepsComputeClient(android_compute_client.AndroidComputeClient):
"""Client that manages Cheeps based Android Virtual Device.
diff --git a/internal/lib/cvd_compute_client.py b/internal/lib/cvd_compute_client.py
index e05f207..f1e9dce 100644
--- a/internal/lib/cvd_compute_client.py
+++ b/internal/lib/cvd_compute_client.py
@@ -45,6 +45,9 @@
from acloud.internal.lib import gcompute_client
from acloud.internal.lib import utils
+
+logger = logging.getLogger(__name__)
+
_METADATA_TO_UNSET = ["cvd_01_launch",
"cvd_01_fetch_android_build_target",
"cvd_01_fetch_android_bid",
@@ -53,8 +56,6 @@
"cvd_01_fetch_kernel_bid",
"cvd_01_fetch_kernel_build_target"]
-logger = logging.getLogger(__name__)
-
class CvdComputeClient(android_compute_client.AndroidComputeClient):
"""Client that manages Anadroid Virtual Device."""
diff --git a/internal/lib/gcompute_client.py b/internal/lib/gcompute_client.py
index 2cf8025..fa2438c 100755
--- a/internal/lib/gcompute_client.py
+++ b/internal/lib/gcompute_client.py
@@ -36,6 +36,7 @@
from acloud.internal.lib import base_cloud_client
from acloud.internal.lib import utils
+
logger = logging.getLogger(__name__)
_MAX_RETRIES_ON_FINGERPRINT_CONFLICT = 10
@@ -1139,7 +1140,7 @@
if labels is not None:
body["labels"] = labels
if tags:
- body["tags"] = { "items": tags }
+ body["tags"] = {"items": tags}
if gpu:
body["guestAccelerators"] = [{
"acceleratorType": self.GetAcceleratorUrl(gpu, zone),
diff --git a/internal/lib/gcompute_client_test.py b/internal/lib/gcompute_client_test.py
index df84a87..6dbf8d3 100644
--- a/internal/lib/gcompute_client_test.py
+++ b/internal/lib/gcompute_client_test.py
@@ -30,12 +30,14 @@
from acloud.internal.lib import gcompute_client
from acloud.internal.lib import utils
+
GS_IMAGE_SOURCE_URI = "https://storage.googleapis.com/fake-bucket/fake.tar.gz"
GS_IMAGE_SOURCE_DISK = (
"https://www.googleapis.com/compute/v1/projects/fake-project/zones/"
"us-east1-d/disks/fake-disk")
PROJECT = "fake-project"
+
# pylint: disable=protected-access, too-many-public-methods
class ComputeClientTest(driver_test_lib.BaseDriverTest):
"""Test ComputeClient."""
@@ -583,9 +585,12 @@
@mock.patch.object(gcompute_client.ComputeClient, "GetSubnetworkUrl")
@mock.patch.object(gcompute_client.ComputeClient, "GetMachineType")
@mock.patch.object(gcompute_client.ComputeClient, "WaitOnOperation")
- def testCreateInstanceWithTags(self, mock_wait, mock_get_mach_type,
- mock_get_subnetwork_url, mock_get_network_url,
- mock_get_image):
+ def testCreateInstanceWithTags(self,
+ mock_wait,
+ mock_get_mach_type,
+ mock_get_subnetwork_url,
+ mock_get_network_url,
+ mock_get_image):
"""Test CreateInstance."""
mock_get_mach_type.return_value = {"selfLink": self.MACHINE_TYPE_URL}
mock_get_network_url.return_value = self.NETWORK_URL
diff --git a/internal/lib/goldfish_compute_client.py b/internal/lib/goldfish_compute_client.py
index 2c5ed47..acf0fdf 100644
--- a/internal/lib/goldfish_compute_client.py
+++ b/internal/lib/goldfish_compute_client.py
@@ -47,6 +47,7 @@
from acloud.internal.lib import android_compute_client
from acloud.internal.lib import gcompute_client
+
logger = logging.getLogger(__name__)
diff --git a/internal/lib/gstorage_client.py b/internal/lib/gstorage_client.py
index 586b173..b33a432 100755
--- a/internal/lib/gstorage_client.py
+++ b/internal/lib/gstorage_client.py
@@ -24,6 +24,7 @@
from acloud.internal.lib import base_cloud_client
from acloud.internal.lib import utils
+
logger = logging.getLogger(__name__)
diff --git a/internal/lib/utils.py b/internal/lib/utils.py
index a1591e9..5b085f4 100755
--- a/internal/lib/utils.py
+++ b/internal/lib/utils.py
@@ -40,6 +40,7 @@
from acloud import errors
from acloud.internal import constants
+
logger = logging.getLogger(__name__)
SSH_KEYGEN_CMD = ["ssh-keygen", "-t", "rsa", "-b", "4096"]
diff --git a/internal/lib/utils_test.py b/internal/lib/utils_test.py
index f818cf1..10d7a70 100644
--- a/internal/lib/utils_test.py
+++ b/internal/lib/utils_test.py
@@ -31,12 +31,14 @@
from acloud.internal.lib import driver_test_lib
from acloud.internal.lib import utils
+
# Tkinter may not be supported so mock it out.
try:
import Tkinter
except ImportError:
Tkinter = mock.Mock()
+
class FakeTkinter(object):
"""Fake implementation of Tkinter.Tk()"""