Module: Puppet_X::EnterpriseModules::WebLogic::Facts
- Defined in:
- lib/puppet_x/enterprisemodules/weblogic/facts.rb
Overview
The puppet facts.
Instance Method Summary collapse
- #adapters(root) ⇒ Object
- #clusters(root) ⇒ Object
- #coherence_clusters(root) ⇒ Object
- #deployments(root) ⇒ Object
-
#domains_hash ⇒ Object
read weblogic domain.
- #execute(command, user) ⇒ Object
- #filestores(root) ⇒ Object
- #first_non_root_file(dir) ⇒ Object
- #get_homes(path) ⇒ Object
- #get_installed_features(oracle_product_home_dir) ⇒ Object
- #get_installed_patches(oracle_home) ⇒ Object
- #get_opatch_version(name) ⇒ Object
- #get_ora_inventory_path ⇒ Object
- #get_orainst_loc ⇒ Object
- #get_running_domains(home) ⇒ Object
- #get_version(home) ⇒ Object
- #jdbc(root) ⇒ Object
- #jdbcstores(root) ⇒ Object
- #jmsmodules(root, domain_path) ⇒ Object
- #jmsservers(root) ⇒ Object
- #libraries(root) ⇒ Object
- #oimconfigured?(root) ⇒ Boolean
- #opatch_installed?(weblogic_home) ⇒ Boolean
- #patches_in_home(oracle_product_home_dir, os_user) ⇒ Object
- #safagents(root) ⇒ Object
- #server_templates(root) ⇒ Object
- #servers(root) ⇒ Object
- #targets(root, type) ⇒ Object
- #user_for_file(home) ⇒ Object
Instance Method Details
#adapters(root) ⇒ Object
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 253 def adapters(root) file_adapter_plan = [] file_adapter_plan_entries = [] root.elements.each("app-deployment[name = 'FileAdapter']") do |apps| next if apps.elements['plan-path'].nil? plan = if apps.elements['plan-dir'].attributes['xsi:nil'] == 'true' apps.elements['plan-path'].text else "#{apps.elements['plan-dir'].text}/#{apps.elements['plan-path'].text}" end Puppet.debug "wls_install_homes.rb found file_adapter_plan '#{plan}'" file_adapter_plan << plan next unless File.exist?(plan) subfile = File.read(file_adapter_plan) subdoc = REXML::Document.new subfile planroot = subdoc.root planroot.elements['variable-definition'].elements.each('variable') do |eis| entry = eis.elements['value'].text if entry.include? 'eis' Puppet.debug "wls_install_homes.rb found file_adapter_entry '#{entry}'" file_adapter_plan_entries << entry end end end db_adapter_plan = [] db_adapter_plan_entries = [] root.elements.each("app-deployment[name = 'DbAdapter']") do |apps| next if apps.elements['plan-path'].nil? plan = if apps.elements['plan-dir'].attributes['xsi:nil'] == 'true' apps.elements['plan-path'].text else "#{apps.elements['plan-dir'].text}/#{apps.elements['plan-path'].text}" end Puppet.debug "wls_install_homes.rb found db_adapter_plan '#{plan}'" db_adapter_plan << plan next unless File.exist?(plan) subfile = File.read(db_adapter_plan) subdoc = REXML::Document.new subfile planroot = subdoc.root planroot.elements['variable-definition'].elements.each('variable') do |eis| entry = eis.elements['value'].text if !entry.nil? && entry.include?('eis') Puppet.debug "wls_install_homes.rb found db_adapter_entry '#{entry}'" db_adapter_plan_entries << entry end end end aq_adapter_plan = [] aq_adapter_plan_entries = [] root.elements.each("app-deployment[name = 'AqAdapter']") do |apps| next if apps.elements['plan-path'].nil? plan = if apps.elements['plan-dir'].attributes['xsi:nil'] == 'true' apps.elements['plan-path'].text else "#{apps.elements['plan-dir'].text}/#{apps.elements['plan-path'].text}" end Puppet.debug "wls_install_homes.rb found aq_adapter_plan '#{plan}'" aq_adapter_plan << plan next unless File.exist?(plan) subfile = File.read(aq_adapter_plan) subdoc = REXML::Document.new subfile planroot = subdoc.root planroot.elements['variable-definition'].elements.each('variable') do |eis| entry = eis.elements['value'].text if !entry.nil? && entry.include?('eis') Puppet.debug "wls_install_homes.rb found aq_adapter_entry '#{entry}'" aq_adapter_plan_entries << entry end end end jms_adapter_plan = [] jms_adapter_plan_entries = [] root.elements.each("app-deployment[name = 'JmsAdapter']") do |apps| next if apps.elements['plan-path'].nil? plan = if apps.elements['plan-dir'].attributes['xsi:nil'] == 'true' apps.elements['plan-path'].text else "#{apps.elements['plan-dir'].text}/#{apps.elements['plan-path'].text}" end Puppet.debug "wls_install_homes.rb found jms_adapter_plan '#{plan}'" jms_adapter_plan << plan next unless File.exist?(plan) subfile = File.read(jms_adapter_plan) subdoc = REXML::Document.new subfile planroot = subdoc.root planroot.elements['variable-definition'].elements.each('variable') do |eis| entry = eis.elements['value'].text if !entry.nil? && entry.include?('eis') Puppet.debug "wls_install_homes.rb found jms_adapter_entry '#{entry}'" jms_adapter_plan_entries << entry end end end ftp_adapter_plan = [] ftp_adapter_plan_entries = [] root.elements.each("app-deployment[name = 'FtpAdapter']") do |apps| next if apps.elements['plan-path'].nil? plan = if apps.elements['plan-dir'].attributes['xsi:nil'] == 'true' apps.elements['plan-path'].text else "#{apps.elements['plan-dir'].text}/#{apps.elements['plan-path'].text}" end Puppet.debug "wls_install_homes.rb found ftp_adapter_plan '#{plan}'" ftp_adapter_plan << plan next unless File.exist?(ftp_adapter_plan) subfile = File.read(ftp_adapter_plan) subdoc = REXML::Document.new subfile planroot = subdoc.root planroot.elements['variable-definition'].elements.each('variable') do |eis| entry = eis.elements['value'].text if !entry.nil? && entry.include?('eis') Puppet.debug "wls_install_homes.rb found ftp_adapter_entry '#{entry}'" ftp_adapter_plan_entries << entry end end end [file_adapter_plan, file_adapter_plan_entries, db_adapter_plan, db_adapter_plan_entries, aq_adapter_plan, aq_adapter_plan_entries, jms_adapter_plan, jms_adapter_plan_entries, ftp_adapter_plan, ftp_adapter_plan_entries] end |
#clusters(root) ⇒ Object
194 195 196 197 198 199 200 201 202 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 194 def clusters(root) clusters = [] root.elements.each('cluster') do |cluster| name = cluster.elements['name'].text Puppet.debug "wls_install_homes.rb found cluster '#{name}'" clusters << name end clusters end |
#coherence_clusters(root) ⇒ Object
204 205 206 207 208 209 210 211 212 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 204 def coherence_clusters(root) coherence_clusters = [] root.elements.each('coherence-cluster-system-resource') do |coherence| name = coherence.elements['name'].text Puppet.debug "wls_install_homes.rb found coherence cluster '#{name}'" coherence_clusters << name end coherence_clusters end |
#deployments(root) ⇒ Object
214 215 216 217 218 219 220 221 222 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 214 def deployments(root) deployments = [] root.elements.each("app-deployment[module-type = 'ear']") do |apps| ear_name = apps.elements['name'].text Puppet.debug "wls_install_homes.rb found deployment '#{ear_name}'" deployments << ear_name end deployments end |
#domains_hash ⇒ Object
read weblogic domain
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 563 def domains_hash domainfile = '/etc/wls_domains.dat' unless File.exist?(domainfile) Puppet.debug "wls_install_homes.rb #{domainfile} not found" return {} end file = File.read(domainfile) domain_array = file.split.map { |domain| domain.split(':') }.flatten domains = Hash[*domain_array.flatten] domain_listing = domains.keys.collect do |domain_name| path = domains[domain_name] Puppet.debug "wls_install_homes.rb found domain '#{domain_name}' path '#{path}'" if File.exist?("#{path}/config/config.xml") domain_config_file = "#{path}/config/config.xml" elsif File.directory?("#{path}/config") return { domain_name => { 'path' => path } } else return {} # wls_domains exist, but directory is removed. end file = File.read(domain_config_file) doc = REXML::Document.new file root = doc.root if root fileadapter_plan, fileadapter_entries, db_adapter_plan, db_adapter_entries, aq_adapter_plan, aq_adapter_entries, \ jms_adapter_plan, jms_adapter_entries, ftp_adapter_plan, \ ftp_adapter_entries = adapters(root) jrf_targets, bam_targets, libraries = libraries(root) [domain_name, { 'bam' => bam_targets, 'bpm' => targets(root, 'bpm'), 'clusters' => clusters(root), 'coherence_clusters' => coherence_clusters(root), 'deployments' => deployments(root), 'eis_aqadapter_entries' => aq_adapter_entries, 'eis_aqadapter_plan' => aq_adapter_plan, 'eis_dbadapter_entries' => db_adapter_entries, 'eis_dbadapter_plan' => db_adapter_plan, 'eis_fileadapter_entries' => fileadapter_entries, 'eis_fileadapter_plan' => fileadapter_plan, 'eis_ftpadapter_entries' => ftp_adapter_entries, 'eis_ftpadapter_plan' => ftp_adapter_plan, 'eis_jmsadapter_entries' => jms_adapter_entries, 'eis_jmsadapter_plan' => jms_adapter_plan, 'filestores' => filestores(root), 'jdbc' => jdbc(root), 'jdbcstores' => jdbcstores(root), 'jmsmodules' => jmsmodules(root, path), 'jmsservers' => jmsservers(root), 'jrf' => jrf_targets, 'libraries' => libraries, 'oimconfigured' => oimconfigured?(root), 'osb' => targets(root, 'osb'), 'path' => path, 'safagents' => safagents(root), 'servers' => servers(root), 'soa' => targets(root, 'soa'), 'templates' => server_templates(root) }] else [domain_name, { 'bam' => [], 'bpm' => [], 'clusters' => [], 'coherence_clusters' => [], 'deployments' => [], 'eis_aqadapter_entries' => [], 'eis_aqadapter_plan' => [], 'eis_dbadapter_entries' => [], 'eis_dbadapter_plan' => [], 'eis_fileadapter_entries' => [], 'eis_fileadapter_plan' => [], 'eis_ftpadapter_entries' => [], 'eis_ftpadapter_plan' => [], 'eis_jmsadapter_entries' => [], 'eis_jmsadapter_plan' => [], 'filestores' => [], 'jdbc' => [], 'jdbcstores' => [], 'jmsmodules' => {}, 'jmsservers' => [], 'jrf' => [], 'libraries' => [], 'oimconfigured' => false, 'osb' => [], 'path' => path, 'safagents' => [], 'servers' => {}, 'soa' => [], 'templates' => [] }] end end domain_listing.sort.to_h end |
#execute(command, user) ⇒ Object
153 154 155 156 157 158 159 160 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 153 def execute(command, user) full_command = if user "su - #{user} -c \"#{command}\"" else command end `#{full_command}` end |
#filestores(root) ⇒ Object
423 424 425 426 427 428 429 430 431 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 423 def filestores(root) filestores = [] root.elements.each('file-store') do |filestore| store = filestore.elements['name'].text Puppet.debug "wls_install_homes.rb found filestore '#{store}'" filestores << store end filestores end |
#first_non_root_file(dir) ⇒ Object
145 146 147 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 145 def first_non_root_file(dir) Dir.new(dir).each { |file| break file if File.stat("#{dir}/#{file}").uid.nonzero? } end |
#get_homes(path) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 99 def get_homes(path) if path && File.exist?("#{path}/ContentsXML/inventory.xml") file = File.read("#{path}/ContentsXML/inventory.xml") doc = REXML::Document.new(file) homes = [] doc.elements.each('/INVENTORY/HOME_LIST/HOME') do |element| # # Skip all entryes that have subelements. # next if element.elements[1] && element.elements[1].name == 'DEPHOMELIST' str = element.attributes['LOC'] if element.attributes['REMOVED'] == 'T' Puppet.debug "Home #{str} marked as removed in Oracle inventory; skipping for ora_install_homes fact." next end unless str.nil? if str.include? 'plugins' # skip EM agent elsif str.include? 'jdk' # skip EM agent elsif str.include? 'OraPlaceHolderDummyHome' # skip EM agent else homes << str.to_s end end end homes else {} end end |
#get_installed_features(oracle_product_home_dir) ⇒ Object
35 36 37 38 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 35 def get_installed_features(oracle_product_home_dir) feature_files = Dir.glob("#{oracle_product_home_dir}/inventory/featuresets/*.xml") feature_files.collect { |file| File.basename(file, '.xml').gsub(/_\d.*/, '') } end |
#get_installed_patches(oracle_home) ⇒ Object
30 31 32 33 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 30 def get_installed_patches(oracle_home) ora_user = user_for_file(oracle_home) patches_in_home(oracle_home, ora_user).flatten.sort end |
#get_opatch_version(name) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 54 def get_opatch_version(name) opatch_out = if File.exist?("#{name}/OPatch/opatch") Facter::Util::Resolution.exec("#{name}/OPatch/opatch version") else '' end opatchver = if opatch_out.nil? 'Error;' else opatch_out.split[2] end Puppet.debug "wls_install opatch version #{name}/OPatch/opatch: #{opatchver}" opatchver end |
#get_ora_inventory_path ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 74 def get_ora_inventory_path os = Facter.value(:kernel) case os when 'Linux' return '/etc' when 'SunOS' return '/var/opt/oracle' end '/etc' end |
#get_orainst_loc ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 86 def get_orainst_loc if File.exist?("#{get_ora_inventory_path}/oraInst.loc") str = '' output = File.read("#{get_ora_inventory_path}/oraInst.loc") output.split(/\r?\n/).each do |item| str = item[14, 50] if /^inventory_loc/.match?(item) end str else '/u01/app/oraInventory' # This is the default as used on market place images. end end |
#get_running_domains(home) ⇒ Object
69 70 71 72 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 69 def get_running_domains(home) java_processes = Facter::Core::Execution.execute("stty cols 9999; ps -eaf | grep java | grep -v grep | grep #{home}") java_processes.match(%r{domains/(\w*?)/servers})&.captures&.uniq || [] end |
#get_version(home) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 12 def get_version(home) version = '' if File.exist?("#{home}/oui/mw/wls/metadata/install.properties") # rubocop:disable Security/Open open "#{home}/oui/mw/wls/metadata/install.properties" do |install_file| # rubocop:enable Security/Open install_file.each_line do |line| next if line.chomp.empty? || line =~ /^#/ property, value = line.split('=') version = property == 'oracle.install.engine.release.version' ? value.chomp : '' break if version != '' end end end version end |
#jdbc(root) ⇒ Object
552 553 554 555 556 557 558 559 560 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 552 def jdbc(root) jdbcstr = [] root.elements.each('jdbc-system-resource') do |jdbcresource| jdbc = jdbcresource.elements['name'].text Puppet.debug "wls_install_homes.rb found jdbc resource '#{jdbc}'" jdbcstr << jdbc end jdbcstr end |
#jdbcstores(root) ⇒ Object
433 434 435 436 437 438 439 440 441 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 433 def jdbcstores(root) jdbcstores = [] root.elements.each('jdbc-store') do |jdbc| store = jdbc.elements['name'].text Puppet.debug "wls_install_homes.rb found jdbcstore '#{store}'" jdbcstores << store end jdbcstores end |
#jmsmodules(root, domain_path) ⇒ Object
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 463 def jmsmodules(root, domain_path) jmsmodules_listing = root.elements.collect('jms-system-resource') do |jmsresource| jmsstr = [] jmssubdeployments = [] jmsresource.elements.each('sub-deployment') do |sub| deployment = sub.elements['name'].text Puppet.debug "wls_install_homes.rb found sub-deployment '#{deployment}'" jmssubdeployments << deployment end file_jms = if jmsresource.elements['descriptor-file-name'].nil? "jms/#{jmsresource.elements['name'].text.downcase}-jms.xml" else jmsresource.elements['descriptor-file-name'].text end subfile = File.read("#{domain_path}/config/#{file_jms}") subdoc = REXML::Document.new subfile jmsroot = subdoc.root jmsmodule_quota_str = [] jmsroot.elements.each('quota') do |qu| quota = qu.attributes['name'] Puppet.debug "wls_install_homes.rb found jmsmodule quota '#{quota}'" jmsmodule_quota_str << quota end jmsmodule_foreign_server_str = {} jmsroot.elements.each('foreign-server') do |fs| fs_name = fs.attributes['name'] Puppet.debug "wls_install_homes.rb found foreign server '#{fs_name}'" jmsmodule_foreign_server_objects_str = [] fs.elements.each('foreign-destination') do |cf| object = cf.attributes['name'] Puppet.debug "wls_install_homes.rb found object '#{object}'" jmsmodule_foreign_server_objects_str << object end fs.elements.each('foreign-connection-factory') do |dest| object = dest.attributes['name'] Puppet.debug "wls_install_homes.rb found object '#{object}'" jmsmodule_foreign_server_objects_str << object end jmsmodule_foreign_server_str = [fs_name, { 'objects' => jmsmodule_foreign_server_objects_str }] end jmsmodule_name = jmsresource.elements['name'].text Puppet.debug "wls_install_homes.rb found jms module '#{jmsmodule_name}'" jmsroot.elements.each('connection-factory') do |cfs| connection_factory = cfs.attributes['name'] Puppet.debug "wls_install_homes.rb found connection-factory '#{connection_factory}'" jmsstr << connection_factory end jmsroot.elements.each('queue') do |queues| queue = queues.attributes['name'] Puppet.debug "wls_install_homes.rb found queue '#{queue}'" jmsstr << queue end jmsroot.elements.each('uniform-distributed-queue') do |dist_queues| queue = dist_queues.attributes['name'] Puppet.debug "wls_install_homes.rb found uniform-distributed-queue '#{queue}'" jmsstr << queue end jmsroot.elements.each('topic') do |topics| topic = topics.attributes['name'] Puppet.debug "wls_install_homes.rb found topic '#{topic}'" jmsstr << topic end jmsroot.elements.each('uniform-distributed-topic') do |dist_topics| topic = dist_topics.attributes['name'] Puppet.debug "wls_install_homes.rb found uniform-distributed-topic '#{topic}'" jmsstr << topic end [jmsmodule_name, { 'foreign_servers' => jmsmodule_foreign_server_str, 'objects' => jmsstr, 'quotas' => jmsmodule_quota_str, 'subdeployments' => jmssubdeployments }] end jmsmodules_listing.to_h end |
#jmsservers(root) ⇒ Object
453 454 455 456 457 458 459 460 461 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 453 def jmsservers(root) jmsserversstr = [] root.elements.each('jms-server') do |jmsservers| server = jmsservers.elements['name'].text Puppet.debug "wls_install_homes.rb found jmsserver '#{server}'" jmsserversstr << server end jmsserversstr end |
#libraries(root) ⇒ Object
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 399 def libraries(root) jrf_target = [] bam_target = [] libraries = [] root.elements.each('library') do |libs| lib_name = libs.elements['name'].text Puppet.debug "wls_install_homes.rb found library '#{lib_name}'" libraries << lib_name if lib_name.include? 'adf.oracle.domain#1.0' target = libs.elements['target'].text.split(',') jrf_target << target Puppet.debug "wls_install_homes.rb found target(s) '#{target}' for jrf" end next unless lib_name.include? 'oracle.bam.library' target = libs.elements['target'].text.split(',') bam_target << target Puppet.debug "wls_install_homes.rb found target(s) '#{target}' for bam" end [jrf_target.flatten.uniq, bam_target.flatten.uniq, libraries] end |
#oimconfigured?(root) ⇒ Boolean
162 163 164 165 166 167 168 169 170 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 162 def oimconfigured?(root) provider = root.elements.to_a('security-configuration/realm//sec:name').first if provider.text == 'OIMAuthenticationProvider' Puppet.debug 'wls_install_homes.rb found oim authentication provider' true else false end end |
#opatch_installed?(weblogic_home) ⇒ Boolean
149 150 151 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 149 def opatch_installed?(weblogic_home) File.exist?("#{weblogic_home}/OPatch/opatch") end |
#patches_in_home(oracle_product_home_dir, os_user) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 40 def patches_in_home(oracle_product_home_dir, os_user) if opatch_installed?(oracle_product_home_dir) full_command = "#{oracle_product_home_dir}/OPatch/opatch lsinventory -oh #{oracle_product_home_dir}" raw_list = execute(full_command, os_user) raw_list.scan(/Patch\s.(\d+)\s.*:\sapplied on/).flatten # patch_ids.collect { |p| "#{oracle_product_home_dir}:#{p}" } else # # When Opatch is not installed, we don't report any patches # [] end end |
#safagents(root) ⇒ Object
443 444 445 446 447 448 449 450 451 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 443 def safagents(root) safagents = [] root.elements.each('saf-agent') do |agent| agent = agent.elements['name'].text Puppet.debug "wls_install_homes.rb found safagent '#{agent}'" safagents << agent end safagents end |
#server_templates(root) ⇒ Object
184 185 186 187 188 189 190 191 192 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 184 def server_templates(root) server_templates = [] root.elements.each('server-template') do |svr_template| name = svr_template.elements['name'].text Puppet.debug "wls_install_homes.rb found server template '#{name}'" server_templates << name end server_templates end |
#servers(root) ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 172 def servers(root) servers = {} root.elements.each('server') do |server| name = server.elements['name'].text port = server.elements['listen-port'].nil? ? '' : server.elements['listen-port'].text machine = server.elements['lmachine'].nil? ? '' : server.elements['machine'].text Puppet.debug "wls_install_homes.rb found server '#{name}' machine '#{machine}' on port '#{port}'" servers[name] = { 'port' => port, 'machine' => machine } end servers end |
#targets(root, type) ⇒ Object
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 224 def targets(root, type) targets = [] root.elements.each("app-deployment[module-type = 'ear']") do |apps| ear_name = apps.elements['name'].text ear_target_value = apps.elements['target'] ear_target = ear_target_value.text.split(',') if ear_target_value&.text case type when 'bpm' if ear_name == 'BPMComposer' Puppet.debug "wls_install_homes.rb found target(s) '#{ear_target}' for '#{type}'" targets << ear_target end when 'soa' if ear_name == 'soa-infra' Puppet.debug "wls_install_homes.rb found target(s) '#{ear_target}' for '#{type}'" targets << ear_target end when 'osb' # rubocop: disable Performance/CollectionLiteralInLoop if ['ALSB Routing', 'Service Bus Routing'].include?(ear_name) Puppet.debug "wls_install_homes.rb found target(s) '#{ear_target}' for '#{type}'" targets << ear_target end # rubocop: enable Performance/CollectionLiteralInLoop end end targets.flatten.uniq end |
#user_for_file(home) ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/puppet_x/enterprisemodules/weblogic/facts.rb', line 133 def user_for_file(home) # # To run opatch, we need the owner of the grid and oracle directory. The mechanism # we use to get this user, is to fetch the owner of the bin directory in the grid or # oracle home. Sometimes however, these directories also contain files with root as owner. # since root can never be the user of the grid or oracle processen, we skip those. # a_file = first_non_root_file(home) uid = File.stat("#{home}/#{a_file}").uid Etc.getpwuid(uid).name end |