- Timestamp:
- 2014-08-14T14:54:59+12:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/activate.pl
r28953 r29190 143 143 # and is-persistent (is-persistent only implemented for GS2). 144 144 sub config { 145 my ($library_url, $command, $check_message_against_regex, $site, $expected_error_code ) = @_;145 my ($library_url, $command, $check_message_against_regex, $site, $expected_error_code, $silent) = @_; 146 146 # Gatherer.java's configGS3Server doesn't use the site variable 147 147 # so we don't have to either … … 177 177 return 1; 178 178 } else { 179 # if we expect the collection to be inactive, then we'd be in silent mode: if so, 180 # don't print out the "ping did not succeed" response, but print out any other messages 181 182 # So we only suppress the ping col "did not succeed" response if we're in silent mode 183 # But if any message other than ping "did not succeed" is returned, we always print it 184 if($response_content !~ m/did not succeed/ || !$silent) { 179 185 &print_msg("\n\tBUT: command $library_url$command response UNEXPECTED.\n", 3); 180 186 &print_msg("*** Got message:\n$response_content.\n", 4); 181 return 0; # ping on a collection may "not succeed." 187 } 188 return 0; # ping on a collection may "not succeed." 182 189 } 183 190 } … … 231 238 232 239 sub ping { 233 my ($library_url, $command, $gs_mode, $site ) = @_;240 my ($library_url, $command, $gs_mode, $site, $silent) = @_; 234 241 235 242 # If the GS server is not running, we *expect* to see a "500" status code. … … 239 246 my $check_responsemsg_against_regex = q/(succeeded)/; 240 247 my $expected_error_code = 500; 241 return config($library_url, $command, $check_responsemsg_against_regex, $site, $expected_error_code );248 return config($library_url, $command, $check_responsemsg_against_regex, $site, $expected_error_code, $silent); 242 249 } 243 250 … … 259 266 # send a pingaction to a collection in GS library to check if it's active 260 267 sub ping_library_collection { 261 my ($library_url, $gs_mode, $qualified_collection, $site ) = @_;268 my ($library_url, $gs_mode, $qualified_collection, $site, $silent) = @_; 262 269 263 270 my $command = ""; … … 268 275 $command = "?a=s&sa=ping&st=collection&sn=$qualified_collection"; 269 276 } 270 return &ping($library_url, $command, $gs_mode, $site );277 return &ping($library_url, $command, $gs_mode, $site, $silent); 271 278 } 272 279 … … 764 771 765 772 &print_msg("Checking if the collection $qualified_collection is not already active\n"); 766 my $collection_active = &ping_library_collection($library_url, $gs_mode, $qualified_collection, $site); 773 774 # Since we could have deactivated the collection at this point, 775 # it is likely that it is not yet active. When pinging the collection 776 # a "ping did not succeed" message is expected, therefore tell the ping 777 # to proceed silently 778 my $silent = 1; 779 my $collection_active = &ping_library_collection($library_url, $gs_mode, $qualified_collection, $site, $silent); 767 780 768 781 if (!$collection_active) { 782 &print_msg(" Collection is not active.\n"); 769 783 &print_msg("Activating collection $qualified_collection\n"); 770 784 &activate_collection($library_url, $gs_mode, $qualified_collection, $site); 771 785 772 786 # unless an error occurred, the collection should now be active: 773 $collection_active = &ping_library_collection($library_url, $gs_mode, $qualified_collection, $site); 787 $collection_active = &ping_library_collection($library_url, $gs_mode, $qualified_collection, $site); # not silent if ping did not succeed 774 788 if(!$collection_active) { 775 789 &print_msg("ERROR: collection $qualified_collection did not get activated\n");
Note:
See TracChangeset
for help on using the changeset viewer.