Code Monkey home page Code Monkey logo

Comments (2)

biemond avatar biemond commented on September 20, 2024

Thanks for reporting.

Strange it should work because patch 21555660 should be part of 21520444 or be inside the zip. So will it try to apply the patch for the 2nd time when you run puppet again. If so then sub patchid 21555660 is not correct.
and rollback should work for only that patch 21555660 and not for the others.

Yeah, rollback of a bundle is a problem because I use opatch lsinventory to check if the patch is applied else it will do it on every puppet run.
and bundle patches are not registered in the inventory only its sub patches. Maybe we need to use an array of all the included patches as subpatch id and use that for the rollback.

thanks Edwin

from biemond-oradb.

anthonyman avatar anthonyman commented on September 20, 2024

I guess the issue here is that patch_id is used when opatch rollback is done. However, bundle_sub_patch_id should be used when bundle_sub_patch_id exists.

def opatch(action)
user = resource[:os_user]
patchName = resource[:patch_id]
oracle_product_home_dir = resource[:oracle_product_home_dir]
extracted_patch_dir = resource[:extracted_patch_dir]
ocmrf_file = resource[:ocmrf_file]
opatch_auto = resource[:opatch_auto]
use_opatchauto_utility = resource[:use_opatchauto_utility]

Puppet.debug "opatch auto result: #{opatch_auto}"

unless ocmrf_file.nil?
  ocmrf = ' -ocmrf ' + ocmrf_file
else
  ocmrf = ''
end

if opatch_auto == false
  if action == :present
    command = "#{oracle_product_home_dir}/OPatch/opatch apply -silent #{ocmrf} -oh #{oracle_product_home_dir} #{extracted_patch_dir}"
  else
    command = "#{oracle_product_home_dir}/OPatch/opatch rollback -id #{patchName} -silent -oh #{oracle_product_home_dir}"
  end
else
  if use_opatchauto_utility == false
    if action == :present
      command = "#{oracle_product_home_dir}/OPatch/opatch auto #{extracted_patch_dir} #{ocmrf} -oh #{oracle_product_home_dir}"
    else
      command = "#{oracle_product_home_dir}/OPatch/opatch auto -rollback #{extracted_patch_dir} #{ocmrf} -oh #{oracle_product_home_dir}"
    end
  else
    if action == :present
      command = "#{oracle_product_home_dir}/OPatch/opatchauto apply #{extracted_patch_dir} #{ocmrf} -oh #{oracle_product_home_dir}"
    else
      command = "#{oracle_product_home_dir}/OPatch/opatchauto rollback #{extracted_patch_dir} #{ocmrf} -oh #{oracle_product_home_dir}"
    end
  end

It works fine for opatch_status query because bundle_sub_patch_id is used.

def opatch_status
user = resource[:os_user]
patchName = resource[:patch_id]
oracle_product_home_dir = resource[:oracle_product_home_dir]
orainst_dir = resource[:orainst_dir]
bundle_sub_patch_id = resource[:bundle_sub_patch_id]
# opatch_auto = resource[:opatch_auto]

unless bundle_sub_patch_id.nil?

* patchId = bundle_sub_patch_id*
else
patchId = patchName
end

Puppet.info "search for patchid #{patchId}"

command  = oracle_product_home_dir + '/OPatch/opatch lsinventory -patch_id -oh ' + oracle_product_home_dir + ' -invPtrLoc ' + orainst_dir + '/oraInst.loc'
Puppet.info "opatch_status for patch #{patchName} command: #{command}"

output = `su - #{user} -c '#{command}'`
Puppet.debug "#{output}"
# output = execute command, :failonfail => true ,:uid => user
output.each_line do |li|
  opatch = li[5, li.index(':') - 5].strip + ';' if (li['Patch'] and li[': applied on'])
  unless opatch.nil?
    Puppet.debug "line #{opatch}"
    if opatch.include? patchId
      Puppet.debug 'found patch'
      return patchId
    end
  end
end
'NotFound'

end

from biemond-oradb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.