Install doesn't support $PROJECT variable

RESOLVED FIXED

Status

Testopia
General
--
major
RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: David Multer, Assigned: Greg Hendricks)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/418.9.1 (KHTML, like Gecko) Safari/419.3
Build Identifier: 1.1.3

Testopia needs to support the $PROJECT environment variable as used within Bugzilla 2.22.2. This permits multiple database setups, localconfig, and template entries from a single Bugzilla install. Testopia currently has variables for a single database and templates. See http://www.bugzilla.org/docs/2.22/html/x763.html for more information.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
(Reporter)

Updated

11 years ago
Severity: normal → major
OS: Mac OS X → All
Hardware: Macintosh → All
(Assignee)

Comment 1

11 years ago
Testopia doesn't access localconfig directly. It also doesn't create template files. This is done during the untarring of the installation files. I don't understand how Testopia would use the $PROJECT variable, but then I was not aware that this option existed. 

If you copy the template files from template/en/default/testopia to your project location, that should be the only necessary step as far as I can tell.
(Reporter)

Comment 2

11 years ago
If you look into the use of the $PROJECT variable, you'll see that it's used to support a single codebase with multiple configurations. Note that the tr_install.pl script looks for a copy of "localconfig" at line 39 which will fail in this case. I don't know if there are any other assumptions in the code on things like database definition. With this variable defined, it's common to have multiple databases, user, passwords, etc.

Also, there is not a single place to copy the templates. My Bugzilla template directory looks like:

template/en/project1
template/en/project2
template/en/project3
...
(Reporter)

Comment 3

11 years ago
I fixed tr_install.pl to work as I described. Here are the changed lines starting from line 39. I have not made any changes for handling the template files.

# use localconfig file default or as specified by $PROJECT variable
our $project;
our $localconfig;
if ($ENV{'PROJECT'} && $ENV{'PROJECT'} =~ /^(\w+)$/) {
    $project = $1;
    $localconfig = "localconfig.$project";
} else {
    $localconfig = "localconfig";
}

if (! -e "$localconfig") {
  DieWithStyle("Can't find file: $localconfig\nBugzilla is not installed in this directory.\n".
    "Can't continue.\n");
}

##############################################################################
print "Now installing Testopia using $localconfig...\n\n";
do "$localconfig";
##############################################################################
(Assignee)

Comment 4

11 years ago
This looks good. I see now what you were talking about. After digging around a bit I think this is the only place that localconfig would be accessed directly by Testopia. 

Can you attach the above code as a unified diff (diff -u)? I can then patch it in.
As for the templates, I think it would be a simple matter of copying the files to the appropriate location. This would be simple to add to the script. If you don't want to take the time then I will look into it after this is patched in.

Thanks for putting in the effort.
(Reporter)

Comment 5

11 years ago
Created attachment 255831 [details] [diff] [review]
Unified diff patch file that updates tr_install.pl (v1.1.3) to support the Bugzilla $PROJECT variable

Code still needs to be patched to support template loading using $PROJECT variable.
(Assignee)

Comment 6

11 years ago
It appears that checksetup does not copy templates either. We could check for the existence of a project template directory, but I think it will be assumed you need to copy them manually as you did with the initial bugzilla setup if you want to customize them. 

patch by David Multer r=ghendricks a=ghendricks
    Checking in tr_install.pl;
    /cvsroot/mozilla/webtools/testopia/tr_install.pl,v  <--  tr_install.pl
    new revision: 1.19; previous revision: 1.18
    done
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.