Git Product home page Git Product logo

orchestrator_client-ruby's Introduction

OrchestratorClient

A simple client for interacting with the Orchestration Services API in Puppet Enterprise Puppet orchestration API

Compatibility

Currently, this client supports the "V1" endpoints shipped as part of Puppet Enterprise 2016.2 - 2019.8.4.

Installation

gem install orchestrator_client

Usage

Requires a token with 'Orchestration' permissions. By default the token is expected to be at ~/.puppetlabs/token which is the default location used by puppet-access when creating token.

initialization Settings

  • service-url [required] - Base URL for the location of the Orchestrator API service
  • cacert [required] - Path to the CA certificate file needed to verify the SSL connection to the API.
  • token-file- Path to a file with the RBAC token in it (defaults to ~/.puppetlabs/token)
  • token - Pass directly the RBAC token, if specified the token will be used instead of a token from file.
  • User-Agent- Set User-Agent header for HTTP requests. Defaults to OrchestratorRubyClient/[VERSION]
  • job-poll-interval- Set the default amount of time to sleep when polling in Orchestrator::Job#wait and #each_event
  • job-poll-timeout- Set the default maximum amount of time to wait in Orchestrator::Job#wait
  • read-timeout - The time to wait before raising a Timeout exception when making HTTP requests.

Example

require 'orchestrator_client'

# Create a new client
# Requires at least a server name and path to the CA certificate

client = OrchestratorClient.new({
                                'service-url' => 'https://orchestrator.example.lan:8143',
                                'cacert'     => '/path/to/cert'
                              })

## Access endpoints through the client object

# Get details on all known jobs
result = client.jobs.all

# Get details on Individual jobs (job "5" in this example)
client.jobs.details(5)

# Perform an orchestrator deployment
new_job_details = client.command.deploy('production', {'noop' => true })

Tests

bundle install
bundle exec rspec

Issues & Contributions

File issues or feature requests using GitHub issues.

If you are interested in contributing to this project, please see the Contribution Guidelines

Releasing

Use the https://cinext-jenkinsmaster-sre-prod-1.delivery.puppetlabs.net/job/qe_orchestrator-client-ruby_init-multijob_master/ job to release. This pipeline will update the version file, create the tag you specify, and push release to rubygems.

License

See LICENSE.

orchestrator_client-ruby's People

Contributors

adreyer avatar bastelfreak avatar beechtom avatar donoghuc avatar ipcrm avatar lucywyman avatar mikaelsmith avatar nicklewis avatar puppetlabs-jenkins avatar seanmil avatar smortex avatar trlinkin avatar

Stargazers

 avatar  avatar

Watchers

 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  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  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

orchestrator_client-ruby's Issues

orchestrator_client-0.6.1 breaks bolt with Ruby 3.1

Describe the Bug

FreeBSD recently switched from Ruby 3.0 to 3.1 as default FreeBSD version. All packages where rebuild with Ruby 3.1, but after updating them, bolt fails to run:

romain@zappy ~ % bolt 
/usr/local/lib/ruby/site_ruby/3.1/rubygems/specification.rb:2287:in `raise_if_conflicts': Unable to activate puppet_forge-4.0.0, because faraday-1.10.3 conflicts with faraday (~> 2.0) (Gem::ConflictError)
	from /usr/local/lib/ruby/site_ruby/3.1/rubygems/specification.rb:1418:in `activate'
	from /usr/local/lib/ruby/site_ruby/3.1/rubygems/specification.rb:1456:in `block in activate_dependencies'
	from /usr/local/lib/ruby/site_ruby/3.1/rubygems/specification.rb:1438:in `each'
	from /usr/local/lib/ruby/site_ruby/3.1/rubygems/specification.rb:1438:in `activate_dependencies'
	from /usr/local/lib/ruby/site_ruby/3.1/rubygems/specification.rb:1420:in `activate'
	from /usr/local/lib/ruby/site_ruby/3.1/rubygems/specification.rb:1456:in `block in activate_dependencies'
	from /usr/local/lib/ruby/site_ruby/3.1/rubygems/specification.rb:1438:in `each'
	from /usr/local/lib/ruby/site_ruby/3.1/rubygems/specification.rb:1438:in `activate_dependencies'
	from /usr/local/lib/ruby/site_ruby/3.1/rubygems/specification.rb:1420:in `activate'
	from /usr/local/lib/ruby/site_ruby/3.1/rubygems.rb:282:in `block in activate_bin_path'
	from /usr/local/lib/ruby/site_ruby/3.1/rubygems.rb:281:in `synchronize'
	from /usr/local/lib/ruby/site_ruby/3.1/rubygems.rb:281:in `activate_bin_path'
	from /usr/local/bin/bolt:25:in `<main>'

Expected Behavior

Bolt should work as before.

Steps to Reproduce

On FreeBSD:

pkg install bolt

Environment

  • Version 0.6.1
  • Platform FreeBSD 13.2-RC3

Additional Context

Bolt indirectly depends on two different versions of faraday:

rubygem-bolt-3.26.2
|-> rubygem-r10k-3.15.3_1
|   `-> rubygem-puppet_forge-4.0.0 ([faraday](https://rubygems.org/gems/faraday) ~> 2.0)
|       `-> rubygem-faraday-2.7.4
`-> rubygem-orchestrator_client-0.6.1
    `-> rubygem-faraday1-1.10.3 ([faraday](https://rubygems.org/gems/faraday) ~> 1.4)

Ruby 3.0 seems to cope with this, but 3.1 complains.

Adjusting orchestrator_client-0.6.1.gemspec and changing the version requirement for faraday from ~> 1.4 to ~> 2.0 seems to workaround the issue.

I'll open a PR tomorrow to bump the version requirement.

Idle and read timeouts should be configurable

Use Case

CD4PE uses orchestrator_client as part of bolt to run jobs through the PE orchestrator. Under heavy load, these connections can time out. Unfortunately, the connection and read timeouts do not appear to be configurable, so the CD4PE jobs simply fail and users have no way to address the issue.

Describe the Solution You Would Like

Make these timeouts configurable. Otherwise, users are forced to manually update the code to work around issues with busy servers. https://github.com/puppetlabs/orchestrator_client-ruby/blob/0.4.3/lib/orchestrator_client.rb#L35 is the idle timeout. Adding http.read_timeout here will customize the read timeout from the default included in the Faraday gem of 60 seconds. Wiring up overrides to these values that can be populated by bolt.yaml entries would be ideal.

Describe Alternatives You've Considered

Users can change this code manually to get the desired effect. Unfortunately, in the case of CD4PE, this is shipped as part of the container, and thus resets on each container restart. So the user has to re-apply the patch each time. It would be better as just part of the application.

puppet tasks support

Looks like puppet tasks are not yet supported, though.

Any plans to add that?

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.