gave oils_requestor the ability to find the IDL from the settings server based on...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 12 Mar 2008 16:03:50 +0000 (16:03 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 12 Mar 2008 16:03:50 +0000 (16:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@8992 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/extras/oils_requestor.c
Open-ILS/src/support-scripts/offline-blocked-list.pl

index d354c40..0bca914 100644 (file)
@@ -22,9 +22,10 @@ int main( int argc, char* argv[] ) {
        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 @@ int main( int argc, char* argv[] ) {
                        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 @@ int main( int argc, char* argv[] ) {
                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 @@ int main( int argc, char* argv[] ) {
        free(script);
        free(authtoken);
        free(idl_filename);
+       osrf_settings_free_host_config(NULL);
        return 1;
 }
 
index e2714e3..42327d0 100755 (executable)
@@ -16,11 +16,13 @@ if(1) { # XXX command line param
 
     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);