Skip to content

Commit

Permalink
Merge pull request #108 from Simranpal/fix/hana-exe-extraction
Browse files Browse the repository at this point in the history
Workaround for installation when using exe archive
  • Loading branch information
Simranpal Singh authored Oct 11, 2020
2 parents 4a60aa7 + 520f9a5 commit fd96493
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
3 changes: 2 additions & 1 deletion hana/enable_cost_optimized.sls
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{%- from "hana/map.jinja" import hana with context -%}
{%- from "hana/extract_hana_package.sls" import hana_extract_dir with context -%}
{%- from 'hana/macros/get_hana_exe_extract_dir.sls' import get_hana_exe_extract_dir with context %}
{% set hana_extract_dir = get_hana_exe_extract_dir(hana) %}
{% set host = grains['host'] %}
Expand Down
7 changes: 1 addition & 6 deletions hana/extract_hana_package.sls
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,14 @@ install_unrar_package:
pkg.installed:
- name: {{ unrar_package }}
# unrar tool does not have the option to skip extracting top-level directory when using multipart exe archives#
extract_hana_multipart_archive:
cmd.run:
- name: unrar x {{ hana_package }}
- cwd: {{ hana_extract_dir }}
- require:
- install_unrar_package
{# Below is temporary workaround to update the extraction path when using unrar for multipart rar archive#}
{# TODO: Find better solution to set or detect the correct extraction path when extracting multipart rar archive#}
{% set archive_base_name = salt['file.basename'](hana_package.split('.')[0]) %}
{% set archive_name = archive_base_name.split('_')[0] %}
{% set hana_extract_dir = hana_extract_dir| path_join(archive_name) %}
{%- elif hana_package.endswith((".sar", ".SAR")) and hana.sapcar_exe_file is defined %}
extract_hdbserver_sar_archive:
Expand Down
3 changes: 2 additions & 1 deletion hana/install.sls
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{%- from "hana/map.jinja" import hana with context -%}
{%- from 'hana/macros/get_hana_exe_extract_dir.sls' import get_hana_exe_extract_dir with context %}
{% set host = grains['host'] %}
{% set hana_extract_dir = hana.hana_extract_dir %}
{% set hana_extract_dir = get_hana_exe_extract_dir(hana) %}
include:
- .enable_cost_optimized
Expand Down
12 changes: 12 additions & 0 deletions hana/macros/get_hana_exe_extract_dir.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% macro get_hana_exe_extract_dir(hana) -%}
{%- set hana_extract_dir = hana.hana_extract_dir %}
{#- Below is temporary workaround to update the software installation path when using unrar for HANA multipart rar archive#}
{#- TODO: Find better solution to set or detect the correct extraction path when extracting multipart rar archive#}
{#- Below logic finds the extraction location based on name of multipart exe archive filename#}
{%- if hana.hana_archive_file is defined and hana.hana_archive_file.endswith((".exe", ".EXE")) %}
{%- set archive_base_name = salt['file.basename']( hana.hana_archive_file.split('.')[0]) %}
{%- set archive_name = archive_base_name.split('_')[0] %}
{%- set hana_extract_dir = hana_extract_dir| path_join(archive_name) %}
{%- endif %}
{{- hana_extract_dir }}
{%- endmacro %}
3 changes: 2 additions & 1 deletion hana/monitoring.sls
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{%- from "hana/map.jinja" import hana with context -%}
{%- from "hana/extract_hana_package.sls" import hana_extract_dir with context -%}
{%- from 'hana/macros/get_hana_exe_extract_dir.sls' import get_hana_exe_extract_dir with context %}
{% set hana_extract_dir = get_hana_exe_extract_dir(hana) %}
{% set pydbapi_output_dir = '/tmp/pydbapi' %}
Expand Down
5 changes: 5 additions & 0 deletions saphanabootstrap-formula.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sun Oct 11 04:21:32 UTC 2020 - Simranpal Singh <[email protected]>

- Fix the hana media extraction and installation logics when using exe archives

-------------------------------------------------------------------
Thu Oct 8 02:34:37 UTC 2020 - Simranpal Singh <[email protected]>

Expand Down

0 comments on commit fd96493

Please sign in to comment.