Giter VIP home page Giter VIP logo

errata_client's Introduction

ErrataClient

Gem Version Build Status Code Climate Coverage Status Dependency Status

ErrataClient is a client interface to the RedHat Errata Tool

Installation

Add this line to your application's Gemfile:

gem 'errata_client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install errata_client

Pre-requisite

First configure Kerberos authentication to the Errata tool server and get a Kerberos ticket via kinit for the user account that will be using the ErrataClient.

Usage

  require 'errata_client'
  
  # Getting an individual advisory
  advisory = ErrataClient::Advisory.find(:url => "https://errata_tool_url", :id => 13391).first
  puts "Advisory #{advisory.id} Synopsis: #{advisory.synopsis}"
  
  # Instead of passing the url in each call, you can configure it as follows and then
  # call the methods without it:
  ErrataClient::Advisory.config("https://errata_tool_url")

  advisory = ErrataClient::Advisory.find(:id => 13391).first
  puts "Advisory Id: #{advisory.id}"
  puts "Status:      #{advisory.status}"
  puts "Attributes:  #{advisory.attribute_names}"
  puts "Content:     #{advisory.attributes}"
  
  puts "Related Bugs: #{advisory.bugs.collect(&:id)}"
  
  # Getting details about the related bugs
  advisory.bugs.each do |bug|
    puts
    puts "bug id:          #{bug.id}"
    puts "short desc:      #{bug.short_desc}"
    puts "severity:        #{bug.bug_severity}"
    puts "status:          #{bug.bug_status}"
    puts "release notes:   #{bug.release_notes}"
  end
  
  puts "Related Builds: #{advisory.builds.collect(&:nvr)}"
    
  # Getting details about the related builds
  advisory.builds.each do |build|
    puts
    puts "build:           #{build.nvr}"
    puts "product version: #{build.product_version}"
    puts "classifications: #{build.classifications}"
    puts "architectures:   #{build.architectures}"
    puts "rpms:            #{build.rpms}"
    puts "details:         #{build.nvr_data}"
  end
  
  # Getting related RPM Diff Runs
  advisory.rpmdiff_runs.each do |rpmdiff_run|
    puts 
    puts "run_id:       #{rpmdiff_run.run_id}"
    puts "package name: #{rpmdiff_run.package_name}"
    puts "package path: #{rpmdiff_run.package_path}"
  end
  
  # Getting related TPS Jobs
  advisory.tps_jobs.each do |tps_job|
    puts
    puts "job_id:  #{tps_job.job_id}"
    puts "link:    #{tps_job.link}"
  end
  
  # Getting multiple advisories
  advisories = ErrataClient::Advisory.find(:id => [17571, 17572, 17573])
  
  # Getting all advisories
  ErrataClient::Advisory.all.each do |adv|
    puts "id: #{adv.id}  synopsis: #{adv.synopsis}"
  end

  # Getting advisories a Bug belongs to
  bug_id = 100234
  advs   = ErrataClient::Advisory.advisories(:id => bug_id)
  puts "Advisories Bug #{bug_id} belongs to: #{advs.collect(&:id)}"

  # Advisory Updates - Updating the Status
  adv = ErrataClient::Advisory.find(:id => 16371)
  adv.status = "QE"

  # Or the following with an optional comment
  adv.change_status(:new_state => "QE", :comment => "Reason for Change")

  # Adding a Bug to the Advisory
  adv.add_bug(199999)

  # Removing a Bug from the Advisory
  adv.remove_bug(199999)

  # Adding a Build to the Advisory
  adv.add_build(:nvr => "cfme-5.2.3.2-1.el6cf", :product_version => "RHEL-6.CFME-5")

  # Removing a Build from an Advisory
  adv.remove_build(:nvr => "cfme-5.2.3.2-1.el6cf")

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

errata_client's People

Contributors

abellotti avatar chessbyte avatar fryguy avatar jvlcek avatar

Watchers

 avatar  avatar

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.