methods/ai_server.rb
# Delecte a service
# This will also delete all the clients under it
Delecte a service
This will also delete all the clients under it
Delecte a service This will also delete all the clients under it
def unconfigure_ai_server(options)
  if options['host-os-name'].to_s.match(/SunOS/)
    service_base_name   = get_service_base_name(options['service'])
    smf_install_service = "svc:/application/pkg/server:"+service_base_name
    smf_service_test    = %x[svcs -a |grep "#{smf_install_service}']
    if smf_service_test.match(/pkg/)
      unconfigure_ai_pkg_repo(smf_install_service)
    end
    if not options['service'].to_s.match(/i386|sparc/)
      ['i386","sparc'].each do |sys_arch|
        service_test = %x[installadm list |grep #{options['service']} |grep #{sys_arch}]
        if service_test.match(/[a-z,A-Z,0-9]/)
          message = "Information:\tDeleting service "+options['service']+"_"+sys_arch+" and all clients under it"
          command = "installadm delete-service "+options['service']+"_"+sys_arch+" -r -y"
          execute_command(options,message,command)
        end
      end
    else
      service_test=%x[installadm list |grep #{options['service']}]
      if service_test.match(/[a-z,A-Z,0-9]/)
        message = "Information:\tDeleting service "+options['service']+" and all clients under it"
        command = "installadm delete-service "+options['service']+" -r -y"
        execute_command(options,message,command)
      end
    end
    file="/etc/inet/dhcpd4.conf"
    if File.exist?(file)
      bu_file = file+".preai"
      message = "Information:\tRestoring file "+bu_file+" to "+file
      command = "cp #{bu_file} #{file}"
      execute_command(options,message,command)
      smf_install_service = "svc:/network/dhcp/server:ipv4"
      refresh_smf_service(smf_install_service)
    end
    remove_apache_proxy(options)
    repo_dir = options['baserepodir']+"/"+service_base_name
    test_dir = repo_dir+"/publisher"
    if File.directory?(test_dir) and options['yes'] == true
      destroy_zfs_fs(repo_dir)
    end
  else
    remove_apache_proxy(options)
  end
  return
end
def unconfigure_ai_server ( options ) if options [ 'host-os-name' ] . to_s . match ( / SunOS / ) service_base_name = get_service_base_name ( options [ 'service' ] ) smf_install_service = "svc:/application/pkg/server:" + service_base_name smf_service_test = %x[ svcs -a |grep " #{ smf_install_service } ' ] if smf_service_test . match ( / pkg / ) unconfigure_ai_pkg_repo ( smf_install_service ) end if not options [ 'service' ] . to_s . match ( / i386|sparc / ) [ 'i386","sparc' ] . each do | sys_arch | service_test = %x[ installadm list |grep  #{ options [ 'service' ] }  |grep  #{ sys_arch } ] if service_test . match ( / [a-z,A-Z,0-9] / ) message = "Information:\tDeleting service " + options [ 'service' ] + "_" + sys_arch + " and all clients under it" command = "installadm delete-service " + options [ 'service' ] + "_" + sys_arch + " -r -y" execute_command ( options , message , command ) end end else service_test = %x[ installadm list |grep  #{ options [ 'service' ] } ] if service_test . match ( / [a-z,A-Z,0-9] / ) message = "Information:\tDeleting service " + options [ 'service' ] + " and all clients under it" command = "installadm delete-service " + options [ 'service' ] + " -r -y" execute_command ( options , message , command ) end end file = "/etc/inet/dhcpd4.conf" if File . exist? ( file ) bu_file = file + ".preai" message = "Information:\tRestoring file " + bu_file + " to " + file command = "cp #{bu_file} #{file}" execute_command ( options , message , command ) smf_install_service = "svc:/network/dhcp/server:ipv4" refresh_smf_service ( smf_install_service ) end remove_apache_proxy ( options ) repo_dir = options [ 'baserepodir' ] + "/" + service_base_name test_dir = repo_dir + "/publisher" if File . directory? ( test_dir ) and options [ 'yes' ] == true destroy_zfs_fs ( repo_dir ) end else remove_apache_proxy ( options ) end return end
Delecte a service
This will also delete all the clients under it
Delecte a service This will also delete all the clients under it
options
<not_specific>