[open-ils-commits] r8992 - in branches/rel_1_2/Open-ILS/src: extras
support-scripts
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Mar 12 12:37:11 EDT 2008
Author: erickson
Date: 2008-03-12 12:03:50 -0400 (Wed, 12 Mar 2008)
New Revision: 8992
Modified:
branches/rel_1_2/Open-ILS/src/extras/oils_requestor.c
branches/rel_1_2/Open-ILS/src/support-scripts/offline-blocked-list.pl
Log:
gave oils_requestor the ability to find the IDL from the settings server based on hostname if none is specified in the path. passing hostname from the offline-blocked list generator
Modified: branches/rel_1_2/Open-ILS/src/extras/oils_requestor.c
===================================================================
--- branches/rel_1_2/Open-ILS/src/extras/oils_requestor.c 2008-03-12 15:40:11 UTC (rev 8991)
+++ branches/rel_1_2/Open-ILS/src/extras/oils_requestor.c 2008-03-12 16:03:50 UTC (rev 8992)
@@ -22,9 +22,10 @@
char* config = NULL;
char* context = NULL;
char* idl_filename = NULL;
+ char* hostname = NULL;
char* request;
- while( (c = getopt( argc, argv, "f:u:p:s:c:i:" )) != -1 ) {
+ while( (c = getopt( argc, argv, "f:u:p:s:c:i:h:" )) != -1 ) {
switch(c) {
case '?': return -1;
case 'f': config = strdup(optarg); break;
@@ -33,19 +34,10 @@
case 'p': password = strdup(optarg); break;
case 's': script = strdup(optarg); break;
case 'i': idl_filename = strdup(optarg); break;
+ case 'h': hostname = strdup(optarg); break;
}
}
- if (!idl_filename) {
- fprintf(stderr, "IDL file not provided. Exiting...\n");
- return -1;
- }
-
- if (!oilsInitIDL( idl_filename )) {
- fprintf(stderr, "IDL file could not be loaded. Exiting...\n");
- return -1;
- }
-
if(!(config && context)) {
fprintf(stderr, "Config or config context not provided. Exiting...\n");
return -1;
@@ -56,6 +48,19 @@
return 1;
}
+ if(!idl_filename) {
+ if(!hostname) {
+ fprintf(stderr, "We need an IDL file name or a settings server hostname...\n");
+ return 1;
+ }
+ osrf_settings_retrieve(hostname);
+ }
+
+ if (!oilsInitIDL( idl_filename )) {
+ fprintf(stderr, "IDL file could not be loaded. Exiting...\n");
+ return -1;
+ }
+
printf("Connected to OpenSRF network...\n");
if( username && password &&
@@ -76,6 +81,7 @@
free(script);
free(authtoken);
free(idl_filename);
+ osrf_settings_free_host_config(NULL);
return 1;
}
Modified: branches/rel_1_2/Open-ILS/src/support-scripts/offline-blocked-list.pl
===================================================================
--- branches/rel_1_2/Open-ILS/src/support-scripts/offline-blocked-list.pl 2008-03-12 15:40:11 UTC (rev 8991)
+++ branches/rel_1_2/Open-ILS/src/support-scripts/offline-blocked-list.pl 2008-03-12 16:03:50 UTC (rev 8992)
@@ -16,11 +16,13 @@
use OpenSRF::Utils::JSON;
use IPC::Open2 qw/open2/;
+ use Net::Domain qw/hostfqdn/;
sub runmethod {
my $method = shift;
my $flag = shift;
- my $command = "echo \"open-ils.storage $method\" | $oils_reqr -f $config -c $context";
+ my $hostname = hostfqdn();
+ my $command = "echo \"open-ils.storage $method\" | $oils_reqr -f $config -c $context -h $hostname";
warn "-> $command\n";
my ($child_stdout, $child_stdin);
More information about the open-ils-commits
mailing list