From 56563878d00a6dc0c0853e97087ac86e5e8df666 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Tue, 12 Jan 2010 16:40:46 -0500 Subject: add swap devices if there are any found --- ec2-init.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'ec2-init.py') diff --git a/ec2-init.py b/ec2-init.py index 8d6c0932..b483fd5d 100755 --- a/ec2-init.py +++ b/ec2-init.py @@ -43,7 +43,21 @@ def main(): warn("failed to set defaults\n") # set the ssh keys up - cloud.apply_credentials() + try: + cloud.sem_and_run("apply_credentials", "once-per-instance", + cloud.apply_credentials,[],False) + except: + warn("applying credentials failed!\n") + + # enable swap + try: + cloud.sem_and_run("enable_swap", "once-per-instance", + cloud.enable_swap,[],False) + except: + import traceback + traceback.print_exc(file=sys.stderr) + warn("enabling swap failed!\n") + # finish, send the cloud-config event cloud.initctl_emit() -- cgit v1.2.3