summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2012-07-06 10:47:19 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2012-07-06 10:47:19 -0700
commitb3975ef46bbee1c713b963f3897fce9c5d3cbe94 (patch)
tree38e24c69f9698dae09931d17d4eff2b0fde98e08
parent51a8e6ee88e9ee83450215208e2aaad4ad2a2843 (diff)
downloadvyos-cloud-init-b3975ef46bbee1c713b963f3897fce9c5d3cbe94.tar.gz
vyos-cloud-init-b3975ef46bbee1c713b963f3897fce9c5d3cbe94.zip
Updated so that if no mirror is found, the module stops running.
-rw-r--r--cloudinit/config/cc_apt_update_upgrade.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/cloudinit/config/cc_apt_update_upgrade.py b/cloudinit/config/cc_apt_update_upgrade.py
index 42b6f3e9..5c5e510c 100644
--- a/cloudinit/config/cc_apt_update_upgrade.py
+++ b/cloudinit/config/cc_apt_update_upgrade.py
@@ -45,13 +45,16 @@ EXPORT_GPG_KEYID = """
"""
-def handle(_name, cfg, cloud, log, _args):
+def handle(name, cfg, cloud, log, _args):
update = util.get_cfg_option_bool(cfg, 'apt_update', False)
upgrade = util.get_cfg_option_bool(cfg, 'apt_upgrade', False)
release = get_release()
-
mirror = find_apt_mirror(cloud, cfg)
+ if not mirror:
+ log.debug(("Skipping module named %s,"
+ " no package 'mirror' located"), name)
+ return
log.debug("Selected mirror at: %s" % mirror)