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.10.0.tar.gz
(16.9 kB
view details)
Built Distribution
File details
Details for the file pyrundeck-0.10.0.tar.gz
.
File metadata
- Download URL: pyrundeck-0.10.0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80b462ffb997cfdc9337e591622c4fa3a4fa7cf22ef4e0f8f4c8a8866fb58716 |
|
MD5 | 98ba785b66a22c7081e07d07f776c7da |
|
BLAKE2b-256 | 371b6ec897f466597068c7cea03fd5dcf064ce2baf7ecec0db3acad2d25b1566 |
File details
Details for the file pyrundeck-0.10.0-py3-none-any.whl
.
File metadata
- Download URL: pyrundeck-0.10.0-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9a18e9fa94a6ea2f10ddd92e2bdc5fb306882a5990c469f7a75a5e5beedda25 |
|
MD5 | cff4ff0b35ac9c081c8d160dd60fca9c |
|
BLAKE2b-256 | 0d7b8cd5907a030995e6098aef0099ba77b46c1ce4d45b0fe008be192e13964c |