Mailing List Archive

trac-admin checking if env is up
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.

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CAHEKYV5%2Bge1WpHHMHkes6chz-BvnFfZK80OLxkJc74tSrMgK7w%40mail.gmail.com.
Re: trac-admin checking if env is up [ In reply to ]
On Friday, July 14, 2023 at 11:12:44?AM UTC-7 Mauricio wrote:

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.


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 $?
2

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/ec2ec353-e3ef-4f29-b074-5079d4e520ecn%40googlegroups.com.
Re: Re: trac-admin checking if env is up [ In reply to ]
Hi,

On Sat, Jul 15, 2023 at 5:18?AM RjOllos <rjollos@gmail.com> wrote:
>
> On Friday, July 14, 2023 at 11:12:44?AM UTC-7 Mauricio wrote:
>
> 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.
>
>
> 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 $?
> 2

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 <jun66j5@gmail.com> (?? ?)

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CAEVLMajuAphWoXtY3GTTmK6_P5Ng6dmzEMREh36u-0p8HTe-Qg%40mail.gmail.com.