Skip to main content

brundeckrun

A(nother) fork of the client library written in Python to interact with the Rundeck API, the majority of which was created by Mark LaPerriere.

The fork exists mostly because the environment Lambda Vector uses it in requires it to be hosted on pypi, so updates must be pushed quickly. In addition, the requirement to run tests against a live Rundeck is a no-no.

Rundeck (API) version compatibility:

Some calls are under active use/development, primarily:

  • Job imports: API v1+
  • Project archive imports: API v14+

All other calls should work correctly as long as they are not deprecated or if Rundeck fail to correctly implement backwards compatibility.

Python version

Target python version: 2.7 Should work (but not tested aagainst): 3

Installation

pip install brundeckrun

Use

>>> from rundeck.client import Rundeck
>>> rd = Rundeck('rundeck.server.com', api_token='SECRET_API_TOKEN')
>>> rd.list_projects()
[{
    'description': None,
    'name': 'TestProject',
    'resources': {'providerURL': 'http://localhost:8000/resources.xml'},
}]
>>> rd.list_jobs('TestProject')
[{'description': 'Hello World!',
  'group': None,
  'id': 'a6e1e0f7-ad32-4b93-ba2c-9387be06a146',
  'name': 'HelloWorld',
  'project': 'TestProject'}]
>>> rd.run_job('a6e1e0f7-ad32-4b93-ba2c-9387be06a146', argString={'from':'brundeckrun'})
{'argstring': '-from brundeckrun',
 'date-started': datetime.datetime(2013, 7, 11, 18, 4, 24),
 'description': 'Plugin[localexec, nodeStep: true]',
 'href': 'http://rundeck.server.com/execution/follow/123',
 'id': '123',
 'job': None,
 'status': 'running',
 'user': 'brundeckrun'}

Tests

Unit tests

Unit tests are performed via tox.

To install tox and then run the tests:

pip install tox
tox

Integration tests

Note: currently the integrations are not up-to-date and are not under continous integration. Soon though...

Running the tests requires a running Rundeck server (the Rundeck standalone jar works well) and an API token for said Rundeck server.

You'll have to at least set the API token environment variable of RUNDECK_API_TOKEN but there are other environment variables to be aware of. The list is below and can be found at the head of the tests/__init__.py file. They should be fairly self-explanatory (OK, RUNDECK_PROTOCOL might not be self-explanatory... use either 'http' or 'https' there).

.. code-block:: bash

RUNDECK_API_TOKEN
RUNDECK_SERVER
RUNDECK_PORT
RUNDECK_PROTOCOL

Next clone the repo.

.. code-block:: bash

git clone https://github.com/pmatias/brundeckrun

.. note:: activate your virtualenv <http://www.virtualenv.org/en/latest/>_

Then install the requirements and dev requirements.

.. code-block:: bash

pip install -r requirements.txt
pip install -r requirements_dev.txt

Lastly, execute nose tests.

.. code-block:: bash

nosetests

.. _requests: http://docs.python-requests.org/ .. _Read the Docs: http://brundeckrun.readthedocs.org/

Some calls are under active use/development, primarily:

  • Job imports: API v1+
  • Project archive imports: API v14+

All other calls should work correctly as long as they are not deprecated or if Rundeck fail to correctly implement backwards compatibility.

Target python version: 2.7 Should work (but not tested aagainst): 3

Installation

pip install brundeckrun

Use

>>> from rundeck.client import Rundeck
>>> rd = Rundeck('rundeck.server.com', api_token='SECRET_API_TOKEN')
>>> rd.list_projects()
[{
    'description': None,
    'name': 'TestProject',
    'resources': {'providerURL': 'http://localhost:8000/resources.xml'},
}]
>>> rd.list_jobs('TestProject')
[{'description': 'Hello World!',
  'group': None,
  'id': 'a6e1e0f7-ad32-4b93-ba2c-9387be06a146',
  'name': 'HelloWorld',
  'project': 'TestProject'}]
>>> rd.run_job('a6e1e0f7-ad32-4b93-ba2c-9387be06a146', argString={'from':'brundeckrun'})
{'argstring': '-from brundeckrun',
 'date-started': datetime.datetime(2013, 7, 11, 18, 4, 24),
 'description': 'Plugin[localexec, nodeStep: true]',
 'href': 'http://rundeck.server.com/execution/follow/123',
 'id': '123',
 'job': None,
 'status': 'running',
 'user': 'brundeckrun'}

Tests

Unit tests

Unit tests are performed via tox.

To install tox and then run the tests:

pip install tox
tox

Integration tests

Note: currently the integrations are not up-to-date and are not under continous integration. Soon though...

Running the tests requires a running Rundeck server (the Rundeck standalone jar works well) and an API token for said Rundeck server.

You'll have to at least set the API token environment variable of RUNDECK_API_TOKEN but there are other environment variables to be aware of. The list is below and can be found at the head of the tests/__init__.py file. They should be fairly self-explanatory (OK, RUNDECK_PROTOCOL might not be self-explanatory... use either 'http' or 'https' there).

.. code-block:: bash

RUNDECK_API_TOKEN
RUNDECK_SERVER
RUNDECK_PORT
RUNDECK_PROTOCOL

Next clone the repo.

.. code-block:: bash

git clone https://github.com/pmatias/brundeckrun

.. note:: activate your virtualenv <http://www.virtualenv.org/en/latest/>_

Then install the requirements and dev requirements.

.. code-block:: bash

pip install -r requirements.txt
pip install -r requirements_dev.txt

Lastly, execute nose tests.

.. code-block:: bash

nosetests

.. _requests: http://docs.python-requests.org/ .. _Read the Docs: http://brundeckrun.readthedocs.org/

Metadata

Release files for brundeckrun 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brundeckrun 0.2.7
File Size Uploaded
brundeckrun-0.2.7.tar.gz 26.3 kB Details

Release files / brundeckrun-0.2.7.tar.gz

Download URL brundeckrun-0.2.7.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9941bdf65ecb45953731eb41bc0bb0f46db18645ea398f4b8afd9dad513e8f27
BLAKE2b-256 checksum
How to use checksums
d8379c74b71a75af5274345f10cdea3ab11fffd46bf2d0ce339b537c7a5a94cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.1

Release history Release notifications | RSS feed

This release

0.2.7 This release

1 release file

0.2.6

1 release file

0.2.5

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page