Merge "Refactor variable name from gce_user to user."
diff --git a/delete/delete.py b/delete/delete.py
index 225be8d..7e26d0f 100644
--- a/delete/delete.py
+++ b/delete/delete.py
@@ -245,7 +245,7 @@
oauth2_credentials=credentials)
ssh = ssh_object.Ssh(
ip=ssh_object.IP(ip=remote_host),
- gce_user=host_user or constants.GCE_USER,
+ user=host_user or constants.GCE_USER,
ssh_private_key_path=(
host_ssh_private_key_path or cfg.ssh_private_key_path))
try:
diff --git a/internal/lib/cvd_compute_client_multi_stage.py b/internal/lib/cvd_compute_client_multi_stage.py
index 165ee83..0177367 100644
--- a/internal/lib/cvd_compute_client_multi_stage.py
+++ b/internal/lib/cvd_compute_client_multi_stage.py
@@ -191,7 +191,7 @@
extra_scopes, boot_disk_size_gb,
avd_spec)
self._ssh = Ssh(ip=self._ip,
- gce_user=constants.GCE_USER,
+ user=constants.GCE_USER,
ssh_private_key_path=self._ssh_private_key_path,
extra_args_ssh_tunnel=self._extra_args_ssh_tunnel,
report_internal_ip=self._report_internal_ip)
diff --git a/internal/lib/ssh.py b/internal/lib/ssh.py
index ddb0f9b..c8c4fd6 100755
--- a/internal/lib/ssh.py
+++ b/internal/lib/ssh.py
@@ -154,14 +154,14 @@
Attributes:
_ip: an IP object.
- _gce_user: String of user login into the instance.
+ _user: String of user login into the instance.
_ssh_private_key_path: Path to the private key file.
_extra_args_ssh_tunnel: String, extra args for ssh or scp.
"""
- def __init__(self, ip, gce_user, ssh_private_key_path,
+ def __init__(self, ip, user, ssh_private_key_path,
extra_args_ssh_tunnel=None, report_internal_ip=False):
self._ip = ip.internal if report_internal_ip else ip.external
- self._gce_user = gce_user
+ self._user = user
self._ssh_private_key_path = ssh_private_key_path
self._extra_args_ssh_tunnel = extra_args_ssh_tunnel
@@ -210,7 +210,7 @@
if execute_bin == constants.SSH_BIN:
base_cmd.append(_SSH_IDENTITY %
- {"login_user":self._gce_user, "ip_addr":self._ip})
+ {"login_user":self._user, "ip_addr":self._ip})
return " ".join(base_cmd)
if execute_bin == constants.SCP_BIN:
return " ".join(base_cmd)
@@ -266,7 +266,7 @@
"""
scp_command = [self.GetBaseCmd(constants.SCP_BIN)]
scp_command.append(src_file)
- scp_command.append("%s@%s:%s" %(self._gce_user, self._ip, dst_file))
+ scp_command.append("%s@%s:%s" %(self._user, self._ip, dst_file))
ShellCmdWithRetry(" ".join(scp_command))
def ScpPullFile(self, src_file, dst_file):
@@ -277,6 +277,6 @@
dst_file: The destination file path the file is pulled to.
"""
scp_command = [self.GetBaseCmd(constants.SCP_BIN)]
- scp_command.append("%s@%s:%s" %(self._gce_user, self._ip, src_file))
+ scp_command.append("%s@%s:%s" %(self._user, self._ip, src_file))
scp_command.append(dst_file)
ShellCmdWithRetry(" ".join(scp_command))
diff --git a/internal/lib/ssh_test.py b/internal/lib/ssh_test.py
index bddefd5..c443a62 100644
--- a/internal/lib/ssh_test.py
+++ b/internal/lib/ssh_test.py
@@ -56,7 +56,7 @@
def testGetBaseCmdWithInternalIP(self):
"""Test get base command with internal ip."""
ssh_object = ssh.Ssh(ip=self.FAKE_IP,
- gce_user=self.FAKE_SSH_USER,
+ user=self.FAKE_SSH_USER,
ssh_private_key_path=self.FAKE_SSH_PRIVATE_KEY_PATH,
report_internal_ip=self.FAKE_REPORT_INTERNAL_IP)
expected_ssh_cmd = ("/usr/bin/ssh -i /fake/acloud_rea -q -o UserKnownHostsFile=/dev/null "
@@ -173,7 +173,7 @@
"""Test IP class to get ip address."""
# Internal ip case.
ssh_object = ssh.Ssh(ip=ssh.IP(external="1.1.1.1", internal="10.1.1.1"),
- gce_user=self.FAKE_SSH_USER,
+ user=self.FAKE_SSH_USER,
ssh_private_key_path=self.FAKE_SSH_PRIVATE_KEY_PATH,
report_internal_ip=True)
expected_ip = "10.1.1.1"
@@ -181,14 +181,14 @@
# External ip case.
ssh_object = ssh.Ssh(ip=ssh.IP(external="1.1.1.1", internal="10.1.1.1"),
- gce_user=self.FAKE_SSH_USER,
+ user=self.FAKE_SSH_USER,
ssh_private_key_path=self.FAKE_SSH_PRIVATE_KEY_PATH)
expected_ip = "1.1.1.1"
self.assertEqual(ssh_object._ip, expected_ip)
# Only one ip case.
ssh_object = ssh.Ssh(ip=ssh.IP(ip="1.1.1.1"),
- gce_user=self.FAKE_SSH_USER,
+ user=self.FAKE_SSH_USER,
ssh_private_key_path=self.FAKE_SSH_PRIVATE_KEY_PATH)
expected_ip = "1.1.1.1"
self.assertEqual(ssh_object._ip, expected_ip)
@@ -196,7 +196,7 @@
def testWaitForSsh(self):
"""Test WaitForSsh."""
ssh_object = ssh.Ssh(ip=self.FAKE_IP,
- gce_user=self.FAKE_SSH_USER,
+ user=self.FAKE_SSH_USER,
ssh_private_key_path=self.FAKE_SSH_PRIVATE_KEY_PATH,
report_internal_ip=self.FAKE_REPORT_INTERNAL_IP)
self.Patch(ssh, "_SshCall", return_value=-1)
diff --git a/public/actions/remote_instance_cf_device_factory.py b/public/actions/remote_instance_cf_device_factory.py
index 1c33d1f..81ef5dc 100644
--- a/public/actions/remote_instance_cf_device_factory.py
+++ b/public/actions/remote_instance_cf_device_factory.py
@@ -133,7 +133,7 @@
ip = ssh.IP(ip=self._avd_spec.remote_host)
self._ssh = ssh.Ssh(
ip=ip,
- gce_user=self._avd_spec.host_user or constants.GCE_USER,
+ user=self._avd_spec.host_user or constants.GCE_USER,
ssh_private_key_path=(self._avd_spec.host_ssh_private_key_path or
self._cfg.ssh_private_key_path),
extra_args_ssh_tunnel=self._cfg.extra_args_ssh_tunnel,
@@ -243,7 +243,7 @@
avd_spec=self._avd_spec)
ip = self._compute_client.GetInstanceIP(instance)
self._ssh = ssh.Ssh(ip=ip,
- gce_user=constants.GCE_USER,
+ user=constants.GCE_USER,
ssh_private_key_path=self._cfg.ssh_private_key_path,
extra_args_ssh_tunnel=self._cfg.extra_args_ssh_tunnel,
report_internal_ip=self._report_internal_ip)
diff --git a/public/actions/remote_instance_cf_device_factory_test.py b/public/actions/remote_instance_cf_device_factory_test.py
index 992239d..448b93f 100644
--- a/public/actions/remote_instance_cf_device_factory_test.py
+++ b/public/actions/remote_instance_cf_device_factory_test.py
@@ -255,7 +255,7 @@
fake_image,
fake_host_package)
factory._ssh = ssh.Ssh(ip=fake_ip,
- gce_user=constants.GCE_USER,
+ user=constants.GCE_USER,
ssh_private_key_path="/fake/acloud_rea")
factory._UploadArtifacts(fake_image, fake_host_package, fake_local_image_dir)
expected_cmd1 = ("/usr/bin/install_zip.sh . < %s" % fake_image)
diff --git a/pull/pull.py b/pull/pull.py
index 1f99c5c..5da45d5 100644
--- a/pull/pull.py
+++ b/pull/pull.py
@@ -58,7 +58,7 @@
A Report instance.
"""
ssh = Ssh(ip=IP(ip=instance.ip),
- gce_user=constants.GCE_USER,
+ user=constants.GCE_USER,
ssh_private_key_path=cfg.ssh_private_key_path,
extra_args_ssh_tunnel=cfg.extra_args_ssh_tunnel)
log_files = SelectLogFileToPull(ssh, file_name)
diff --git a/pull/pull_test.py b/pull/pull_test.py
index 6af9644..f57c6c4 100644
--- a/pull/pull_test.py
+++ b/pull/pull_test.py
@@ -70,7 +70,7 @@
"""Test DisplayLog."""
fake_ip = ssh.IP(external="1.1.1.1", internal="10.1.1.1")
_ssh = ssh.Ssh(ip=fake_ip,
- gce_user=constants.GCE_USER,
+ user=constants.GCE_USER,
ssh_private_key_path="/fake/acloud_rea")
self.Patch(utils, "GetUserAnswerYes", return_value="Y")
log_file = "file1.log"