Pyjojo implemented some`breaking changes <https: github.com="" atarola="" pyjojo#recent-breaking-changes`<br="">recently. This version of Pymojo, v0.6, is the last version that supportsversions of Pyjojo prior to these changes.

The various arguments (see below) tell Mojo how to hook up to your Jojo. Theaction is one of these four:

* ``list`` - Lists all of the scripts the Jojo knows * ``show`` - Shows detail on one of these scripts * ``run`` - Executes a script on the remote system * ``reload`` - Reloads the Jojo's script listing

The ``show`` and ``run`` actions require that you specify a ``script`` by name, whichyou can discover with a ``list``. The ``run`` action also optionally accepts aseries of key/value pairs to pass into said script as environment variables.These should be written like this: ``key1=value1 key2=value2``

That defines two environments, called "local" and "bobs-jojo-server" whosesettings can be used with the ``-n`` option, like so:

mojo -n bobs-jojo-server list

If you don't provide a ``-n`` option, Mojo will try to use the``default_environment``.

Mojo will automatically pull in configration files found at ``/etc/mojo.yml`` and``~/.mojo.yml``, but you can specify an additional config file with ``-c``.Configurations will be applied in the following order:

So if all of those defaults are what you need, then getting your Mojo on isquite simple indeed::

from pymojo.mojo import Mojo

mojo = Mojo()

As an example of using every last option Mojo's constructor accepts, here's howto interact with a Jojo server running on ``192.168.0.123:9090``, which uses aself-signed SSL certificate and HTTP Basic Authentication::

# Get script details, forcing a refresh of this data from the Jojo server script = mojo.get_script("my_script", False) # script is the script JSON data, and Mojo's cache has been updated

# Run a Jojo script resp = mojo.run("my_script", {foo:"bar", bar:"foo"}) # resp is a requests response object from which you can gather a # resp.status_code and get the JSON body with resp.json()

# Reload the Jojo's configuration and Mojo's cache mojo.reload()

Extending Mojo==============

Pyjojo is merely a remote script execution engine, and is meant to be extendedto meet the needs of its users. As-is, Pymojo can act on any custom scripts ona Jojo server, but the specifics of a Jojo deployment can be easily wrapped upin a class that inherits a Mojo.

Realistically, you'll use Jojo for things like remote service control orsoftware deployments, but for the sake of example, let's say our Jojo serveronly knows how to execute one script, ``echo.sh``, which looks like this::

Simply put, it takes the same Jojo configuration options that Mojo takes,and then passes them on to the superconstructor. The ``echo`` function passesdata through the superclass's ``run`` function and passes the result back up.