diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-05-13 10:00:20 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-05-13 10:00:20 +0000 |
commit | 3cb8c3a4c1c6853f51a3c5cad411673d42d8f6b8 (patch) | |
tree | 1c40cc932c088ec2c45236d84064518929c042e6 /morphlib/writeexts.py | |
parent | 9898c112dfced5bd5fe3a56aab64a7a0163ebe16 (diff) | |
parent | 1b2f2013bb85769352e82cfd55a3179fe16ccce2 (diff) | |
download | morph-3cb8c3a4c1c6853f51a3c5cad411673d42d8f6b8.tar.gz |
Merge branch 'baserock/richardmaw/kvm-write-allow-autostart' of git://git.baserock.org/baserock/baserock/morph
Reviewed-by: Jonathan Maw on IRC.
Diffstat (limited to 'morphlib/writeexts.py')
-rwxr-xr-x | morphlib/writeexts.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/morphlib/writeexts.py b/morphlib/writeexts.py index 48847d56..aea08085 100755 --- a/morphlib/writeexts.py +++ b/morphlib/writeexts.py @@ -251,3 +251,15 @@ class WriteExtension(cliapp.Application): value = 'no' return value == 'yes' + + def parse_autostart(self): + '''Parse $AUTOSTART to determine if VMs should be started.''' + + autostart = os.environ.get('AUTOSTART', 'no') + if autostart == 'no': + return False + elif autostart == 'yes': + return True + else: + raise cliapp.AppException('Unexpected value for AUTOSTART: %s' % + autostart) |