From 1e0581a10a1f7fa4f05b703664fb22b03a2ceb63 Mon Sep 17 00:00:00 2001 From: Mark Ryan Date: Mon, 13 Feb 2017 15:36:15 +0000 Subject: [PATCH] ciao-down: Use apt section of cloudinit file The cloudinit file has a dedicated section for configuring apt but we weren't using it. Instead we were executing all of the apt commands in the runcmd and write_files section of the cloud-init file. This commit moves the instructions that set up the apt proxies and initiate the apt-get upgrade to the apt section. The other commands such as setting up sources and installing packages can not be used as these sections do not handle proxies correctly. Fixes #1131 Signed-off-by: Mark Ryan --- testutil/ciao-down/cloudinit.go | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/testutil/ciao-down/cloudinit.go b/testutil/ciao-down/cloudinit.go index ac78cfe94..bc2937684 100644 --- a/testutil/ciao-down/cloudinit.go +++ b/testutil/ciao-down/cloudinit.go @@ -34,9 +34,6 @@ mounts: {{if len .UIPath }} - [hostui, {{.UIPath}}, 9p, "x-systemd.automount,x-systemd.device-timeout=10,nofail,trans=virtio,version=9p2000.L", "0", "0"]{{end}} write_files: {{- if len $.HTTPProxy }} - - content: | - Acquire::http::Proxy "{{$.HTTPProxy}}"; - path: /etc/apt/apt.conf - content: | [Service] Environment="HTTP_PROXY={{$.HTTPProxy}}"{{if len .HTTPSProxy}} "HTTPS_PROXY={{.HTTPSProxy}}{{end}}"{{if len .NoProxy}} "NO_PROXY={{.NoProxy}},singlevm{{end}}" @@ -62,6 +59,15 @@ write_files: deb https://apt.dockerproject.org/repo ubuntu-xenial main path: /etc/apt/sources.list.d/docker.list +apt: +{{- if len $.HTTPProxy }} + proxy: "{{$.HTTPProxy}}" +{{- end}} +{{- if len $.HTTPSProxy }} + https_proxy: "{{$.HTTPSProxy}}" +{{- end}} +package_upgrade: true + runcmd: - echo "127.0.0.1 singlevm" >> /etc/hosts - mount hostgo @@ -109,10 +115,6 @@ runcmd: - {{template "ENV" .}}apt-get update - {{template "CHECK" .}} - - curl -X PUT -d "Upgrading" 10.0.2.2:{{.HTTPServerPort}} - - {{template "ENV" .}}apt-get upgrade -y - - {{template "CHECK" .}} - - curl -X PUT -d "Installing Docker" 10.0.2.2:{{.HTTPServerPort}} - {{template "ENV" .}}apt-get install docker-engine -y - {{template "CHECK" .}} @@ -256,9 +258,6 @@ mounts: - [hostgo, {{.GoPath}}, 9p, "x-systemd.automount,x-systemd.device-timeout=10,nofail,trans=virtio,version=9p2000.L", "0", "0"] write_files: {{- if len $.HTTPProxy }} - - content: | - Acquire::http::Proxy "{{$.HTTPProxy}}"; - path: /etc/apt/apt.conf - content: | [Service] Environment="HTTP_PROXY={{$.HTTPProxy}}"{{if len .HTTPSProxy}} "HTTPS_PROXY={{.HTTPSProxy}}{{end}}"{{if len .NoProxy}} "NO_PROXY={{.NoProxy}},singlevm{{end}}" @@ -283,6 +282,15 @@ write_files: deb https://apt.dockerproject.org/repo ubuntu-xenial main path: /etc/apt/sources.list.d/docker.list +apt: +{{- if len $.HTTPProxy }} + proxy: "{{$.HTTPProxy}}" +{{- end}} +{{- if len $.HTTPSProxy }} + https_proxy: "{{$.HTTPSProxy}}" +{{- end}} +package_upgrade: true + runcmd: - echo "127.0.0.1 singlevm" >> /etc/hosts - mount hostgo @@ -330,15 +338,10 @@ runcmd: - {{template "ENV" .}}curl -fsSL http://download.opensuse.org/repositories/home:clearlinux:preview:clear-containers-2.1/xUbuntu_16.04/Release.key | sudo apt-key add - - {{template "CHECK" .}} - - curl -X PUT -d "Retrieving updated list of packages" 10.0.2.2:{{.HTTPServerPort}} - {{template "ENV" .}}apt-get update - {{template "CHECK" .}} - - curl -X PUT -d "Upgrading" 10.0.2.2:{{.HTTPServerPort}} - - {{template "ENV" .}}apt-get upgrade -y - - {{template "CHECK" .}} - - curl -X PUT -d "Installing Clear Containers Runtime" 10.0.2.2:{{.HTTPServerPort}} - {{template "ENV" .}}apt-get install cc-oci-runtime -y - {{template "CHECK" .}}