[open-ils-commits] r8993 - in trunk/Open-ILS/src: extras support-scripts

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Mar 12 12:37:42 EDT 2008


Author: erickson
Date: 2008-03-12 12:04:21 -0400 (Wed, 12 Mar 2008)
New Revision: 8993

Modified:
   trunk/Open-ILS/src/extras/oils_requestor.c
   trunk/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: trunk/Open-ILS/src/extras/oils_requestor.c
===================================================================
--- trunk/Open-ILS/src/extras/oils_requestor.c	2008-03-12 16:03:50 UTC (rev 8992)
+++ trunk/Open-ILS/src/extras/oils_requestor.c	2008-03-12 16:04:21 UTC (rev 8993)
@@ -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: trunk/Open-ILS/src/support-scripts/offline-blocked-list.pl
===================================================================
--- trunk/Open-ILS/src/support-scripts/offline-blocked-list.pl	2008-03-12 16:03:50 UTC (rev 8992)
+++ trunk/Open-ILS/src/support-scripts/offline-blocked-list.pl	2008-03-12 16:04:21 UTC (rev 8993)
@@ -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