diff mbox series

[v2,02/13] tests/vm: send proxy environment variables over ssh

Message ID 20190510104633.9428-3-kraxel@redhat.com (mailing list archive)
State New, archived
Headers show
Series tests/vm: serial console autoinstall, misc fixes. | expand

Commit Message

Gerd Hoffmann May 10, 2019, 10:46 a.m. UTC
Packages are fetched via proxy that way, if configured on the host.
That might be required to pass firewalls, and it allows to route
package downloads through a caching proxy server.

Needs AcceptEnv setup in sshd_config on the guest side to work.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 tests/vm/basevm.py | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Philippe Mathieu-Daudé May 18, 2019, 10:15 p.m. UTC | #1
On 5/10/19 12:46 PM, Gerd Hoffmann wrote:
> Packages are fetched via proxy that way, if configured on the host.
> That might be required to pass firewalls, and it allows to route
> package downloads through a caching proxy server.
> 
> Needs AcceptEnv setup in sshd_config on the guest side to work.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  tests/vm/basevm.py | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> index 0556bdcf9e9f..6b46674f4497 100755
> --- a/tests/vm/basevm.py
> +++ b/tests/vm/basevm.py
> @@ -38,6 +38,13 @@ class BaseVM(object):
>      GUEST_PASS = "qemupass"
>      ROOT_PASS = "qemupass"
>  
> +    envvars = [
> +        "https_proxy",
> +        "http_proxy",
> +        "ftp_proxy",
> +        "no_proxy",
> +    ]
> +
>      # The script to run in the guest that builds QEMU
>      BUILD_SCRIPT = ""
>      # The guest name, to be overridden by subclasses
> @@ -105,6 +112,8 @@ class BaseVM(object):
>                     "-o", "UserKnownHostsFile=" + os.devnull,
>                     "-o", "ConnectTimeout=1",
>                     "-p", self.ssh_port, "-i", self._ssh_key_file]
> +        for var in self.envvars:
> +            ssh_cmd += ['-o', "SendEnv=%s" % var ]
>          if interactive:
>              ssh_cmd += ['-t']
>          assert not isinstance(cmd, str)
>
diff mbox series

Patch

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 0556bdcf9e9f..6b46674f4497 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -38,6 +38,13 @@  class BaseVM(object):
     GUEST_PASS = "qemupass"
     ROOT_PASS = "qemupass"
 
+    envvars = [
+        "https_proxy",
+        "http_proxy",
+        "ftp_proxy",
+        "no_proxy",
+    ]
+
     # The script to run in the guest that builds QEMU
     BUILD_SCRIPT = ""
     # The guest name, to be overridden by subclasses
@@ -105,6 +112,8 @@  class BaseVM(object):
                    "-o", "UserKnownHostsFile=" + os.devnull,
                    "-o", "ConnectTimeout=1",
                    "-p", self.ssh_port, "-i", self._ssh_key_file]
+        for var in self.envvars:
+            ssh_cmd += ['-o', "SendEnv=%s" % var ]
         if interactive:
             ssh_cmd += ['-t']
         assert not isinstance(cmd, str)