Author: justi9
Date: 2009-08-31 17:01:53 -0400 (Mon, 31 Aug 2009)
New Revision: 3607
Modified:
mgmt/trunk/mint/bin/mint-demo
mgmt/trunk/mint/python/mint/demo.py
Log:
* Python 2.4's -m module support is pretty crappy; use another means
to run the demo data code
* Add a 'load' target to mint-demo
Modified: mgmt/trunk/mint/bin/mint-demo
===================================================================
--- mgmt/trunk/mint/bin/mint-demo 2009-08-31 20:59:49 UTC (rev 3606)
+++ mgmt/trunk/mint/bin/mint-demo 2009-08-31 21:01:53 UTC (rev 3607)
@@ -8,20 +8,28 @@
}
}
+function load-data {
+ mint-admin add-user guest guest
+ mint-admin assign guest admin
+ python -c "from mint.demo import main; main()"
+}
+
case "$1" in
+ load)
+ check
+ load-data
+ ;;
reload)
check
mint-admin reload-schema --force || :
- mint-admin add-user guest guest
- mint-admin assign guest admin
- python -m mint.demo
+ load-data
;;
*)
echo "Utilities for mint demos"
echo "Usage: mint-demo COMMAND"
echo "Commands:"
- echo " reload Reload the schema and load a guest user"
- echo " and demo data"
+ echo " load Load a guest user and other demo data"
+ echo " reload First drop the schema and then load"
exit 1
;;
esac
Modified: mgmt/trunk/mint/python/mint/demo.py
===================================================================
--- mgmt/trunk/mint/python/mint/demo.py 2009-08-31 20:59:49 UTC (rev 3606)
+++ mgmt/trunk/mint/python/mint/demo.py 2009-08-31 21:01:53 UTC (rev 3607)
@@ -6,7 +6,7 @@
group = BrokerGroup(name=name)
group.syncUpdate()
-if __name__ == "__main__":
+def main():
config = MintConfig()
config.init()
@@ -16,3 +16,6 @@
data = DemoData()
data.load()
+
+if __name__ == "__main__":
+ main()