Changeset 25887
- Timestamp:
- 2012-06-28T17:47:07+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/activate.pl
r25796 r25887 103 103 # and is-persistent (is-persistent only implemented for GS2). 104 104 sub config { 105 my ($library_url, $command, $check_message_against_regex, $site ) = @_;105 my ($library_url, $command, $check_message_against_regex, $site, $expected_error_code) = @_; 106 106 # Gatherer.java's configGS3Server doesn't use the site variable 107 107 # so we don't have to either … … 143 143 } 144 144 elsif(LWP::Simple::is_error($response_code)) { # method exported by LWP::Simple, along with HTTP::Status constants 145 # check the page content is as expected 146 if(defined $expected_error_code && $response_code == $expected_error_code) { 147 &print_msg(" Response status $response_code as expected.\n", 3); 148 } else { 145 149 &print_msg("*** Command $library_url$command\n"); 146 &print_msg("*** HTTP Response Status: $response_code - Failed.\n"); 147 return 0; 150 &print_msg("*** Unexpected error. HTTP Response Status: $response_code - Failed.\n"); 151 } 152 return 0; # return false, since the response_code was an error, expected or not 148 153 } 149 154 } … … 182 187 sub ping { 183 188 my ($library_url, $command, $gs_mode, $site) = @_; 184 185 # "Ping" ... "succeeded" expected on success. (Ping on a collection may "not succeed".) 186 my $check_responsemsg_against_regex = q/succeeded/; 187 return config($library_url, $command, $check_responsemsg_against_regex, $site); 189 190 # If the GS server is not running, we *expect* to see a "500" status code. 191 # If the GS server is running, then "Ping" ... "succeeded" is expected on success. 192 # When pinging an inactive collection, it will say it did "not succeed". This is 193 # a message of interest to return. 194 my $check_responsemsg_against_regex = q/(succeeded)/; 195 my $expected_error_code = 500; 196 return config($library_url, $command, $check_responsemsg_against_regex, $site, $expected_error_code); 188 197 } 189 198 … … 482 491 483 492 # Read in the collection configuration file. 484 485 493 # Beware: Only if $site is specified in the cmdline does collectionConfig.xml get 494 # generated and does $gs_mode=gs3, else collect.cfg gets generated and $gs_mode=gs2 486 495 my ($collect_cfg_filename, $gs_mode) = &colcfg::get_collect_cfg_name(STDERR); 487 496 my $collectcfg = &colcfg::read_collection_cfg ($collect_cfg_filename,$gs_mode); … … 498 507 } 499 508 500 # We would like to know what the buildtype is 501 # This will be useful for Solr. 502 if (-e $build_cfg_filename) { 503 504 # testing if there has been a change of indexer 505 # (e.g. collect.cfg now says lucene, but build.cfg says mgpp) 506 my $buildcfg = &colcfg::read_building_cfg ($build_cfg_filename, $gs_mode); 507 if ($buildcfg->{'buildtype'} ne $collectcfg->{'buildtype'}) { 508 ### do something? See incremental-buildcol.pl 509 } 510 else { 511 ### do something? See incremental-buildcol.pl 512 } 513 } 514 else { # build.cfg doesn't exist 515 ### do something? See incremental-buildcol.pl 509 # We need to know the buildtype for Solr. 510 # Any change of indexers is already detected and handled by the calling code (buildcol or 511 # full-rebuild), so that at this stage the config file's buildtype reflects the actual buildtype. 512 513 # From buildcol.pl we use searchtype for determining buildtype, but for old versions, use buildtype 514 my $buildtype; 515 if (defined $collectcfg->{'buildtype'}) { 516 $buildtype = $collectcfg->{'buildtype'}; 517 } elsif (defined $collectcfg->{'searchtypes'} || defined $collectcfg->{'searchtype'}) { 518 $buildtype = "mgpp"; 519 } else { 520 $buildtype = "mg"; #mg is the default 516 521 } 517 522 … … 567 572 568 573 if($removeold) { 569 574 570 575 if(&util::dir_exists($index_dir)) { 571 576 &print_task_msg("Removing \"index\"");
Note:
See TracChangeset
for help on using the changeset viewer.