nova team mailing list archive
-
nova team
-
Mailing list archive
-
Message #00215
Re: using nova-manage to run code snippets from a file
Is this what you are looking for?
=== modified file 'bin/nova-manage'
--- bin/nova-manage 2010-09-13 07:06:32 +0000
+++ bin/nova-manage 2010-09-10 23:27:37 +0000
@@ -156,6 +156,11 @@
readline.parse_and_bind("tab:complete")
code.interact()
+ def script(self, filename):
+ """Runs the script in the specifed filename with flags set properly.
+ arguments: filename"""
+ exec(compile(open(filename).read(), filename, 'exec'), locals(), globals())
+
class RoleCommands(object):
"""Class for managing roles."""
On Sep 13, 2010, at 11:17 PM, Jesse Andrews wrote:
> Anyone know how to improve the new nova-manage shell run command to nicely run source from a file within a nova context. (similar to rail's script/runner command)
>
> ./nova-manage shell run (filename.py)
>
> would execute filename.py as if it was executed: python filename.py
>
> Simply importing nova does not correctly load flag files.
>
> Jesse
> _______________________________________________
> Mailing list: https://launchpad.net/~nova
> Post to : nova@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~nova
> More help : https://help.launchpad.net/ListHelp
References