Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
ciao-down: Use apt section of cloudinit file
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Mark Ryan committed Feb 14, 2017
1 parent 16c02e1 commit 1e0581a
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions testutil/ciao-down/cloudinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
Expand All @@ -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
Expand Down Expand Up @@ -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" .}}
Expand Down Expand Up @@ -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}}"
Expand All @@ -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
Expand Down Expand Up @@ -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" .}}
Expand Down

0 comments on commit 1e0581a

Please sign in to comment.