summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorharlowja <harlowja@virtualbox.rhel>2012-06-17 13:37:49 -0700
committerharlowja <harlowja@virtualbox.rhel>2012-06-17 13:37:49 -0700
commita730063635236c4343f73e55ec491e28c4a2acfe (patch)
tree14f378820b15bb063e8bca813343cac382fe2b7f /cloudinit
parentbcaa16409d7db7bc13456f8df47688e9e6f4f5ed (diff)
downloadvyos-cloud-init-a730063635236c4343f73e55ec491e28c4a2acfe.tar.gz
vyos-cloud-init-a730063635236c4343f73e55ec491e28c4a2acfe.zip
1. Remove rhel sysconfig for timezone, now have a rhel distro subclass
2. Remove private apt_get function, since it can just be the package_command public one.
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/distros/ubuntu.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/cloudinit/distros/ubuntu.py b/cloudinit/distros/ubuntu.py
index 9b743b55..ec4d6b5b 100644
--- a/cloudinit/distros/ubuntu.py
+++ b/cloudinit/distros/ubuntu.py
@@ -43,14 +43,11 @@ class Distro(distros.Distro):
def install_packages(self, pkglist):
self._update_package_sources()
- self._apt_get('install', pkglist)
+ self.package_command('install', pkglist)
def _write_network(self, settings):
util.write_file("/etc/network/interfaces", settings)
- def package_command(self, command, args=None):
- self._apt_get(command, args)
-
def set_hostname(self, hostname):
contents = "%s\n" % (hostname)
util.write_file("/etc/hostname", contents, 0644)
@@ -103,24 +100,20 @@ class Distro(distros.Distro):
" no file found at %s") % (tz, tz_file))
tz_contents = "%s\n" % tz
util.write_file("/etc/timezone", tz_contents)
- # TODO, this should be in a rhel distro subclass??
- if os.path.exists("/etc/sysconfig/clock"):
- tz_contents = '"%s"\n' % tz
- util.write_file("/etc/sysconfig/clock", tz_contents)
- # This ensures that the correct tz will be used for the system
util.copy(tz_file, "/etc/localtime")
- # apt_get top level command (install, update...), and args to pass it
- def _apt_get(self, tlc, args=None):
+ def package_command(self, command, args=None):
e = os.environ.copy()
+ # See: http://tiny.cc/kg91fw
+ # Or: http://tiny.cc/mh91fw
e['DEBIAN_FRONTEND'] = 'noninteractive'
cmd = ['apt-get', '--option', 'Dpkg::Options::=--force-confold',
- '--assume-yes', tlc]
+ '--assume-yes', command]
if args:
cmd.extend(args)
# Allow the output of this to flow outwards (ie not be captured)
util.subp(cmd, env=e, capture=False)
def _update_package_sources(self):
- self._runner.run("update-sources", self._apt_get,
+ self._runner.run("update-sources", self.package_command,
["update"], freq=PER_INSTANCE) \ No newline at end of file