rhmessaging commits: r3607 - in mgmt/trunk/mint: python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
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()
15 years, 3 months
rhmessaging commits: r3606 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-31 16:59:49 -0400 (Mon, 31 Aug 2009)
New Revision: 3606
Removed:
mgmt/trunk/cumin/python/cumin/demo.py
Log:
This file is no longer used
Deleted: mgmt/trunk/cumin/python/cumin/demo.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/demo.py 2009-08-31 20:29:56 UTC (rev 3605)
+++ mgmt/trunk/cumin/python/cumin/demo.py 2009-08-31 20:59:49 UTC (rev 3606)
@@ -1,144 +0,0 @@
-from time import sleep
-from threading import Thread
-from random import sample, random, randint
-
-#from model import *
-from mint import *
-
-def fmt(str_, int_):
- return "%s%02i" % (str_, int_)
-
-class DemoData(object):
- def __init__(self, mult=5):
- self.mult = mult
-
- def load(self):
- groups = dict()
-
- for name in ("West Coast", "East Coast", "Marketing", "Sales"):
- group = BrokerGroup(name=name)
- groups[name] = group
-
- CollectorRegistration(name="main", collectorId="main")
-
- def load_props(self, obj):
- prop = ConfigProperty()
- prop.name = "max_threads"
- prop.value = 1000
- prop.broker_value = 1000
- prop.type = "integer"
- obj.add_config_property(prop)
-
- prop = ConfigProperty()
- prop.name = "max_memory"
- prop.value = 1000000
- prop.broker_value = 2000000
- prop.type = "integer"
- obj.add_config_property(prop)
-
- prop = ConfigProperty()
- prop.name = "ssl_enabled"
- prop.value = True
- prop.broker_value = True
- prop.type = "boolean"
- obj.add_config_property(prop)
-
- def start_updates(self):
- raise Exception()
-
- thread = UpdateThread(self.model)
- thread.start()
-
-class UpdateThread(Thread):
- def __init__(self, model):
- super(UpdateThread, self).__init__()
-
- self.model = model
- self.setDaemon(True)
-
- def frob(self, mobject):
- mobject.lock()
- try:
- if isinstance(mobject, DummyModelObject):
- for measure in mobject.measurements:
- self.frob_measure(measure)
-
- if hasattr(mobject, "errors"):
- self.frob_errors(mobject.errors)
-
- if hasattr(mobject, "warnings"):
- self.frob_errors(mobject.warnings)
- finally:
- mobject.unlock()
-
- def frob_measure(self, measure):
- if measure.type == "int":
- if random() < 0.5:
- if random() < 0.66:
- value = measure.get_value()
- measure.add_value(value + randint(4, 12))
- else:
- value = measure.get_value() - randint(3, 9)
- measure.add_value(value > 0 and value or 0)
- else:
- measure.add_value(measure.get_value())
-
- def frob_errors(self, errors):
- if random() < 0.005:
- errors.append(object())
-
- if random() < 0.02 and len(errors):
- del errors[0]
-
-
- def run(self):
- while True:
- sleep(1)
-
- for broker in self.model.get_brokers():
- self.frob(broker)
-
- for vhost in broker.virtual_host_items():
- self.frob(vhost)
-
- for exchange in vhost.exchange_items():
- self.frob(exchange)
-
- for binding in exchange.binding_items():
- self.frob(binding)
-
- for producer in exchange.producer_items():
- self.frob(producer)
-
- for queue in vhost.queue_items():
- self.frob(queue)
-
- for consumer in queue.consumer_items():
- self.frob(consumer)
-
- for conn in vhost.conn_items():
- self.frob(conn)
-
- for session in conn.session_items():
- self.frob(session)
-
-if __name__ == "__main__":
- import sys
-
- try:
- connuri = sys.argv[1]
- conn = connectionForURI(connuri)
- sqlhub.processConnection = conn
- except IndexError:
- print "Usage: demo.py DATABASE-URI"
- sys.exit(1)
-
- data = DemoData()
- data.load()
-
- #sys.stdout.write("<?xml version=\"1.0\"?><model>")
-
- #for broker in model.get_brokers():
- # broker.write_xml(sys.stdout)
-
- #sys.stdout.write("</model>")
15 years, 3 months
rhmessaging commits: r3605 - mgmt/trunk/mint/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-31 16:29:56 -0400 (Mon, 31 Aug 2009)
New Revision: 3605
Modified:
mgmt/trunk/mint/bin/mint-database
Log:
Don't ignore failed db commands
Modified: mgmt/trunk/mint/bin/mint-database
===================================================================
--- mgmt/trunk/mint/bin/mint-database 2009-08-31 20:17:35 UTC (rev 3604)
+++ mgmt/trunk/mint/bin/mint-database 2009-08-31 20:29:56 UTC (rev 3605)
@@ -41,15 +41,15 @@
;;
create)
check-basics
- su - postgres -c "createuser --superuser cumin || :"
- su - postgres -c "createdb --owner=cumin cumin || :"
+ su - postgres -c "createuser --superuser cumin"
+ su - postgres -c "createdb --owner=cumin cumin"
mint-admin load-schema
echo "The database is created"
;;
destroy)
check-basics
- su - postgres -c "dropdb cumin || :"
- su - postgres -c "dropuser cumin || :"
+ su - postgres -c "dropdb cumin"
+ su - postgres -c "dropuser cumin"
echo "The database is destroyed"
;;
*)
15 years, 3 months
rhmessaging commits: r3604 - mgmt/trunk/mint/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-31 16:17:35 -0400 (Mon, 31 Aug 2009)
New Revision: 3604
Modified:
mgmt/trunk/mint/bin/mint-database
Log:
Also load the schema on mint-database create
Modified: mgmt/trunk/mint/bin/mint-database
===================================================================
--- mgmt/trunk/mint/bin/mint-database 2009-08-31 19:48:45 UTC (rev 3603)
+++ mgmt/trunk/mint/bin/mint-database 2009-08-31 20:17:35 UTC (rev 3604)
@@ -43,6 +43,7 @@
check-basics
su - postgres -c "createuser --superuser cumin || :"
su - postgres -c "createdb --owner=cumin cumin || :"
+ mint-admin load-schema
echo "The database is created"
;;
destroy)
15 years, 3 months
rhmessaging commits: r3603 - mgmt/trunk/cumin/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-31 15:48:45 -0400 (Mon, 31 Aug 2009)
New Revision: 3603
Removed:
mgmt/trunk/cumin/bin/cumin-admin
mgmt/trunk/cumin/bin/cumin-admin-test
Modified:
mgmt/trunk/cumin/bin/cumin-database-destroy
mgmt/trunk/cumin/bin/cumin-database-init
Log:
Delete obsolote wrappers; convert cumin-database-* to simple wrappers around mint-database, with a deprecation warning
Deleted: mgmt/trunk/cumin/bin/cumin-admin
===================================================================
--- mgmt/trunk/cumin/bin/cumin-admin 2009-08-31 19:23:48 UTC (rev 3602)
+++ mgmt/trunk/cumin/bin/cumin-admin 2009-08-31 19:48:45 UTC (rev 3603)
@@ -1,12 +0,0 @@
-#!/usr/bin/python
-
-import sys, os
-
-from cumin.tools import CuminAdminTool
-
-if __name__ == "__main__":
- try:
- tool = CuminAdminTool("cumin-admin")
- tool.main()
- except KeyboardInterrupt:
- pass
Deleted: mgmt/trunk/cumin/bin/cumin-admin-test
===================================================================
--- mgmt/trunk/cumin/bin/cumin-admin-test 2009-08-31 19:23:48 UTC (rev 3602)
+++ mgmt/trunk/cumin/bin/cumin-admin-test 2009-08-31 19:48:45 UTC (rev 3603)
@@ -1,35 +0,0 @@
-#!/bin/bash
-
-id="$RANDOM"
-code=0
-tmpdir=$(mktemp -d)
-trap "rm -rf ${tmpdir}" EXIT
-
-while read command; do
- echo -n "Testing command '$command'..."
-
- $command &> "${tmpdir}/output"
-
- if [[ $? == 0 ]]; then
- echo " OK"
- else
- echo
- echo "Command failed with exit code $?"
- echo "Output:"
- cat "${tmpdir}/output"
- code=1
- fi
-done <<EOF
-cumin-admin --help
-cumin-admin add-user "$id" changeme
-cumin-admin assign "$id" admin
-cumin-admin unassign "$id" admin
-cumin-admin list-users
-cumin-admin remove-user "$id" --force
-cumin-admin add-qmf-server "$id" "$id"
-cumin-admin list-qmf-servers
-cumin-admin remove-qmf-server "$id"
-cumin-admin list-roles
-EOF
-
-exit "$code"
Modified: mgmt/trunk/cumin/bin/cumin-database-destroy
===================================================================
--- mgmt/trunk/cumin/bin/cumin-database-destroy 2009-08-31 19:23:48 UTC (rev 3602)
+++ mgmt/trunk/cumin/bin/cumin-database-destroy 2009-08-31 19:48:45 UTC (rev 3603)
@@ -1,12 +1,6 @@
#!/bin/bash -e
-# This script assumes that postgresql is configured and running
+echo "Warning: this command is deprecated; it has been replaced by"
+echo "the command 'mint-database destroy'"
-if [[ "$EUID" != "0" ]]; then
- echo "This script must be run as root"
- exit 2
-fi
-
-su - postgres -c "psql -c '\q'"
-su - postgres -c "dropdb cumin 2> /dev/null || :"
-su - postgres -c "dropuser cumin 2> /dev/null || :"
+exec mint-database destroy
Modified: mgmt/trunk/cumin/bin/cumin-database-init
===================================================================
--- mgmt/trunk/cumin/bin/cumin-database-init 2009-08-31 19:23:48 UTC (rev 3602)
+++ mgmt/trunk/cumin/bin/cumin-database-init 2009-08-31 19:48:45 UTC (rev 3603)
@@ -1,16 +1,6 @@
#!/bin/bash -e
-# This script assumes that postgresql is configured and running
+echo "Warning: this command is deprecated; it has been replaced by"
+echo "the command 'mint-database create'"
-if [[ "$EUID" != "0" ]]; then
- echo "This script must be run as root"
- exit 1
-fi
-
-su - postgres -c "psql -c '\q'"
-su - postgres -c "createuser --superuser cumin 2> /dev/null || :"
-su - postgres -c "createdb --owner=cumin cumin 2> /dev/null || :"
-
-cumin-admin check-schema | grep -e '^OK ' || {
- cumin-admin create-schema
-}
+exec mint-database create
15 years, 3 months
rhmessaging commits: r3602 - in mgmt/trunk: cumin/bin and 4 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-31 15:23:48 -0400 (Mon, 31 Aug 2009)
New Revision: 3602
Added:
mgmt/trunk/mint/bin/mint-admin
mgmt/trunk/mint/bin/mint-admin-test
mgmt/trunk/mint/bin/mint-demo
mgmt/trunk/mint/python/mint/demo.py
Removed:
mgmt/trunk/cumin/bin/cumin-load-demo-data
Modified:
mgmt/trunk/bin/reschema
mgmt/trunk/cumin/python/cumin/tools.py
mgmt/trunk/mint/python/mint/database.py
mgmt/trunk/mint/python/mint/tools.py
mgmt/trunk/mint/python/mint/util.py
mgmt/trunk/parsley/python/parsley/command.py
Log:
* Move data model admin functions from cumin to mint
* Make CommandException compatible with newer pythons
* Complain, but don't fail, if we try to drop an already dropped
schema
* On mint-admin (was cumin-admin) rename create-schema to
load-schema, and introduce reload-schema as a convenience
* Introduce a command mint-demo for demo-oriented utility subcommands
* Make the sql file selection internal to loadSchema; it should know
where they are
Modified: mgmt/trunk/bin/reschema
===================================================================
--- mgmt/trunk/bin/reschema 2009-08-31 17:13:12 UTC (rev 3601)
+++ mgmt/trunk/bin/reschema 2009-08-31 19:23:48 UTC (rev 3602)
@@ -1,7 +1,3 @@
#!/bin/bash -ex
-cumin-admin drop-schema --force || :
-cumin-admin create-schema
-cumin-admin add-user guest guest
-cumin-admin assign guest admin
-cumin-load-demo-data
+exec mint-demo reload
Deleted: mgmt/trunk/cumin/bin/cumin-load-demo-data
===================================================================
--- mgmt/trunk/cumin/bin/cumin-load-demo-data 2009-08-31 17:13:12 UTC (rev 3601)
+++ mgmt/trunk/cumin/bin/cumin-load-demo-data 2009-08-31 19:23:48 UTC (rev 3602)
@@ -1,42 +0,0 @@
-#!/usr/bin/python
-
-import sys, os
-from sqlobject import connectionForURI
-from traceback import print_exc
-from getpass import getpass
-from random import sample
-from crypt import crypt
-from mint import MintDatabase
-from psycopg2 import IntegrityError
-
-from cumin import *
-from cumin.util import *
-from cumin.demo import *
-
-def main():
- config = CuminConfig()
-
- if "-h" in sys.argv or "--help" in sys.argv:
- config.print_usage("cumin-load-demo-data")
- sys.exit(0)
-
- config.init()
-
- if config.debug:
- config.prt()
-
- cumin = Cumin(config)
- cumin.check()
- cumin.init()
-
- data = DemoData()
- data.load()
-
-if __name__ == "__main__":
- try:
- main()
- except SystemExit, e:
- raise e
- except:
- print_exc()
- sys.exit(1)
Modified: mgmt/trunk/cumin/python/cumin/tools.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/tools.py 2009-08-31 17:13:12 UTC (rev 3601)
+++ mgmt/trunk/cumin/python/cumin/tools.py 2009-08-31 19:23:48 UTC (rev 3602)
@@ -3,11 +3,6 @@
from parsley.config import *
from parsley.command import *
from wooly.devel import *
-from mint import *
-from mint.tools import MintServerTool
-from getpass import getpass
-from psycopg2 import IntegrityError
-from subprocess import Popen
from time import sleep
from util import *
@@ -16,20 +11,6 @@
from cumin.server import CuminServer
from test import *
-def prompt_password():
- password = None
-
- while password is None:
- once = getpass("Enter new password: ")
- twice = getpass("Confirm new password: ")
-
- if once == twice:
- password = once
- else:
- print "Passwords don't match; try again"
-
- return password
-
class BaseCuminTool(Command):
def __init__(self, name):
super(BaseCuminTool, self).__init__(None, name)
@@ -69,19 +50,19 @@
if os.getuid() == 0:
os.setuid(os.stat(__file__).st_uid)
- self.config.init()
-
try:
import psyco
psyco.full()
except ImportError:
pass
+ self.config.init()
+
def run(self):
try:
opts, args = self.parse(sys.argv)
except CommandException, e:
- print "Error: %s" % e.message
+ print "Error: %s" % e
e.command.print_help()
sys.exit(1)
@@ -89,6 +70,11 @@
self.print_help()
sys.exit(0)
+ self.config.load_dict(opts)
+
+ if self.config.debug:
+ self.config.prt()
+
self.do_run(opts, args)
def do_run(self, opts, args):
@@ -99,365 +85,6 @@
self.init()
self.run()
-class CuminAdminTool(BaseCuminTool):
- def __init__(self, name):
- super(CuminAdminTool, self).__init__(name)
-
- self.description = "Cumin administration commands"
- self.database = None # Set in init
-
- command = self.CreateSchema(self, "create-schema")
- command.description = "Create the database schema"
-
- command = self.DropSchema(self, "drop-schema")
- command.description = "Drop the database schema; requires --force"
-
- opt = CommandOption(command, "force")
- opt.description = "Don't complain and just do it"
-
- command = self.AddQmfServer(self, "add-qmf-server")
- command.arguments = ("NAME", "URL")
- command.description = "Add a new QMF server called NAME at URL"
-
- command = self.RemoveQmfServer(self, "remove-qmf-server")
- command.arguments = ("URL",)
- command.description = "Remove QMF server called NAME; requires --force"
-
- opt = CommandOption(command, "force")
- opt.description = "Don't complain and just do it"
-
- command = self.ListQmfServers(self, "list-qmf-servers")
- command.description = "List existing QMF servers"
-
- command = self.AddUser(self, "add-user")
- command.arguments = ("NAME", "[PASSWORD]")
- command.description = "Add a new user called NAME"
-
- command = self.RemoveUser(self, "remove-user")
- command.arguments = ("NAME",)
- command.description = "Remove user called NAME; requires --force"
-
- opt = CommandOption(command, "force")
- opt.description = "Don't complain and just do it"
-
- command = self.ListUsers(self, "list-users")
- command.description = "List existing users"
-
- command = self.ListRoles(self, "list-roles")
- command.description = "List existing roles"
-
- command = self.Assign(self, "assign")
- command.description = "Add USER to ROLE"
- command.arguments = ("USER", "ROLE")
-
- command = self.Unassign(self, "unassign")
- command.description = "Remove USER from ROLE"
- command.arguments = ("USER", "ROLE")
-
- command = self.ChangePassword(self, "change-password")
- command.description = "Change password of USER"
- command.arguments = ("USER",)
-
- def init(self):
- super(CuminAdminTool, self).init()
-
- config = MintConfig()
- config.init({"data": self.config.data})
-
- app = Mint(config)
- app.updateEnabled = False
- app.pollEnabled = False
- app.expireEnabled = False
-
- self.database = MintDatabase(app)
- self.database.check()
- self.database.init()
-
- def run(self):
- if self.config.debug:
- self.config.prt()
-
- try:
- opts, remaining = self.parse_options(sys.argv[1:])
- except CommandException, e:
- print "Error: %s" % e.message
- e.command.print_help()
- sys.exit(1)
-
- if "help" in opts:
- self.print_help()
- return
-
- try:
- scommand = remaining[0]
- except IndexError:
- self.print_help()
- sys.exit(1)
-
- try:
- command = self.commands_by_name[scommand]
- except KeyError:
- print "Error: Command '%s' is unrecognized" % scommand
- self.print_help()
- sys.exit(1)
-
- try:
- opts, args = command.parse(remaining)
- except CommandException, e:
- print "Error: %s" % e.message
- e.command.print_help()
- sys.exit(1)
-
- if "help" in opts:
- command.print_help()
- return
-
- try:
- command.run(opts, args)
- except CommandException, e:
- print "Error: %s" % e.message
- e.command.print_help()
- sys.exit(1)
-
- class CreateSchema(Command):
- def run(self, opts, args):
- main = os.path.join(self.parent.config.home, "sql", "schema.sql")
- indexes = os.path.join(self.parent.config.home, "sql", "indexes.sql")
- triggers = os.path.join(self.parent.config.home, "sql", "triggers.sql")
-
- self.parent.database.createSchema((main, indexes, triggers))
-
- class DropSchema(Command):
- def run(self, opts, args):
- if "force" in opts:
- self.parent.database.dropSchema()
- print "The schema is dropped"
- else:
- raise CommandException \
- (self, "Command create-schema requires --force")
-
- class CheckSchema(Command):
- def run(self, opts, args):
- self.parent.database.checkSchema()
-
- class AddQmfServer(Command):
- def run(self, opts, args):
- try:
- name, url = args[1:]
- except IndexError:
- raise CommandException(self, "NAME and URL are required")
- except ValueError:
- raise CommandException(self, "NAME and URL are required")
-
- for reg in BrokerRegistration.selectBy(name=name):
- print "Error: a broker called '%s' already exists" % name
- sys.exit(1)
-
- for reg in BrokerRegistration.selectBy(url=url):
- print "Error: a broker at %s already exists" % url
- sys.exit(1)
-
- url = url.strip()
-
- expr = re.compile("^amqps?://")
-
- if not expr.match(url):
- url = "amqp://%s" % url
-
- expr = re.compile(":[0-9]+$")
-
- if not expr.match(url):
- url = "%s:5672" % url
-
- reg = BrokerRegistration(name=name, url=url)
- reg.syncUpdate()
-
- class RemoveQmfServer(Command):
- def run(self, opts, args):
- try:
- name = args[1]
- except IndexError:
- raise CommandException(self, "NAME is required")
-
- for reg in BrokerRegistration.selectBy(name=name):
- break
-
- if reg:
- reg.destroySelf()
- reg.syncUpdate()
- else:
- raise CommandException \
- (self, "Broker '%s' is unknown", reg.name)
-
- class ListQmfServers(Command):
- def run(self, opts, args):
- regs = BrokerRegistration.select()
-
- print " ID Name URL"
- print "---- -------------------- ---------------------------------"
-
- for reg in regs:
- print "%4i %-20s %-20s" % (reg.id, reg.name, reg.url)
-
- count = regs.count()
-
- print "(%i server%s found)" % (count, ess(count))
-
- class AddUser(Command):
- def run(self, opts, args):
- try:
- name = args[1]
- except IndexError:
- raise CommandException(self, "NAME is required")
-
- if Subject.selectBy(name=name).count():
- print "Error: a user called '%s' already exists" % name
- sys.exit(1)
-
- try:
- password = args[2]
- except IndexError:
- password = prompt_password()
-
- crypted = crypt_password(password)
-
- try:
- subject = Subject(name=name, password=crypted)
-
- for role in Role.selectBy(name="user"):
- subject.addRole(role)
- break
-
- assert role
-
- subject.syncUpdate()
- except IntegrityError:
- print "Error: a user called '%s' already exists" % name
- sys.exit(1)
-
- print "User '%s' is added" % name
-
- class RemoveUser(Command):
- def run(self, opts, args):
- if "force" in opts:
- if len(args) != 2:
- print "Error: no user name given"
- sys.exit(1)
-
- name = args[1]
- subjects = Subject.selectBy(name=name)
-
- if subjects.count():
- for subject in subjects:
- subject.destroySelf()
- break
- else:
- raise CommandException(self, "User '%s' is unknown" % name)
-
- print "User '%s' is removed" % name
- else:
- raise CommandException \
- (self, "Command remove-user requires --force yes")
-
- class ListUsers(Command):
- def run(self, opts, args):
- subjects = Subject.select(orderBy='name')
-
- print " ID Name Roles"
- print "---- -------------------- --------------------"
-
- for subject in subjects:
- roles = ", ".join([x.name for x in list(subject.roles)])
-
- print "%4i %-20s %-20s" % (subject.id, subject.name, roles)
-
- count = subjects.count()
- print "(%i user%s found)" % (count, ess(count))
-
- class ListRoles(Command):
- def run(self, opts, args):
- roles = Role.select(orderBy='name')
-
- print " ID Name"
- print "---- --------------------"
-
- for role in roles:
- print "%4i %s" % (role.id, role.name)
-
- count = roles.count()
- print "(%i role%s found)" % (count, ess(count))
-
- class Assign(Command):
- def run(self, opts, args):
- if len(args) != 3:
- raise CommandException(self, "USER and ROLE are required")
-
- subject = Subject.getByName(args[1])
-
- if not subject:
- raise CommandException \
- (self, "User '%s' is unknown" % subject.name)
-
- role = Role.getByName(args[2])
-
- if not role:
- raise CommandException \
- (self, "Role '%s' is unknown" % role.name)
-
- try:
- subject.addRole(role)
- subject.syncUpdate()
-
- print "User '%s' is added to role '%s'" % \
- (subject.name, role.name)
- except IntegrityError:
- msg = "User '%s' is already assigned to role '%s'" % \
- (subject.name, role.name)
- raise CommandException(self, msg)
-
- class Unassign(Command):
- def run(self, opts, args):
- if len(args) != 3:
- raise CommandException(self, "USER and ROLE are required")
-
- subject = Subject.getByName(args[1])
-
- if not subject:
- raise CommandException \
- (self, "User '%s' is unknown" % subject.name)
-
- role = Role.getByName(args[2])
-
- if not role:
- raise CommandException \
- (self, "Role '%s' is unknown" % role.name)
-
- subject.removeRole(role)
- subject.syncUpdate()
-
- print "User '%s' is removed from role '%s'" % \
- (subject.name, role.name)
-
- class ChangePassword(Command):
- def run(self, opts, args):
- try:
- ssubject = args[1]
- except IndexError:
- raise CommandException(self, "USER is required")
-
- subject = Subject.getByName(ssubject)
-
- if not subject:
- raise CommandException\
- (self, "User '%s' is unknown" % subject.name)
-
- crypted = crypt_password(prompt_password())
-
- subject.password = crypted
- subject.syncUpdate()
-
- print "Password of user '%s' is changed" % subject.name
-
class CuminServerTool(BaseCuminTool):
def __init__(self, name):
super(CuminServerTool, self).__init__(name)
@@ -485,13 +112,6 @@
opt.description = "Serve web pages using SSL"
def do_run(self, opts, args):
- self.config.load_dict(opts)
-
- self.config.ssl = "ssl" in opts
-
- if self.config.debug:
- self.config.prt()
-
app = Cumin(self.config)
try:
@@ -541,18 +161,12 @@
opt.description = "Use existing broker at ADDR"
def do_run(self, opts, args):
- self.config.load_dict(opts)
-
- if self.config.debug:
- self.config.prt()
-
app = Cumin(self.config)
try:
app.check()
except Exception, e:
- if hasattr(e, "message"):
- print e.message
+ print e
sys.exit(1)
@@ -598,18 +212,12 @@
opt.description = "Check that page output is well-formed xml"
def do_run(self, opts, args):
- self.config.load_dict(opts)
-
- if self.config.debug:
- self.config.prt()
-
app = Cumin(self.config)
try:
app.check()
except Exception, e:
- if hasattr(e, "message"):
- print e.message
+ print e
sys.exit(1)
Added: mgmt/trunk/mint/bin/mint-admin
===================================================================
--- mgmt/trunk/mint/bin/mint-admin (rev 0)
+++ mgmt/trunk/mint/bin/mint-admin 2009-08-31 19:23:48 UTC (rev 3602)
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+
+from mint.tools import MintAdminTool
+
+if __name__ == "__main__":
+ try:
+ tool = MintAdminTool("mint-admin")
+ tool.main()
+ except KeyboardInterrupt:
+ pass
Property changes on: mgmt/trunk/mint/bin/mint-admin
___________________________________________________________________
Name: svn:executable
+ *
Added: mgmt/trunk/mint/bin/mint-admin-test
===================================================================
--- mgmt/trunk/mint/bin/mint-admin-test (rev 0)
+++ mgmt/trunk/mint/bin/mint-admin-test 2009-08-31 19:23:48 UTC (rev 3602)
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+id="$RANDOM"
+code=0
+tmpdir=$(mktemp -d)
+trap "rm -rf ${tmpdir}" EXIT
+
+while read command; do
+ echo -n "Testing command '$command'..."
+
+ $command &> "${tmpdir}/output"
+
+ if [[ $? == 0 ]]; then
+ echo " OK"
+ else
+ echo
+ echo "Command failed with exit code $?"
+ echo "Output:"
+ cat "${tmpdir}/output"
+ code=1
+ fi
+done <<EOF
+mint-admin --help
+mint-admin add-user "$id" changeme
+mint-admin assign "$id" admin
+mint-admin unassign "$id" admin
+mint-admin list-users
+mint-admin remove-user "$id" --force
+mint-admin list-roles
+EOF
+
+exit "$code"
Property changes on: mgmt/trunk/mint/bin/mint-admin-test
___________________________________________________________________
Name: svn:executable
+ *
Added: mgmt/trunk/mint/bin/mint-demo
===================================================================
--- mgmt/trunk/mint/bin/mint-demo (rev 0)
+++ mgmt/trunk/mint/bin/mint-demo 2009-08-31 19:23:48 UTC (rev 3602)
@@ -0,0 +1,27 @@
+#!/bin/bash -e
+
+function check {
+ which psql > /dev/null
+ psql -d cumin -U cumin -h localhost -c '\q' || {
+ echo "The database is not ready; use mint-database to prepare it"
+ exit 1
+ }
+}
+
+case "$1" in
+ reload)
+ check
+ mint-admin reload-schema --force || :
+ mint-admin add-user guest guest
+ mint-admin assign guest admin
+ python -m mint.demo
+ ;;
+ *)
+ 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"
+ exit 1
+ ;;
+esac
Property changes on: mgmt/trunk/mint/bin/mint-demo
___________________________________________________________________
Name: svn:executable
+ *
Modified: mgmt/trunk/mint/python/mint/database.py
===================================================================
--- mgmt/trunk/mint/python/mint/database.py 2009-08-31 17:13:12 UTC (rev 3601)
+++ mgmt/trunk/mint/python/mint/database.py 2009-08-31 19:23:48 UTC (rev 3602)
@@ -1,3 +1,7 @@
+import logging
+import os.path
+
+from psycopg2 import ProgrammingError
from sqlobject import connectionForURI, sqlhub
from model import MintInfo, Role
@@ -2,2 +6,4 @@
+log = logging.getLogger("mint.database")
+
class MintDatabase(object):
@@ -33,7 +39,10 @@
try:
cursor = conn.cursor()
- cursor.execute("drop schema public cascade")
+ try:
+ cursor.execute("drop schema public cascade")
+ except ProgrammingError:
+ log.warn("The schema is already dropped")
conn.commit()
finally:
@@ -68,18 +77,25 @@
result.append(tmpStmt.lstrip())
return result
- def createSchema(self, file_paths):
- conn = self.getConnection()
+ def loadSchema(self):
+ paths = list()
+ paths.append(os.path.join(self.app.config.home, "sql", "schema.sql"))
+ paths.append(os.path.join(self.app.config.home, "sql", "indexes.sql"))
+ paths.append(os.path.join(self.app.config.home, "sql", "triggers.sql"))
+
scripts = list()
- for path in file_paths:
+ for path in paths:
file = open(path, "r")
+
try:
scripts.append((path, file.read()))
finally:
file.close()
+ conn = self.getConnection()
+
try:
cursor = conn.cursor()
Added: mgmt/trunk/mint/python/mint/demo.py
===================================================================
--- mgmt/trunk/mint/python/mint/demo.py (rev 0)
+++ mgmt/trunk/mint/python/mint/demo.py 2009-08-31 19:23:48 UTC (rev 3602)
@@ -0,0 +1,18 @@
+from mint import *
+
+class DemoData(object):
+ def load(self):
+ for name in ("Engineering", "Marketing", "Sales"):
+ group = BrokerGroup(name=name)
+ group.syncUpdate()
+
+if __name__ == "__main__":
+ config = MintConfig()
+ config.init()
+
+ app = Mint(config)
+ app.check()
+ app.init()
+
+ data = DemoData()
+ data.load()
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2009-08-31 17:13:12 UTC (rev 3601)
+++ mgmt/trunk/mint/python/mint/tools.py 2009-08-31 19:23:48 UTC (rev 3602)
@@ -54,11 +54,13 @@
except ImportError:
pass
+ self.config.init()
+
def run(self):
try:
opts, args = self.parse(sys.argv)
except CommandException, e:
- print "Error: %s" % e.message
+ print "Error: %s" % e
e.command.print_help()
sys.exit(1)
@@ -66,8 +68,11 @@
self.print_help()
sys.exit(0)
- self.config.init(opts)
+ self.config.load_dict(opts)
+ if self.config.debug:
+ self.config.prt()
+
self.do_run(opts, args)
def do_run(self, opts, args):
@@ -78,6 +83,298 @@
self.init()
self.run()
+class MintAdminTool(BaseMintTool):
+ def __init__(self, name):
+ super(MintAdminTool, self).__init__(name)
+
+ self.description = "Mint administration commands"
+ self.database = None # Set in init
+
+ command = self.LoadSchema(self, "load-schema")
+ command.description = "Load the database schema"
+
+ command = self.DropSchema(self, "drop-schema")
+ command.description = "Drop the database schema; requires --force"
+
+ opt = CommandOption(command, "force")
+ opt.description = "Don't complain and just do it"
+
+ command = self.ReloadSchema(self, "reload-schema")
+ command.description = "Drop and reload the database schema; " + \
+ "requires --force"
+
+ opt = CommandOption(command, "force")
+ opt.description = "Don't complain and just do it"
+
+ command = self.AddUser(self, "add-user")
+ command.arguments = ("NAME", "[PASSWORD]")
+ command.description = "Add a new user called NAME"
+
+ command = self.RemoveUser(self, "remove-user")
+ command.arguments = ("NAME",)
+ command.description = "Remove user called NAME; requires --force"
+
+ opt = CommandOption(command, "force")
+ opt.description = "Don't complain and just do it"
+
+ command = self.ListUsers(self, "list-users")
+ command.description = "List existing users"
+
+ command = self.ListRoles(self, "list-roles")
+ command.description = "List existing roles"
+
+ command = self.Assign(self, "assign")
+ command.description = "Add USER to ROLE"
+ command.arguments = ("USER", "ROLE")
+
+ command = self.Unassign(self, "unassign")
+ command.description = "Remove USER from ROLE"
+ command.arguments = ("USER", "ROLE")
+
+ command = self.ChangePassword(self, "change-password")
+ command.description = "Change password of USER"
+ command.arguments = ("USER",)
+
+ def run(self):
+ try:
+ opts, remaining = self.parse_options(sys.argv[1:])
+ except CommandException, e:
+ print "Error: %s" % e
+ e.command.print_help()
+ sys.exit(1)
+
+ if "help" in opts:
+ self.print_help()
+ return
+
+ self.config.load_dict(opts)
+
+ if self.config.debug:
+ self.config.prt()
+
+ app = Mint(self.config)
+ app.updateEnabled = False
+ app.pollEnabled = False
+ app.expireEnabled = False
+
+ self.database = MintDatabase(app)
+ self.database.check()
+ self.database.init()
+
+ try:
+ scommand = remaining[0]
+ except IndexError:
+ self.print_help()
+ sys.exit(1)
+
+ try:
+ command = self.commands_by_name[scommand]
+ except KeyError:
+ print "Error: Command '%s' is unrecognized" % scommand
+ self.print_help()
+ sys.exit(1)
+
+ try:
+ opts, args = command.parse(remaining)
+ except CommandException, e:
+ print "Error: %s" % e
+ e.command.print_help()
+ sys.exit(1)
+
+ if "help" in opts:
+ command.print_help()
+ return
+
+ try:
+ command.run(opts, args)
+ except CommandException, e:
+ print "Error: %s" % e
+ e.command.print_help()
+ sys.exit(1)
+
+ class LoadSchema(Command):
+ def run(self, opts, args):
+ self.parent.database.loadSchema()
+ print "The schema is loaded"
+
+ class DropSchema(Command):
+ def run(self, opts, args):
+ if "force" in opts:
+ self.parent.database.dropSchema()
+ print "The schema is dropped"
+ else:
+ raise CommandException \
+ (self, "Command drop-schema requires --force")
+
+ class ReloadSchema(Command):
+ def run(self, opts, args):
+ if "force" in opts:
+ self.parent.database.dropSchema()
+ self.parent.database.loadSchema()
+ print "The schema is reloaded"
+ else:
+ raise CommandException \
+ (self, "Command reload-schema requires --force")
+
+ class CheckSchema(Command):
+ def run(self, opts, args):
+ self.parent.database.checkSchema()
+
+ class AddUser(Command):
+ def run(self, opts, args):
+ try:
+ name = args[1]
+ except IndexError:
+ raise CommandException(self, "NAME is required")
+
+ if Subject.selectBy(name=name).count():
+ print "Error: a user called '%s' already exists" % name
+ sys.exit(1)
+
+ try:
+ password = args[2]
+ except IndexError:
+ password = prompt_password()
+
+ crypted = crypt_password(password)
+
+ try:
+ subject = Subject(name=name, password=crypted)
+
+ for role in Role.selectBy(name="user"):
+ subject.addRole(role)
+ break
+
+ assert role
+
+ subject.syncUpdate()
+ except IntegrityError:
+ print "Error: a user called '%s' already exists" % name
+ sys.exit(1)
+
+ print "User '%s' is added" % name
+
+ class RemoveUser(Command):
+ def run(self, opts, args):
+ if "force" in opts:
+ if len(args) != 2:
+ print "Error: no user name given"
+ sys.exit(1)
+
+ name = args[1]
+ subjects = Subject.selectBy(name=name)
+
+ if subjects.count():
+ for subject in subjects:
+ subject.destroySelf()
+ break
+ else:
+ raise CommandException(self, "User '%s' is unknown" % name)
+
+ print "User '%s' is removed" % name
+ else:
+ raise CommandException \
+ (self, "Command remove-user requires --force yes")
+
+ class ListUsers(Command):
+ def run(self, opts, args):
+ subjects = Subject.select(orderBy='name')
+
+ print " ID Name Roles"
+ print "---- -------------------- --------------------"
+
+ for subject in subjects:
+ roles = ", ".join([x.name for x in list(subject.roles)])
+
+ print "%4i %-20s %-20s" % (subject.id, subject.name, roles)
+
+ count = subjects.count()
+ print "(%i user%s found)" % (count, ess(count))
+
+ class ListRoles(Command):
+ def run(self, opts, args):
+ roles = Role.select(orderBy='name')
+
+ print " ID Name"
+ print "---- --------------------"
+
+ for role in roles:
+ print "%4i %s" % (role.id, role.name)
+
+ count = roles.count()
+ print "(%i role%s found)" % (count, ess(count))
+
+ class Assign(Command):
+ def run(self, opts, args):
+ if len(args) != 3:
+ raise CommandException(self, "USER and ROLE are required")
+
+ subject = Subject.getByName(args[1])
+
+ if not subject:
+ raise CommandException \
+ (self, "User '%s' is unknown" % subject.name)
+
+ role = Role.getByName(args[2])
+
+ if not role:
+ raise CommandException \
+ (self, "Role '%s' is unknown" % role.name)
+
+ try:
+ subject.addRole(role)
+ subject.syncUpdate()
+
+ print "User '%s' is added to role '%s'" % \
+ (subject.name, role.name)
+ except IntegrityError:
+ msg = "User '%s' is already assigned to role '%s'" % \
+ (subject.name, role.name)
+ raise CommandException(self, msg)
+
+ class Unassign(Command):
+ def run(self, opts, args):
+ if len(args) != 3:
+ raise CommandException(self, "USER and ROLE are required")
+
+ subject = Subject.getByName(args[1])
+
+ if not subject:
+ raise CommandException \
+ (self, "User '%s' is unknown" % args[1])
+
+ role = Role.getByName(args[2])
+
+ if not role:
+ raise CommandException \
+ (self, "Role '%s' is unknown" % args[2])
+
+ subject.removeRole(role)
+ subject.syncUpdate()
+
+ print "User '%s' is removed from role '%s'" % \
+ (subject.name, role.name)
+
+ class ChangePassword(Command):
+ def run(self, opts, args):
+ try:
+ ssubject = args[1]
+ except IndexError:
+ raise CommandException(self, "USER is required")
+
+ subject = Subject.getByName(ssubject)
+
+ if not subject:
+ raise CommandException \
+ (self, "User '%s' is unknown" % ssubject)
+
+ crypted = crypt_password(prompt_password())
+
+ subject.password = crypted
+ subject.syncUpdate()
+
+ print "Password of user '%s' is changed" % subject.name
+
class MintServerTool(BaseMintTool):
def __init__(self, name):
super(MintServerTool, self).__init__(name)
Modified: mgmt/trunk/mint/python/mint/util.py
===================================================================
--- mgmt/trunk/mint/python/mint/util.py 2009-08-31 17:13:12 UTC (rev 3601)
+++ mgmt/trunk/mint/python/mint/util.py 2009-08-31 19:23:48 UTC (rev 3602)
@@ -1,8 +1,11 @@
import sys, os, logging
+from crypt import crypt
+from getpass import getpass
+from random import sample
from threading import Thread
-log = logging.getLogger("mint")
+log = logging.getLogger("mint.util")
class MintDaemonThread(Thread):
def __init__(self, app):
@@ -20,3 +23,28 @@
def stop(self):
assert self.stopRequested is False
self.stopRequested = True
+
+def prompt_password():
+ password = None
+
+ while password is None:
+ once = getpass("Enter new password: ")
+ twice = getpass("Confirm new password: ")
+
+ if once == twice:
+ password = once
+ else:
+ print "Passwords don't match; try again"
+
+ return password
+
+password_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+
+def crypt_password(password, salt=None):
+ if not salt:
+ salt = "".join(sample(password_chars, 2))
+
+ return crypt(password, salt)
+
+def ess(num, ending="s"):
+ return num != 1 and ending or ""
Modified: mgmt/trunk/parsley/python/parsley/command.py
===================================================================
--- mgmt/trunk/parsley/python/parsley/command.py 2009-08-31 17:13:12 UTC (rev 3601)
+++ mgmt/trunk/parsley/python/parsley/command.py 2009-08-31 19:23:48 UTC (rev 3602)
@@ -159,5 +159,6 @@
class CommandException(Exception):
def __init__(self, command, message):
+ super(CommandException, self).__init__(message)
+
self.command = command
- self.message = message
15 years, 3 months
rhmessaging commits: r3601 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-31 13:13:12 -0400 (Mon, 31 Aug 2009)
New Revision: 3601
Modified:
mgmt/trunk/mint/python/mint/tools.py
Log:
Remove unneccessary command-line options; drop privileges in mint tools
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2009-08-31 15:57:38 UTC (rev 3600)
+++ mgmt/trunk/mint/python/mint/tools.py 2009-08-31 17:13:12 UTC (rev 3601)
@@ -35,14 +35,6 @@
opt = CommandOption(self, "debug")
opt.description = "Enable debugging; print logging to console"
- opt = CommandOption(self, "expire-frequency")
- opt.argument = "FREQUENCY"
- opt.description = "Frequency (in seconds) of the expiration thread"
-
- opt = CommandOption(self, "expire-threshold")
- opt.argument = "THRESHOLD"
- opt.description = "Threshold (in seconds) of the age of data before it is expired"
-
def check(self):
if os.getuid() not in (os.stat(__file__).st_uid, 0):
print "Error: You have insufficient privileges"
@@ -51,6 +43,11 @@
def init(self):
super(BaseMintTool, self).init()
+ # Drop privileges
+
+ if os.getuid() == 0:
+ os.setuid(os.stat(__file__).st_uid)
+
try:
import psyco
psyco.full()
15 years, 3 months
rhmessaging commits: r3600 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-31 11:57:38 -0400 (Mon, 31 Aug 2009)
New Revision: 3600
Modified:
mgmt/trunk/cumin/python/cumin/main.py
Log:
Unprotect the pages associated with login
Modified: mgmt/trunk/cumin/python/cumin/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/main.py 2009-08-31 15:38:58 UTC (rev 3599)
+++ mgmt/trunk/cumin/python/cumin/main.py 2009-08-31 15:57:38 UTC (rev 3600)
@@ -55,6 +55,9 @@
self.form_page = CuminFormPage(self, "form.html")
self.add_page(self.form_page)
+ self.login_page = account.LoginPage(self, "login.html")
+ self.add_page(self.login_page)
+
# XXX move this to the account module
self.account_page = account.AccountPage(self, "account.html")
self.add_page(self.account_page)
@@ -68,13 +71,10 @@
unprotected = set()
- unprotected.add(self.main_page.css_page)
- unprotected.add(self.main_page.javascript_page)
unprotected.add(self.resource_page)
-
- self.login_page = account.LoginPage(self, "login.html")
- self.add_page(self.login_page)
unprotected.add(self.login_page)
+ unprotected.add(self.login_page.css_page)
+ unprotected.add(self.login_page.javascript_page)
self.unprotected_pages = unprotected
15 years, 3 months
rhmessaging commits: r3599 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-31 11:38:58 -0400 (Mon, 31 Aug 2009)
New Revision: 3599
Modified:
mgmt/trunk/mint/python/mint/main.py
Log:
Make /var/lib/cumin the default mint home until we separate mint into its own rpm
Modified: mgmt/trunk/mint/python/mint/main.py
===================================================================
--- mgmt/trunk/mint/python/mint/main.py 2009-08-31 15:29:00 UTC (rev 3598)
+++ mgmt/trunk/mint/python/mint/main.py 2009-08-31 15:38:58 UTC (rev 3599)
@@ -77,7 +77,7 @@
def __init__(self):
super(MintConfig, self).__init__()
- hdef = os.path.normpath("/var/lib/mint")
+ hdef = os.path.normpath("/var/lib/cumin")
hdef = os.environ.get("CUMIN_HOME", hdef)
self.home = os.environ.get("MINT_HOME", hdef)
15 years, 3 months
rhmessaging commits: r3598 - in mgmt/trunk: mint/python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-08-31 11:29:00 -0400 (Mon, 31 Aug 2009)
New Revision: 3598
Modified:
mgmt/trunk/cumin/bin/cumin
mgmt/trunk/mint/python/mint/main.py
Log:
Make mint config work to cumin file locations
Modified: mgmt/trunk/cumin/bin/cumin
===================================================================
--- mgmt/trunk/cumin/bin/cumin 2009-08-31 15:06:39 UTC (rev 3597)
+++ mgmt/trunk/cumin/bin/cumin 2009-08-31 15:29:00 UTC (rev 3598)
@@ -1,9 +1,5 @@
#!/bin/bash
-if [[ "$CUMIN_HOME" ]]; then
- export MINT_HOME="$CUMIN_HOME"
-fi
-
function die {
kill "$mpid"
kill "$cpid"
Modified: mgmt/trunk/mint/python/mint/main.py
===================================================================
--- mgmt/trunk/mint/python/mint/main.py 2009-08-31 15:06:39 UTC (rev 3597)
+++ mgmt/trunk/mint/python/mint/main.py 2009-08-31 15:29:00 UTC (rev 3598)
@@ -78,6 +78,7 @@
super(MintConfig, self).__init__()
hdef = os.path.normpath("/var/lib/mint")
+ hdef = os.environ.get("CUMIN_HOME", hdef)
self.home = os.environ.get("MINT_HOME", hdef)
if not os.path.isdir(self.home):
15 years, 3 months