From 961b1a53ade1d502cfb8fbe393abba4556008d18 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 31 Aug 2010 10:24:58 -0400 Subject: get '##' comment lines through to /etc/apt/sources.list (LP: #627439) LP: #627439 --- cloudinit/UserDataHandler.py | 4 +++- templates/sources.list.tmpl | 56 ++++++++++++++++++++++---------------------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/cloudinit/UserDataHandler.py b/cloudinit/UserDataHandler.py index ab7d0bc8..cbea7469 100644 --- a/cloudinit/UserDataHandler.py +++ b/cloudinit/UserDataHandler.py @@ -46,7 +46,9 @@ def do_include(str,parts): for line in str.splitlines(): if line == "#include": continue if line.startswith("#"): continue - content = urllib.urlopen(line).read() + try: + content = urllib.urlopen(line).read() + except Exception e: process_includes(email.message_from_string(decomp_str(content)),parts) def process_includes(msg,parts): diff --git a/templates/sources.list.tmpl b/templates/sources.list.tmpl index 4bd30ae4..ba4c1a14 100644 --- a/templates/sources.list.tmpl +++ b/templates/sources.list.tmpl @@ -1,53 +1,53 @@ -## Note, this file is written by cloud-init on first boot of an instance -## modifications made here will not survive a re-bundle. -## if you wish to make changes you can: -## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg -## or do the same in user-data -## b.) add sources in /etc/apt/sources.list.d -## +\## Note, this file is written by cloud-init on first boot of an instance +\## modifications made here will not survive a re-bundle. +\## if you wish to make changes you can: +\## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg +\## or do the same in user-data +\## b.) add sources in /etc/apt/sources.list.d +\### # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb $mirror $codename main deb-src $mirror $codename main -## Major bug fix updates produced after the final release of the -## distribution. +\## Major bug fix updates produced after the final release of the +\## distribution. deb $mirror $codename-updates main deb-src $mirror $codename-updates main -## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu -## team. Also, please note that software in universe WILL NOT receive any -## review or updates from the Ubuntu security team. +\## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +\## team. Also, please note that software in universe WILL NOT receive any +\## review or updates from the Ubuntu security team. deb $mirror $codename universe deb-src $mirror $codename universe deb $mirror $codename-updates universe deb-src $mirror $codename-updates universe -## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu -## team, and may not be under a free licence. Please satisfy yourself as to -## your rights to use the software. Also, please note that software in -## multiverse WILL NOT receive any review or updates from the Ubuntu -## security team. +\## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +\## team, and may not be under a free licence. Please satisfy yourself as to +\## your rights to use the software. Also, please note that software in +\## multiverse WILL NOT receive any review or updates from the Ubuntu +\## security team. # deb $mirror $codename multiverse # deb-src $mirror $codename multiverse # deb $mirror $codename-updates multiverse # deb-src $mirror $codename-updates multiverse -## Uncomment the following two lines to add software from the 'backports' -## repository. -## N.B. software from this repository may not have been tested as -## extensively as that contained in the main release, although it includes -## newer versions of some applications which may provide useful features. -## Also, please note that software in backports WILL NOT receive any review -## or updates from the Ubuntu security team. +\## Uncomment the following two lines to add software from the 'backports' +\## repository. +\## N.B. software from this repository may not have been tested as +\## extensively as that contained in the main release, although it includes +\## newer versions of some applications which may provide useful features. +\## Also, please note that software in backports WILL NOT receive any review +\## or updates from the Ubuntu security team. # deb $mirror $codename-backports main restricted universe multiverse # deb-src $mirror $codename-backports main restricted universe multiverse -## Uncomment the following two lines to add software from Canonical's -## 'partner' repository. -## This software is not part of Ubuntu, but is offered by Canonical and the -## respective vendors as a service to Ubuntu users. +\## Uncomment the following two lines to add software from Canonical's +\## 'partner' repository. +\## This software is not part of Ubuntu, but is offered by Canonical and the +\## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu $codename partner # deb-src http://archive.canonical.com/ubuntu $codename partner -- cgit v1.2.3