From 0c79e64925918a7f78d6e2ba34401367d7cf7c64 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 8 Jan 2010 16:32:34 -0500 Subject: pull in chuck's repo at rev 75 bzr+ssh://bazaar.launchpad.net/~zulcss/ec2-init/ec2-init-config/ --- ec2init/ec2config.py | 92 +++++++++++++++++++++++++++++++++++++++ upstart/ec2-apt-update.conf | 13 ++++++ upstart/ec2-ebs-mounts.conf | 12 +++++ upstart/ec2-preconf-ssh-keys.conf | 13 ++++++ upstart/ec2-raid.conf | 12 +++++ upstart/ec2-runurl.conf | 13 ++++++ upstart/ec2-update-software.conf | 12 +++++ 7 files changed, 167 insertions(+) create mode 100644 ec2init/ec2config.py create mode 100644 upstart/ec2-apt-update.conf create mode 100644 upstart/ec2-ebs-mounts.conf create mode 100644 upstart/ec2-preconf-ssh-keys.conf create mode 100644 upstart/ec2-raid.conf create mode 100644 upstart/ec2-runurl.conf create mode 100644 upstart/ec2-update-software.conf diff --git a/ec2init/ec2config.py b/ec2init/ec2config.py new file mode 100644 index 00000000..23ab5ac3 --- /dev/null +++ b/ec2init/ec2config.py @@ -0,0 +1,92 @@ +# +# Common code for the EC2 configuration files in Ubuntu +# Copyright (C) 2008-2010 Canonical Ltd. +# +# Author: Chuck Short +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 3, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import yaml +import re + +class EC2Config(): + def read_conf(self, ec2Config): + #stream = file('/tmp/ec2.yaml') + ec2Config = yaml.load(stream) + stream.close() + return ec2Config + + def check_for_updates(self): + #stream = file('/tmp/ec2.yaml') + ec2Config = yaml.load(stream) + stream.close() + + value = ec2Config['apt_update'] + return value + + def check_for_upgrade(self): + #stream = file('/tmp/ec2.yaml') + ec2Config = yaml.load(stream) + stream.close() + + value = ec2Config['apt_upgrade'] + return value + + def parse_ssh_keys(self): + #stream = file('/tmp/ec2.yaml') + ec2Config = yaml.load(stream) + stream.close() + + disableRoot = ec2Config['disable_root'] + if disableRoot == 'true': + value = 'disabled_root' + return value + else: + ec2Key = ec2Config['ec2_fetch_key'] + if ec2Key != 'none': + value = 'default_key' + return value + else: + return ec2Key + + def add_ppa(self): + stream = file('/tmp/ec2.yaml') + ec2Config = yaml.load(stream) + stream.close() + + value = ec2Config['apt_sources'] + for ent in ec2Config['apt_sources']: + ppa = ent['source'] + where = ppa.find('ppa:') + if where != -1: + return ppa + + def add_custom_repo(self): + stream = file('/tmp/ec2.yaml') + ec2Config = yaml.load(stream) + stream.close() + + sources = [] + value = ec2Config['apt_sources'] + for ent in ec2Config['apt_sources']: + if ent.has_key('keyserver'): + keyserver = ent['keyserver'] + if ent.has_key('keyid'): + keyid = ent['keyid'] + if ent.has_key('filename'): + filename = ent['filename'] + source = ent['source'] + if source.startswith("deb"): + sources.append(source) + + return (keyserver,sources,keyid,filename) diff --git a/upstart/ec2-apt-update.conf b/upstart/ec2-apt-update.conf new file mode 100644 index 00000000..b280801b --- /dev/null +++ b/upstart/ec2-apt-update.conf @@ -0,0 +1,13 @@ +# ec2-apt-update - Update archive at boot time +# +# Update archive at boot + +description "Update archive at boot" + +start on (cloud-config + and local-filesystems + and net-device-up IFACE=eth0) +console output +task +# exec /usr/sbin/cloud-init-run --once ec2-apt-update ec2-apt-update +exec /usr/sbin/ec2-apt-update diff --git a/upstart/ec2-ebs-mounts.conf b/upstart/ec2-ebs-mounts.conf new file mode 100644 index 00000000..a1457f6a --- /dev/null +++ b/upstart/ec2-ebs-mounts.conf @@ -0,0 +1,12 @@ +# ec2-ebs-mounts +# +# Mount EC2 EBS mount points + +description "Populate EBS mountpoints" + +start on cloud-config + +console output +task + +exec /usr/sbin/ec2-ebs-mount diff --git a/upstart/ec2-preconf-ssh-keys.conf b/upstart/ec2-preconf-ssh-keys.conf new file mode 100644 index 00000000..383b5bbc --- /dev/null +++ b/upstart/ec2-preconf-ssh-keys.conf @@ -0,0 +1,13 @@ +# ec2-preconf-ssh-keys +# +# Download preconfigured ssh-keys for EC2. + +description "Download preconfigured ssh keys" + +start on (cloud-config + and local-filesystem + and net-device-ifup IFACE=eth0) +console out +task + +exec /usr/sbin/ec2-preconf-ssh-keys diff --git a/upstart/ec2-raid.conf b/upstart/ec2-raid.conf new file mode 100644 index 00000000..e4364373 --- /dev/null +++ b/upstart/ec2-raid.conf @@ -0,0 +1,12 @@ +# ec2-raid - Setup ephemeral storage RAID and mount points +# +# Setup ephemeral storage RAID and mount points + +description "Setup RAID storage and moint points" + +start on (cloud-config + and local-filesystem) +console output +task + +exec /usr/sbin/ec2-setup-raid diff --git a/upstart/ec2-runurl.conf b/upstart/ec2-runurl.conf new file mode 100644 index 00000000..28249f8d --- /dev/null +++ b/upstart/ec2-runurl.conf @@ -0,0 +1,13 @@ +# ec2-runurl - Run runurl at boot +# +# Runurl at boot + +description "Run runurl" + +start on (cloud-config + and local-filesystem + and net-device-ifup IFACE=eth0) +console output +task + +exec /usr/sbin/ec2-runurl diff --git a/upstart/ec2-update-software.conf b/upstart/ec2-update-software.conf new file mode 100644 index 00000000..ee3131d1 --- /dev/null +++ b/upstart/ec2-update-software.conf @@ -0,0 +1,12 @@ +# ec2-software-update - Update software at boot +# +# Update software at boot + +description "Update software at boot" + +start on (cloud-config + and local-filesystem + and net-device-iup IFACE=eth0) +console output + +exec /usr/sbin/ec2-update-software -- cgit v1.2.3