libraries/patch_mgmt.rb
# -----------------------------------------------------------------
# Compute DLTarget suma parameter
#
#    raise InvalidLocationProperty in case of error
# -----------------------------------------------------------------
Compute DLTarget suma parameter
raise InvalidLocationProperty in case of error
Compute DLTarget suma parameter raise InvalidLocationProperty in case of error
def compute_dl_target(location, lpp_source, niminfo)
      return "/usr/sys/inst.images/#{lpp_source}" if location.nil? || location.empty?
      location.chomp!('\/')
      if location.start_with?('/') 
        dl_target = "#{location}/#{lpp_source}"
        unless niminfo['nim']['lpp_sources'].fetch(lpp_source, {}).fetch('location', nil).nil?
          log_debug("Found lpp source '#{lpp_source}' location")
          unless niminfo['nim']['lpp_sources'][lpp_source]['location'] =~ /^#{dl_target}/
            raise InvalidLocationProperty, 'Error: lpp source location mismatch'
          end
        end
      else 
        begin
          dl_target = niminfo['nim']['lpp_sources'].fetch(location).fetch('location')
          log_debug("Discover '#{location}' lpp source's location: '#{dl_target}'")
        rescue KeyError
          raise InvalidLocationProperty, "Error: cannot find lpp_source '#{location}' from nim info"
        end
      end
      dl_target
    end
def compute_dl_target ( location , lpp_source , niminfo ) return "/usr/sys/inst.images/#{lpp_source}" if location . nil? || location . empty? location . chomp! ( '\/' ) if location . start_with? ( '/' ) dl_target = "#{location}/#{lpp_source}" unless niminfo [ 'nim' ] [ 'lpp_sources' ] . fetch ( lpp_source , { } ) . fetch ( 'location' , nil ) . nil? log_debug ( "Found lpp source '#{lpp_source}' location" ) unless niminfo [ 'nim' ] [ 'lpp_sources' ] [ lpp_source ] [ 'location' ] =~ / ^ #{ dl_target } / raise InvalidLocationProperty , 'Error: lpp source location mismatch' end end else begin dl_target = niminfo [ 'nim' ] [ 'lpp_sources' ] . fetch ( location ) . fetch ( 'location' ) log_debug ( "Discover '#{location}' lpp source's location: '#{dl_target}'" ) rescue KeyError raise InvalidLocationProperty , "Error: cannot find lpp_source '#{location}' from nim info" end end dl_target end
Compute DLTarget suma parameter
raise InvalidLocationProperty in case of error
Compute DLTarget suma parameter raise InvalidLocationProperty in case of error
# location is a directory # check if DLTarget match the one in lpp_source # location is a lpp_source
location
lpp_source
niminfo