Skip to content

Instantly share code, notes, and snippets.

@mccun934
Created April 25, 2018 13:56
Show Gist options
  • Save mccun934/9eb9881bd903c724d5ddf32f64a1fec5 to your computer and use it in GitHub Desktop.
Save mccun934/9eb9881bd903c724d5ddf32f64a1fec5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'yaml'
require 'oauth'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
katello_config = YAML.load_file('/etc/foreman/plugins/katello.yaml')
consumer_key = katello_config[:katello][:candlepin][:oauth_key]
consumer_secret = katello_config[:katello][:candlepin][:oauth_secret]
consumer = OAuth::Consumer.new(
consumer_key,
consumer_secret,
:site => "https://localhost:8443",
:request_token_path => "",
:authorize_path => "",
:access_token_path => "",
:http_method => :get
)
oauth_access = OAuth::AccessToken.new consumer
puts oauth_access.get("/candlepin/admin/queues").body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment