trac-admin checking if env is up

20 views
Skip to first unread message

Mauricio Tavares

unread,
Jul 14, 2023, 2:12:44 PM7/14/23
to trac-...@googlegroups.com
Is there a way to use trac-admin to check if I created an environment
already? The closest analogy I have is with derivatives, I can try to,
say, create a database/user only if they have not already been
created. But I do not see how to do that here. Closest I could come
up with is to do "trac-admin permission list My-user" and check for
the return message.

RjOllos

unread,
Jul 14, 2023, 4:18:40 PM7/14/23
to Trac Users
I suppose maybe you could check the return code:

$ trac-admin ../tracenvs/proj-1.5 initenv
Initenv for '/Users/rjollos/Documents/Workspace/trac-dev/tracenvs/proj-1.5' failed.
Does an environment already exist?
$ echo $?

Jun Omae

unread,
Jul 14, 2023, 8:28:28 PM7/14/23
to trac-...@googlegroups.com
Hi,
I don't think initenv command can be used to check. The initenv
command prompts for new Trac Environment when the target directory is
missing.

$ trac-admin /tmp/missing initenv
Creating a new Trac environment at /tmp/missing

Trac will first ask a few questions about your environment
in order to initialize and prepare the project database.

Please enter the name of your project.
This name will be used in page titles and descriptions.

Project Name [My Project]>

Instead, we could check "upgrade" is listed in output of the help
command for the target directory.

$ trac-admin /tmp/tracenv help | grep -q '^upgrade '
$ echo $?
0

$ trac-admin /tmp/missing help | grep -q '^upgrade '
$ echo $?
1

--
Jun Omae <jun...@gmail.com> (大前 潤)
Reply all
Reply to author
Forward
0 new messages