Class: Chef::Knife::RhnSystemgroupInactive

Inherits:
Chef::Knife
  • Object
show all
Includes:
RhnBase
Defined in:
lib/chef/knife/rhn_systemgroup_inactive.rb

Defined Under Namespace

Modules: Systemgroup

Instance Method Summary collapse

Methods included from RhnBase

#get_config, #get_satellite_system, included, #set_rhn_connection_options

Instance Method Details

#runObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/chef/knife/rhn_systemgroup_inactive.rb', line 32

def run
  $stdout.sync = true
  
  group = name_args.first

  if group.nil?
    ui.fatal "You need a systemgroup name!"
    show_usage
    exit 1
  end

  set_rhn_connection_options

  RhnSatellite::Systemgroup.extend(Systemgroup)
  system_ids = RhnSatellite::Systemgroup.inactive_systems(group,get_config(:days))
  systems = []
  system_ids.each do |system_id|
    systems << RhnSatellite::System.details(system_id)
  end
  systems.sort! {|a,b| a['profile_name'] <=> b['profile_name']}
  systems.each do |system|
    ui.info "#{system['id']},#{system['profile_name']}"
  end
end