summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog8
-rwxr-xr-xdebian/rules2
-rwxr-xr-xec2-run-user-data.py8
3 files changed, 16 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index e87676e7..6b2006a9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ec2-init (0.3.1) jaunty; urgency=low
+
+ * debian/dir: Install /var/ec2 to save user-data scripts.
+ * debian/rules: Start ec2-init after ssh.
+ * ec2-run-user-data.py: Save run-user-data script with ami-id.
+
+ -- Chuck Short <zulcss@ubuntu.com> Mon, 26 Jan 2009 10:40:52 -0500
+
ec2-init (0.3) jaunty; urgency=low
* ec2-run-user-data: Fix python error when writing a file to the disk.
diff --git a/debian/rules b/debian/rules
index b3812f7e..f3f8d30f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,7 +2,7 @@
include /usr/share/cdbs/1/rules/debhelper.mk
-DEB_UPDATE_RCD_PARAMS:=start 90 S .
+DEB_UPDATE_RCD_PARAMS:= start 90 2 3 4 5 . stop 20 1 .
build/ec2-init::
install -d debian/tmp/usr/sbin
diff --git a/ec2-run-user-data.py b/ec2-run-user-data.py
index c41b9724..428c270e 100755
--- a/ec2-run-user-data.py
+++ b/ec2-run-user-data.py
@@ -35,7 +35,13 @@ def get_user_data():
fp.close()
return data
+def get_ami_id():
+ url = 'http://169.254.169.254/%s/meta-data', % api_ver
+ ami_id = urllib.urlopen('%s/ami-id/' %url).read()
+ return ami_id
+
user_data = get_user_data()
+amiId = get_ami_id()
if user_data.startswith('#!'):
# run it
@@ -43,7 +49,7 @@ if user_data.startswith('#!'):
os.write(fp,user_data)
os.close(fp);
os.chmod(path, 0700)
- os.system('cp %s /var/ec2/user-data.%s' %(path, strftime("%Y%m%d%H%I", gmtime())))
+ os.system('cp %s /var/ec2/user-data.%s' %(path, amiId))
status = os.system('%s' % path)
os.unlink(path)