Giter Site home page Giter Site logo

pyrundeck's Introduction

๐Ÿšฎ Archived!

If you're interested in maintaining this package please get in touch with me at:

https://github.com/pschmitt/contact/issues/new

Rundeck REST API client

PyPI PyPI - Downloads PyPI - License Python Lint

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

pyrundeck's People

Contributors

antoine-auffret avatar braxtonlowers avatar cerih avatar dependabot[bot] avatar emersonyh avatar geraldhansen avatar jon-rtr avatar msilva14 avatar ordenador avatar pschmitt avatar pyther avatar pyup-bot avatar vaxvms avatar wpoely86 avatar xavier8854 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pyrundeck's Issues

Release 0.9.6 contains forced debug loglevel

Hi there,
you had an pull request for issue #17, which got merged. But due to the fact that there is no new release, the version which is installed via pip3 is still using the old faulty code.

Please make a new minor release. ๐Ÿ˜…

Best regards
Shuro

Exception ModuleNotFoundError Error so python3.4 doesn't work fine

Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/pyrundeck/rundeck.py", line 12, in
from urlparse import urljoin
ImportError: No module named 'urlparse'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.4/site-packages/pyrundeck/init.py", line 2, in
from .rundeck import Rundeck
File "/usr/lib/python3.4/site-packages/pyrundeck/rundeck.py", line 13, in
except ModuleNotFoundError:
NameError: name 'ModuleNotFoundError' is not defined

Method to fetch project configuration

Hi,
Github won't let me open a MR, so here is the code snippet to get all the key/value pairs for a project's configuration :

    def get_project_config(self, project_name, format="xml"):
        url = "{}/project/{}/config".format(self.API_URL, project_name)
        return self.__get(url, format=format)

Cheers,
Xavier

Misbehaviour in stripping URLs

I have an instance whose URL is eg. https://myrundeeck.tld/instancename
When I try to connect, I get

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://myrundeck.tld/api/32/projects

This error is as expected, since the part /instancename/ has been removed from the URL.
Thanks
Regards
Xavier

running the code

when im running the original code, without modifications, it just stay freeze.

Methods for gathering Job Definition

Hello.
I'm using the module in order to read the configured jobs in Rundeck, but there is a need to get the job's definition in order to validate some dynamic calls against the configured parameters.

So, I'd like to know how I could do to share with you the methods I created ( I cloned the Repository and I added get_job_def returning xml/yaml and get_job_meta returning xml ), to be able to use them and if possible to share those small developments too.

Thanks in advance for your answer.

best regards

Support for file uploads

Is this project open to a pull request for wrapping the file upload API of rundeck? The rundeck implementation can be found here. It looks like we'd just need to add a parameter to __post and __request to change the Content-type to octet/stream and add a data payload to the options kwarg.

Code documentation

I am using the package and I am having issues correctly assessing all the possibilities the class has. Could you please add a couple of documentation strings within the definition to access the options available.
example: "status" filtering.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.