diff options
author | Scott Moser <smoser@nelson> | 2010-01-07 16:07:01 -0500 |
---|---|---|
committer | Scott Moser <smoser@nelson> | 2010-01-07 16:07:01 -0500 |
commit | 49d3df468a94fef41a036dfa5d886449d180e006 (patch) | |
tree | 45dccadb6bef5621eac2d692e893e6ff8aeccae8 /cloud-init-run-module.py | |
parent | 44e69ea67e75241dce3230f755c13ab602a5ea9b (diff) | |
download | vyos-cloud-init-49d3df468a94fef41a036dfa5d886449d180e006.tar.gz vyos-cloud-init-49d3df468a94fef41a036dfa5d886449d180e006.zip |
functional state now in kvm tests
supports user data as mime-multipart and handling types of
text/x-shellscript - execute at rc.local
text/cloud-config - feed to cloud config
text/upstart-job - add to /etc/init as upstart job
text/x-include-url - include urls as if they were in-line
Diffstat (limited to 'cloud-init-run-module.py')
-rwxr-xr-x | cloud-init-run-module.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cloud-init-run-module.py b/cloud-init-run-module.py index 0e32c63b..d2d4feee 100755 --- a/cloud-init-run-module.py +++ b/cloud-init-run-module.py @@ -16,7 +16,15 @@ def main(): (freq,semname,modname)=sys.argv[1:4] run_args=sys.argv[4:] - if ec2init.sem_has_run(semname,freq): + cloud = ec2init.EC2Init() + try: + cloud.get_data_source() + except Exception as e: + print e + sys.stderr.write("Failed to get instance data") + sys.exit(1) + + if cloud.sem_has_run(semname,freq): sys.stderr.write("%s already ran %s\n" % (semname,freq)) sys.exit(0) @@ -34,15 +42,7 @@ def main(): if os.environ.has_key(cfg_env_name): cfg_path = os.environ[cfg_env_name] - try: - if not ec2init.sem_acquire(semname,freq): - sys.stderr.write("Failed to acquire lock on %s\n" % semname) - sys.exit(1) - - inst.run(run_args,cfg_path) - except: - ec2init.sem_clear(semname,freq) - raise + cloud.sem_and_run(semname, freq, inst.run, [run_args,cfg_path], False) sys.exit(0) |