Class: Chef::Knife::RhnSystemgroupRemove

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

Instance Method Summary collapse

Methods included from RhnBase

#get_config, #get_satellite_system, included, #set_rhn_connection_options

Instance Method Details

#runObject



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
# File 'lib/chef/knife/rhn_systemgroup_remove.rb', line 17

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

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

  system = name_args[1]

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

  set_rhn_connection_options

  satellite_system = get_satellite_system(system)
  RhnSatellite::Systemgroup.remove_systems(group,[satellite_system['id']])
  ui.info "Removed #{system} (ID: #{satellite_system['id']}) from RHN systemgroup: #{group}"
end