bflad/knife-rhn

View on GitHub
lib/chef/knife/rhn_systemgroup_list.rb

Summary

Maintainability
A
0 mins
Test Coverage
#
# Author:: Brian Flad (<bflad@wharton.upenn.edu>)
# License:: Apache License, Version 2.0
#

require 'chef/knife/rhn_base'

class Chef
  class Knife
    class RhnSystemgroupList < Knife

      include Knife::RhnBase

      banner "knife rhn systemgroup list (options)"
      category "rhn"

      def run
        $stdout.sync = true

        set_rhn_connection_options

        system_groups = RhnSatellite::Systemgroup.all
        system_groups.sort! {|a,b| a['name'] <=> b['name']}
        system_groups.each do |system_group|
          ui.info "#{system_group['name']}"
        end
      end

    end
  end
end