Patch from Kevin Beswick to support set operations on certain opensrf message fields. note, this does not currently affect behavior, since values for messages are initially set from parsing JSON without using the access/mutators for setting values.
Depending on the JS engine and version of Dojo, the order
of attributes in JSON objects may change (as is explicitly
allowed by the JSON spec). To avoid false test failures,
only use one attribute in the object.
dbs [Wed, 30 Mar 2011 04:31:28 +0000 (04:31 +0000)]
Handle the common NXDOMAIN problem with Python a bit more gracefully
Rather than dumping a nasty full stacktrace to the command line, we
print a hopefully helpful pointer to the actual problem in plain
English.
Also, rather than stopping everything if a "stop_all" command was
issued, skip the error status in osrf_ctl.sh for the Python bit
and carry on shutting down the other services. A bit more convenient
if you want to have Python enabled but don't necessarily need it
running.
dbs [Tue, 29 Mar 2011 13:55:09 +0000 (13:55 +0000)]
Make javascript unit tests more granular to ease tracking down errors
Noticed a failure when running with Rhino 1.7RC2 that wasn't happening
with version of Rhino packaged in shrinksafe.jar, and it was a bit
tedious narrowing down which test was actually failing. Breaking up
the tests into smaller sets will make this process easier and might invite
the submission of other tests to target areas that are not yet covered.
dbs [Tue, 29 Mar 2011 02:59:51 +0000 (02:59 +0000)]
Give Python services introspection methods matching C and Perl
Perl and C services offer "opensrf.system.method" and
"opensrf.system.method.all" methods for accessing service
information. Renaming Python's methods to match at least
enables srfsh to access this information, even if it does
still need to be taught to provide that information in a
consistent manner.
dbs [Mon, 28 Mar 2011 15:22:54 +0000 (15:22 +0000)]
Add DOH-based unit test harness for OpenSRF JavaScript
The Dojo Objective Harness enables us to run unit tests from the command
line or within a browser. Running tests from a command line makes it easier
to fold into the continuous integration server. Included in this commit
is a small README for setting up command-line testing and a sample set
of unit tests that exercise parts of JSON_v1.js.
dbs [Sun, 27 Mar 2011 21:36:25 +0000 (21:36 +0000)]
Improved PID file handling in osrf_ctl.sh
Joseph Lewis <joehms22@gmail.com> submitted a patch to address
https://bugs.launchpad.net/evergreen/+bug/741088 ("osrf_ctl.sh Doesn't check if
process is actually running")
As of this patch, when start_perl, start_c, or start_python are started and
existing PID files are found for those processes, instead of assuming that the
processes are actually running, osrf-ctl.sh now has the intelligence to check
the process list to see if there is a matching process. If no running process
is found, then the old PID file is removed and the start command is issued.
Two additional actions have been added, "smart_clear" and "clear_pid".
"smart_clear" checks the PID files against the running processes and removes
PID files where no running process is found. This is effectively invoked
under the covers when start_* is invoked and a PID file is found.
"clear_pid" deletes all PID files without checking to see if there are any
running processes. In most cases, it should only be invoked as part of an
automated boot sequence.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
Signed-off-by: Joseph Lewis <joehms22@gmail.com>
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@2215 9efc2488-bf62-4759-914b-345cdb29e865
dbs [Sun, 13 Mar 2011 06:03:46 +0000 (06:03 +0000)]
Run OpenSRF JavaScript through jslint for a light cleanup
Mostly just semicolons, and shifting a bit of code around to reduce
usage of functions/classes before they've been defined. Staying away
from the === / !== operators for null/undefined/0/''/true/false for
now.
dbs [Wed, 2 Mar 2011 03:51:42 +0000 (03:51 +0000)]
Coerce the weird test env for MFHD into working inside buildbot
'use testlib.pm' throws the standard "prove --lib lib -r t" recipe for testing
Perl packages out the window, so we have to override the Perl testing class
and point to the known location of testlib.pm
This may still fail for Evergreen branches prior to rel_2_1, but it's
_something_. Throw me a bone, here, will ya?
Ultimately, the best thing to do is probably to make MFHD tests conform.
dbs [Tue, 22 Feb 2011 14:28:19 +0000 (14:28 +0000)]
Resolve encoding problem found by attempting to register patrons with Unicode names
Symptoms were:
1. a gateway.log entry showing http_translator receiving an XMPP error message
2. a corresponding osrfsys.log entry "server: died with error Wide character in syswrite at /usr/local/share/perl5/OpenSRF/Server.pm line 239"
Per normal Perl Unicode handling practices, decoding input and encoding output
using the Encode module and decode_utf8() / encode_utf8() appears to resolve
the problem.
dbs [Tue, 11 Jan 2011 22:59:18 +0000 (22:59 +0000)]
Clean up Python server implementation, guided by pylint
Add some docstrings, keep line lengths at 80 or less (MORE
WHITESPACE!), remove some dead code, and add a hint to check
max_children config value if we're bumping up against the
limit.
dbs [Mon, 20 Dec 2010 02:55:24 +0000 (02:55 +0000)]
Straighten out -f / -d flag confusion in libmemcached prerequisite
There are two different styles of checking for previously downloaded
tarballs in this Makefile; the libmemcached entry combined them both
with unfortunate results.
erickson [Mon, 20 Dec 2010 01:20:48 +0000 (01:20 +0000)]
Python srfsh enhancements
* Srfsh plugins can now insert new commands and add words to the tab
completion word bank.
* Addded support reading script files
* Added support for service open/close (connect/disconnect) for stateful
connections
* Moved to class-based srfsh module for easier state maintenance
* More doc strings
dbs [Tue, 7 Dec 2010 14:30:45 +0000 (14:30 +0000)]
Apply libtools versioning to OpenSRF c-apps as well
We apply a -version-info argument of 2:0:2, meaning:
* interface = 2: interface '2' of this library
* revision = 0: first implementation of interface '2'
* age = 2: this library can be linked with executables going back
two interface versions
See http://sourceware.org/autobook/autobook/autobook_91.html for more
information on the -version-info argument.
dbs [Tue, 30 Nov 2010 04:16:30 +0000 (04:16 +0000)]
Prepare for version 2.0.0 with versioning for 2.0.0
Use the libtool -version-info option to provide an explicit version
for the libopensrf.so library. Introducing versioned libraries will
give us the ability to force recompiles of linked applications when
binary compatibility has been broken.
erickson [Mon, 29 Nov 2010 19:15:07 +0000 (19:15 +0000)]
add fault tolerance (e.g. recover from interrupted select/sysread); always perform idle maintenance when there are any active child processes; exit check status early when no active processes exist
erickson [Mon, 22 Nov 2010 22:21:35 +0000 (22:21 +0000)]
in the rare case the select() is interrupted while waiting on child statuses, exit early to prevent read()'s on invalid file handles and allow the calling code to loop back around and try again
erickson [Sat, 20 Nov 2010 15:24:55 +0000 (15:24 +0000)]
added support for paging through 'less' (like C); added 'router' query docs; added separate env vars for pretty printing json and for print network object keys; explicit opensrf disconnect on exit
erickson [Tue, 16 Nov 2010 14:08:29 +0000 (14:08 +0000)]
repaired logic in the as-yet-unused import_array_data; use the more efficient enumerate func; capture array length outside of loop for efficiency; avoid calls to set/get_field and access _data directly inside of the NetworkObject class for faster accessor/mutator's
erickson [Tue, 16 Nov 2010 03:36:49 +0000 (03:36 +0000)]
rely on logic, not failure through try/catch, to determine of an object is a registered network object; if an object is unregistered, do not treat it as an __unknown network object (which obfuscates and provides no value).
erickson [Tue, 16 Nov 2010 03:29:32 +0000 (03:29 +0000)]
killed the terminal colors in srfsh.py output. They are cute and all, but are likely the cause of readline oddities/artifacts (and kind of distracting). Default to raw (json) output for consistency
dbs [Thu, 11 Nov 2010 14:47:12 +0000 (14:47 +0000)]
If an alternate config file is pointed to in osrf_ctl.sh, respect it
In a previous edit, I accidentally removed the config file option
from the start_python command, which would break if anything other
than the configured default config file was specified as an option to
osrf_ctl.sh. This makes opensrf.py once again respect the authority
of osrf_ctl.sh.
dbs [Thu, 11 Nov 2010 14:25:02 +0000 (14:25 +0000)]
Use the same PID directory as the opensrf-perl.pl and opensrf.py scripts
The default PID directories for the opensrf-perl.pl and opensrf.py scripts
was /openils/var/run/opensrf (assuming a prefix of '/openils'), while the
default PID directory for osrf_ctl.sh was /openils/var/run. This complicated
matters when trying to restart individual Python or Perl services, as without
passing an explicit PID directory argument the restart command from the
language-specific script would check for a PID in a different PID directory,
find none, and end up running a second copy of the service instead of
restarting the existing service.
The change groups all PIDs in the 'run/opensrf' subdirectory to avoid any
PID file conflicts (as unlikely as that might be) if OpenSRF is installed
in the default location - so rather than /var/local/run/*.pid, one will
be able to look at /var/local/run/opensrf/*.pid
dbs [Tue, 9 Nov 2010 18:17:50 +0000 (18:17 +0000)]
Enhanced do_start() implementation in Python management script
Unclean shutdowns and fork() misery can create PID files that have
no actual process behind them. Instead of just trusting the PID file, check
for the running PID; if the process is not running, then remove the PID file
and actually start the service.
dbs [Tue, 9 Nov 2010 16:21:15 +0000 (16:21 +0000)]
Give opensrf.py reasonable defaults for options
Rather than:
opensrf.py -l -d -f /openils/conf/opensrf_core.xml -p /openils/var/run/ -a start_all
you can now use:
opensrf.py -l -d -a start_all
Isn't that better? Note that we put the PIDs into PID_DIR/run/opensrf/
so that if/when OpenSRF is installed outside of the /openils/ prefix,
the names of the processes won't conflict with any other application PIDs.
Unlikely, but you never know.
dbs [Tue, 9 Nov 2010 14:22:25 +0000 (14:22 +0000)]
Fix daemonize problem that surfaced in start_all
Thanks to Michael Giarlo for reporting the problem, Bill Erickson
for pointing the way to the solution, and http://bugs.python.org/issue5313
for providing me with more context for the problem & solution.
dbs [Mon, 8 Nov 2010 21:03:55 +0000 (21:03 +0000)]
Make opensrf-perl.pl handle missing configuration for services more gracefully
As we might want to ship configuration files with commented out sections,
this will alert the user that a service was listed in the hosts section
but the configuration for that service could not be found.