Browse Source

Merged in FM-5138-remove-ld-path (pull request #2)

FM-5138 - remove specific LD path for oracle binaries

Approved-by: Julien Cabillot <julien.cabillot@fxinnovation.com>
Approved-by: Guillaume Donval <guillaume.donval@fxinnovation.com>
tags/0.1.1
Guillaume Donval 2 years ago
parent
commit
25e20cfdd1
5 changed files with 53 additions and 9 deletions
  1. +19
    -0
      README.md
  2. +1
    -1
      metadata.rb
  3. +6
    -7
      resources/oracle_client_fx_linux.rb
  4. +27
    -0
      resources/patchelf_fx.rb
  5. +0
    -1
      templates/default/etc/profile.d/oracle.sh.erb

+ 19
- 0
README.md View File

@@ -36,6 +36,25 @@ N/A
| `tnsnames_options` | `String` | `false` | '' | `All` | tnsnames.ora file content. |
| `tls_certificate_url` | `String` | `false` | '' | `All` | URL of the root certificate to add in the client wallet. |

### patchelf_fx

Run patchelf to a set of binaries.
It modifies linked libraries of ELF binaries in `binary_path` to use libraries in `library_path` in priority.

For more information, check [the NixOS PatchELF documentation](https://nixos.org/patchelf.html).

This resource is kept in this cookbook even if it should be an external dependency.
**This resource should eventually be moved in its own cookbook.**
That being said, the moving will not cause any breaking change on this cookbook.

#### Properties

| Name | Type | Required | Default | Operating System | Description |
| -------------- | ---------- | -------- | ------- | ---------------- | ----------- |
| `library_path` | `String` | `true` | - | `All` | Library paths to use, separated by `:` |
| `binary_path` | `String` | `true` | - | `All` | Binaries to patch. |


## Versionning
This cookbook will follow semantic versionning 2.0.0 as described [here](https://semver.org/)



+ 1
- 1
metadata.rb View File

@@ -6,7 +6,7 @@ description 'Installs/Configures oracle client.'
long_description 'Installs/Configures oracle client.'
supports 'redhat', '>= 6.0'
supports 'centos', '>= 6.0'
version '0.1.0'
version '0.1.1'
chef_version '>= 12.24' if respond_to?(:chef_version)
source_url 'https://bitbucket.org/fxadmin/public-common-cookbook-oracle_client_fx/'
issues_url 'https://bitbucket.org/fxadmin/public-common-cookbook-oracle_client_fx/issues/'


+ 6
- 7
resources/oracle_client_fx_linux.rb View File

@@ -61,13 +61,6 @@ action :build do
verify 'bash -n %{path}'
end

file '/etc/ld.so.conf.d/oracle.conf' do
content lib_path
owner 'root'
group 'root'
mode '0644'
end

directory base_path do
owner new_resource.user
group new_resource.group
@@ -147,6 +140,12 @@ action :build do
command "#{home_path}/root.sh"
end

patchelf_fx 'makes sure oracle binaries uses oracle libraries' do
binary_path bin_path
library_path lib_path
action :set_rpath
end

file "#{home_path}/network/admin/tnsnames.ora" do
content new_resource.tnsnames_options
mode '0660'


+ 27
- 0
resources/patchelf_fx.rb View File

@@ -0,0 +1,27 @@
#
# cookbook::oracle_client_fx
# resource::patchelf_fx
#
# author::fxinnovation
# description::Run patchelf to a set of binaries
#
resource_name :patchelf_fx

provides :patchelf_fx, os: 'linux'

property :library_path, String
property :binary_path, String

action :set_rpath do
package 'patchelf' do
action :nothing
# Only remove patchelf if it wasn’t installed before
subscribes :remove, 'package[patchelf]', :delayed
end

# There is no guard yet, because it would need to test every linked library for every binary.
execute 'makes sure oracle binaries get its libraries' do
command "find #{new_resource.binary_path} -type f -exec file {} \\; | grep ELF | cut -d ':' -f 1 | while read binary; do patchelf --set-rpath #{new_resource.library_path} $binary; done"
notifies :install, 'package[patchelf]', :before
end
end

+ 0
- 1
templates/default/etc/profile.d/oracle.sh.erb View File

@@ -4,4 +4,3 @@ export ORACLE_CLIENT_LIB_PATH=<%= @lib_path %>
export INVENTORY_LOCATION=<%= @var_path %>

export PATH=$PATH:$ORACLE_CLIENT_BIN_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_CLIENT_LIB_PATH

Loading…
Cancel
Save