Class: Chef::Knife::RhnSystemDetails
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::RhnSystemDetails
- Includes:
- RhnBase
- Defined in:
- lib/chef/knife/rhn_system_details.rb
Instance Method Summary collapse
Methods included from RhnBase
#get_config, #get_satellite_system, included, #set_rhn_connection_options
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/chef/knife/rhn_system_details.rb', line 17 def run $stdout.sync = true system = name_args.first if system.nil? ui.fatal "You need a system name!" show_usage exit 1 end satellite_system = get_satellite_system(system) details = RhnSatellite::System.details(satellite_system['id']) ui.info "#{ui.color "ID", :cyan}: #{details['id']}" ui.info "#{ui.color "Profile Name", :cyan}: #{details['profile_name']}" ui.info "#{ui.color "Hostname", :cyan}: #{details['hostname']}" ui.info "#{ui.color "Release", :cyan}: #{details['release']}" ui.info "#{ui.color "Auto Update", :cyan}: #{details['auto_update'] ? "Enabled" : "Disabled"}" ui.info "#{ui.color "Locked", :cyan}: #{details['lock_status'] ? "Enabled" : "Disabled"}" ui.info "#{ui.color "RHN URL", :cyan}: https://#{get_config(:rhn_hostname)}/rhn/systems/details/Overview.do?sid=#{details['id']}" ui.info "#{ui.color "Description", :cyan}:" ui.info "#{details['description']}" ui.info "#{ui.color "Last Check-In", :cyan}: #{satellite_system['last_checkin'].to_time}" base_channel = RhnSatellite::System.subscribed_base_channel(satellite_system['id']) child_channels = RhnSatellite::System.subscribed_child_channels(satellite_system['id']) ui.info "#{ui.color "Subscribed Channels", :cyan}:" ui.info "#{ui.color base_channel['name'], :bold}" child_channels.each do |child_channel| ui.info " |_ #{child_channel['name']}" end relevant_erratas = RhnSatellite::System.relevant_erratas(satellite_system['id']) critical_errata = relevant_erratas.select{|e| e["advisory_type"] == "Security Advisory"}.length ui.info "#{ui.color "Critical Errata", :cyan}: #{critical_errata}" ui.info "#{ui.color "Non-Critical Errata", :cyan}: #{relevant_erratas.length - critical_errata}" upgradable_packages = RhnSatellite::System.latest_upgradable_packages(satellite_system['id']) ui.info "#{ui.color "Upgradable Packages", :cyan}: #{upgradable_packages.length}" end |