Merge lp:~smoser/ubuntu/maverick/cloud-init/lp942961-apt-pipeline into lp:ubuntu/maverick/cloud-init

Proposed by Scott Moser on 2012-03-14
Status: Merged
Merge reported by: Scott Moser
Merged at revision: not available
Proposed branch: lp:~smoser/ubuntu/maverick/cloud-init/lp942961-apt-pipeline
Merge into: lp:ubuntu/maverick/cloud-init
Diff against target: 150 lines (+104/-0)
6 files modified
.pc/applied-patches (+1/-0)
cloudinit/__init__.py (+1/-0)
debian/changelog (+9/-0)
debian/cloud-init.postinst (+14/-0)
debian/patches/lp948461-disable-add-configure-apt-pipelining.patch (+78/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~smoser/ubuntu/maverick/cloud-init/lp942961-apt-pipeline
Reviewer Review Type Date Requested Status
Ubuntu Development Team 2012-03-14 Pending
Review via email: mp+97494@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.pc/applied-patches'
2--- .pc/applied-patches 2010-09-16 04:28:55 +0000
3+++ .pc/applied-patches 2012-03-14 19:23:20 +0000
4@@ -1,1 +1,2 @@
5 267-do-not-use-ec2-archive-in-vpc.patch
6+lp948461-disable-add-configure-apt-pipelining.patch
7
8=== modified file 'cloudinit/__init__.py'
9--- cloudinit/__init__.py 2010-09-12 15:23:39 +0000
10+++ cloudinit/__init__.py 2012-03-14 19:23:20 +0000
11@@ -42,6 +42,7 @@
12 - ssh-import-id
13 - ssh
14 - grub-dpkg
15+ - apt-pipelining
16 - apt-update-upgrade
17 - puppet
18 - updates-check
19
20=== modified file 'debian/changelog'
21--- debian/changelog 2010-09-16 04:28:55 +0000
22+++ debian/changelog 2012-03-14 19:23:20 +0000
23@@ -1,3 +1,12 @@
24+cloud-init (0.5.15-0ubuntu3.1) UNRELEASED; urgency=low
25+
26+ * add ability to configure Acquire::http::Pipeline-Depth via
27+ cloud-config setting 'apt_pipelining' (LP: #942061)
28+ * debian/cloud-init.postinst: address population of apt_pipeline
29+ setting on installation.
30+
31+ -- Scott Moser <smoser@ubuntu.com> Wed, 14 Mar 2012 14:09:44 -0400
32+
33 cloud-init (0.5.15-0ubuntu3) maverick; urgency=low
34
35 * do not use ec2 ubuntu archive if instance is VPC (LP: #615545)
36
37=== modified file 'debian/cloud-init.postinst'
38--- debian/cloud-init.postinst 2010-02-05 15:48:21 +0000
39+++ debian/cloud-init.postinst 2012-03-14 19:23:20 +0000
40@@ -6,6 +6,20 @@
41 # disable ureadahead (LP: #499520)
42 dpkg-divert --package cloud-init --rename --divert \
43 /etc/init/ureadahead.conf.disabled --add /etc/init/ureadahead.conf
44+
45+ # we want to affect apt_pipelining on install, not wait for
46+ # cloud-init to run it on next boot.
47+ pipeline_f="/etc/apt/apt.conf.d/90cloud-init-pipelining"
48+ if [ -f /var/lib/cloud/data/cache/obj.pkl ]; then
49+ cloud-init-cfg apt-pipelining once-per-instance >/dev/null 2>&1 ||
50+ echo "Warning: failed to setup apt-pipelining" 1>&2
51+ elif [ ! -f "$pipeline_f" ]; then
52+ # there was no cloud available, so populate it ourselves.
53+ cat > "$pipeline_f" <<EOF
54+//Written by cloud-init per 'apt_pipelining'
55+Acquire::http::Pipeline-Depth "0";
56+EOF
57+ fi
58 fi
59
60 #DEBHELPER#
61
62=== added file 'debian/patches/lp948461-disable-add-configure-apt-pipelining.patch'
63--- debian/patches/lp948461-disable-add-configure-apt-pipelining.patch 1970-01-01 00:00:00 +0000
64+++ debian/patches/lp948461-disable-add-configure-apt-pipelining.patch 2012-03-14 19:23:20 +0000
65@@ -0,0 +1,78 @@
66+Description: add support for configuring apt http pipelining
67+ This allows the user to configure Acquire::http::Pipeline-Depth via
68+ cloud-config syntax.
69+ .
70+ Changes to the debian packaging (cloud-init.postinst) ensure that
71+ initially, the value will be set to '0' (different than its default value)
72+ on installation of the package. For more information on why, please
73+ see bug 948461.
74+ .
75+ This patch is pulled from the upstream cloud-init solution.
76+Bug: https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/948461
77+Author: Scott Moser <smoser@ubuntu.com>
78+--- a/cloudinit/__init__.py
79++++ b/cloudinit/__init__.py
80+@@ -42,6 +42,7 @@ cloud_config_modules:
81+ - ssh-import-id
82+ - ssh
83+ - grub-dpkg
84++ - apt-pipelining
85+ - apt-update-upgrade
86+ - puppet
87+ - updates-check
88+--- /dev/null
89++++ b/cloudinit/CloudConfig/cc_apt_pipelining.py
90+@@ -0,0 +1,53 @@
91++# vi: ts=4 expandtab
92++#
93++# Copyright (C) 2011 Canonical Ltd.
94++#
95++# Author: Ben Howard <ben.howard@canonical.com>
96++#
97++# This program is free software: you can redistribute it and/or modify
98++# it under the terms of the GNU General Public License version 3, as
99++# published by the Free Software Foundation.
100++#
101++# This program is distributed in the hope that it will be useful,
102++# but WITHOUT ANY WARRANTY; without even the implied warranty of
103++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
104++# GNU General Public License for more details.
105++#
106++# You should have received a copy of the GNU General Public License
107++# along with this program. If not, see <http://www.gnu.org/licenses/>.
108++
109++import cloudinit.util as util
110++from cloudinit.CloudConfig import per_instance
111++
112++frequency = per_instance
113++default_file = "/etc/apt/apt.conf.d/90cloud-init-pipelining"
114++
115++
116++def handle(_name, cfg, _cloud, log, _args):
117++
118++ apt_pipe_value = util.get_cfg_option_str(cfg, "apt_pipelining", False)
119++ apt_pipe_value = str(apt_pipe_value).lower()
120++
121++ if apt_pipe_value == "false":
122++ write_apt_snippet("0", log)
123++
124++ elif apt_pipe_value in ("none", "unchanged", "os"):
125++ return
126++
127++ elif apt_pipe_value in str(range(0, 6)):
128++ write_apt_snippet(apt_pipe_value, log)
129++
130++ else:
131++ log.warn("Invalid option for apt_pipeling: %s" % apt_pipe_value)
132++
133++
134++def write_apt_snippet(setting, log, f_name=default_file):
135++ """ Writes f_name with apt pipeline depth 'setting' """
136++
137++ acquire_pipeline_depth = 'Acquire::http::Pipeline-Depth "%s";\n'
138++ file_contents = ("//Written by cloud-init per 'apt_pipelining'\n"
139++ + (acquire_pipeline_depth % setting))
140++
141++ util.write_file(f_name, file_contents)
142++
143++ log.debug("Wrote %s with APT pipeline setting" % f_name)
144
145=== modified file 'debian/patches/series'
146--- debian/patches/series 2010-09-16 04:28:55 +0000
147+++ debian/patches/series 2012-03-14 19:23:20 +0000
148@@ -1,1 +1,2 @@
149 267-do-not-use-ec2-archive-in-vpc.patch
150+lp948461-disable-add-configure-apt-pipelining.patch

Subscribers

People subscribed via source and target branches

to all changes: