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;
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;
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 &&
free(script);
free(authtoken);
free(idl_filename);
+ osrf_settings_free_host_config(NULL);
return 1;
}
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);