~cloud-init-dev/cloud-init/trunk

« back to all changes in this revision

Viewing changes to cloud-init-run-module.py

  • Committer: Scott Moser
  • Date: 2010-02-03 23:09:48 UTC
  • Revision ID: smoser@ubuntu.com-20100203230948-hkm26maudqkiw7xw
globally remove ec2init and rename to cloudinit

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
3
import sys
4
 
import ec2init
 
4
import cloudinit
5
5
 
6
6
def Usage(out = sys.stdout):
7
7
    out.write("Usage: cloud-init-run-module freq sem-name mod-name [args]\n")
16
16
    (freq,semname,modname)=sys.argv[1:4]
17
17
    run_args=sys.argv[4:]
18
18
 
19
 
    cloud = ec2init.EC2Init()
 
19
    cloud = cloudinit.EC2Init()
20
20
    try:
21
21
        cloud.get_data_source()
22
22
    except Exception as e:
29
29
        sys.exit(0)
30
30
 
31
31
    try:
32
 
        mod = __import__('ec2init.' + modname)
 
32
        mod = __import__('cloudinit.' + modname)
33
33
        inst = getattr(mod,modname)
34
34
    except:
35
 
        sys.stderr.write("Failed to load module ec2init.%s\n" % modname)
 
35
        sys.stderr.write("Failed to load module cloudinit.%s\n" % modname)
36
36
        sys.exit(1)
37
37
 
38
38
    import os
39
39
 
40
40
    cfg_path = None
41
 
    cfg_env_name = ec2init.cfg_env_name
 
41
    cfg_env_name = cloudinit.cfg_env_name
42
42
    if os.environ.has_key(cfg_env_name):
43
43
        cfg_path = os.environ[cfg_env_name]
44
44