1
2 import sys
3
4 from starcluster import utils
5 from starcluster.logger import log
6
7 from base import CmdBase
8
9
11 """
12 shell
13
14 Load an interactive IPython shell configured for starcluster development
15
16 The following objects are automatically available at the prompt:
17
18 cfg - starcluster.config.StarClusterConfig instance
19 ec2 - starcluster.awsutils.EasyEC2 instance
20 s3 - starcluster.awsutils.EasyS3 instance
21
22 All starcluster modules are automatically imported in the IPython session
23 along with the boto and paramiko modules
24 """
25 names = ['shell', 'sh']
26
28 local_ns = dict(cfg=self.cfg, ec2=self.ec2, s3=self.s3, cm=self.cm)
29 import starcluster
30 local_ns.update(dict(starcluster=starcluster))
31 modules = [(starcluster.__name__ + '.' + i, i) \
32 for i in starcluster.__all__]
33 modules += [('boto', 'boto'), ('paramiko', 'paramiko'),
34 ('workerpool', 'workerpool'), ('jinja2', 'jinja2')]
35 for fullname, modname in modules:
36 log.info('Importing module %s' % modname)
37 try:
38 __import__(fullname)
39 local_ns[modname] = sys.modules[fullname]
40 except ImportError, e:
41 log.error("Error loading module %s: %s" % (modname, e))
42 utils.ipy_shell(local_ns=local_ns)
43