~soren/ec2-init/0.5

« back to all changes in this revision

Viewing changes to ec2-init

  • Committer: Soren Hansen
  • Date: 2009-08-10 20:12:01 UTC
  • Revision ID: soren@canonical.com-20090810201201-bz996dhu1xqq0alw
run_once_per_ami() and run_once_per_instance() are equivalent, so nuke run_once_per_instance().

There are three cases:
You want to run the script every time. In that case, simply do not wrap it.

You want to rerun the script every time the AMI has been rebundled. Wrap it in run_once_per_ami.

You want to run the script only once, ever. Wrap it in run_once_ever.

If I'm missing a case, please tell me. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    return 1
35
35
}
36
36
 
37
 
run_once_per_instance() {
38
 
    action_id=$1
39
 
    instance=`ec2-get-info --instance-id | cut -f2 -d\ `
40
 
    run_once $instance $action_id
41
 
}
42
 
 
43
37
run_once_per_ami() {
44
38
    action_id=$1
45
39
    ami=`ec2-get-info --ami-id | cut -f2 -d\ `
116
110
            log_end_msg 1
117
111
        fi
118
112
 
119
 
        if run_once_per_instance user-data
 
113
        if run_once_per_ami user-data
120
114
        then
121
115
            log_daemon_msg "Running EC2 user data"
122
116
            if ec2-run-user-data 2>&1 | logger -t "user-data"