diff options
author | Rene Mayrhofer <rene@mayrhofer.eu.org> | 2010-11-28 12:11:49 +0000 |
---|---|---|
committer | Rene Mayrhofer <rene@mayrhofer.eu.org> | 2010-11-28 12:11:49 +0000 |
commit | 7b8b352039efd78338a7bf451a0550644ec8a8da (patch) | |
tree | 62e0548df49dfb3ddacc8cac4309fa10f7b42610 /src/dumm/ext/lib | |
parent | 9587b8e553eda7b1b6fd48c77ebe4592e1e3532a (diff) | |
download | vyos-strongswan-7b8b352039efd78338a7bf451a0550644ec8a8da.tar.gz vyos-strongswan-7b8b352039efd78338a7bf451a0550644ec8a8da.zip |
New upstream version.
Diffstat (limited to 'src/dumm/ext/lib')
-rw-r--r-- | src/dumm/ext/lib/dumm.rb | 6 | ||||
-rw-r--r-- | src/dumm/ext/lib/dumm/guest.rb | 21 |
2 files changed, 12 insertions, 15 deletions
diff --git a/src/dumm/ext/lib/dumm.rb b/src/dumm/ext/lib/dumm.rb index 25939e9f4..bb60aad8f 100644 --- a/src/dumm/ext/lib/dumm.rb +++ b/src/dumm/ext/lib/dumm.rb @@ -1,5 +1,5 @@ =begin - Copyright (C) 2008 Tobias Brunner + Copyright (C) 2008-2009 Tobias Brunner Hochschule fuer Technik Rapperswil This program is free software; you can redistribute it and/or modify it @@ -38,11 +38,11 @@ module Dumm end end - # unload templates, reset all guests and delete bridges + # unload template/overlays, reset all guests and delete bridges def reset Template.unload Guest.each { |guest| - guest.reset if guest.running? + guest.reset } Bridge.each { |bridge| bridge.delete diff --git a/src/dumm/ext/lib/dumm/guest.rb b/src/dumm/ext/lib/dumm/guest.rb index 936f512dd..7488f1358 100644 --- a/src/dumm/ext/lib/dumm/guest.rb +++ b/src/dumm/ext/lib/dumm/guest.rb @@ -1,5 +1,5 @@ =begin - Copyright (C) 2008 Tobias Brunner + Copyright (C) 2008-2010 Tobias Brunner Hochschule fuer Technik Rapperswil This program is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ module Dumm end Guest[id] end - + # accessor for interfaces # e.g. guest.eth0 instead of guest["eth0"] def method_missing(id, *args) @@ -32,24 +32,21 @@ module Dumm end self[id] end - - # delete all interfaces + + # remove all overlays, delete all interfaces def reset + while pop_overlay; end each {|i| i.delete } end - + # has the guest booted up? def booted? - begin - exec("pgrep getty") - rescue - return false - end - return true + exec("pgrep getty") + execstatus == 0 end - + # wait until the guest has booted def boot while not booted? |