Python REST API client for Rundeck 2.6+
Project description
Rundeck REST API client
This is a Python REST API client for Rundeck 2.6+
Example
from pyrundeck import Rundeck
rundeck = Rundeck('http://rundeck-url',
token='sometoken',
api_version=32, # this is not mandatory, it defaults to 18
)
run = rundeck.run_job(RUNDECK_JOB_ID, options={'option1': 'foo'})
running_jobs = rundeck.get_executions_for_job(job_id=RUNDECK_JOB_ID, status='running')
for job in running_jobs['executions']:
print("%s is running" % job['id'])
A token can be generated in the 'profile' page of Rundeck. Alternatively you can login with a username and password.
Example using the file upload option
from pyrundeck import rundeck
rd = Rundeck(
rundeck_url,
username=username,
password=password,
verify=False,
api_version=19 # Required for file upload option
)
# Use the file_key returned in the response to reference the file when running a job
# Per documentation at https://docs.rundeck.com/docs/api/rundeck-api.html#upload-a-file-for-a-job-option
response = rd.upload_file(RUNDECK_JOB_ID, OPTION_NAME, FILE_NAME_STRING_OR_IOFILEWRAPPER)
file_key = response['options'][OPTION_NAME]
rd.run_job(RUNDECK_JOB_ID, options={OPTION_NAME: file_key})
See also
LICENSE
GPL3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyrundeck-0.9.11.tar.gz
(4.6 kB
view hashes)
Built Distribution
pyrundeck-0.9.11-py3-none-any.whl
(17.1 kB
view hashes)
Close
Hashes for pyrundeck-0.9.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55a05994632ea25d71befd85f7b28665da7e6bf2eaef5289112db76682094879 |
|
MD5 | eedf50f7dfd1fdca20da52635d3728d7 |
|
BLAKE2b-256 | e2db624db90008b81c51988015a7cfbd36563cd4dac9070c9e8d7ec74f115920 |