Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sync between registry and installer persistence #72

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions src/core/#mbtools#cl_tool_manager.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,12 @@ CLASS /mbtools/cl_tool_manager IMPLEMENTATION.

DATA lv_file TYPE string.

lv_file = iv_title && '-x.y.z.zip'.
IF iv_title IS INITIAL.
lv_file = 'package-x.y.z.zip'.
ELSE.
lv_file = iv_title && '-x.y.z.zip'.
ENDIF.

REPLACE ALL OCCURRENCES OF ` ` IN lv_file WITH '-'.

SUBMIT /mbtools/mbt_installer
Expand Down Expand Up @@ -689,8 +694,9 @@ CLASS /mbtools/cl_tool_manager IMPLEMENTATION.
CONSTANTS lc_tabname TYPE tabname VALUE 'ZMBTINST'.

DATA:
ls_inst TYPE ty_inst,
ls_cont TYPE ty_content.
ls_inst TYPE ty_inst,
ls_inst_db TYPE ty_inst,
ls_cont TYPE ty_content.

ls_inst-name = io_tool->get_name( ).
ls_inst-pack = io_tool->get_package( ).
Expand All @@ -707,9 +713,14 @@ CLASS /mbtools/cl_tool_manager IMPLEMENTATION.
ls_inst-status = 'S'. "success
ls_cont = _sync_json( ls_inst ).

SELECT SINGLE * FROM (lc_tabname) INTO ls_cont WHERE name = ls_inst-name.
SELECT SINGLE * FROM (lc_tabname) INTO CORRESPONDING FIELDS OF ls_inst_db WHERE name = ls_inst-name.
IF sy-subrc = 0.
UPDATE (lc_tabname) FROM ls_cont.
IF ls_inst_db-pack <> ls_inst-pack.
DELETE FROM (lc_tabname) WHERE name = ls_inst-name ##SUBRC_OK.
INSERT (lc_tabname) FROM ls_cont ##SUBRC_OK.
ELSE.
UPDATE (lc_tabname) FROM ls_cont.
ENDIF.
IF sy-subrc <> 0.
/mbtools/cx_exception=>raise( 'Error updating MBT Installer persistence'(003) ).
ENDIF.
Expand All @@ -720,6 +731,8 @@ CLASS /mbtools/cl_tool_manager IMPLEMENTATION.
ENDIF.
ENDIF.

COMMIT WORK.

rv_result = abap_true.

ENDMETHOD.
Expand Down Expand Up @@ -868,7 +881,7 @@ CLASS /mbtools/cl_tool_manager IMPLEMENTATION.
DATA lo_json TYPE REF TO /mbtools/cl_ajson.

TRY.
lo_json = /mbtools/cl_ajson=>create_empty( ).
lo_json = /mbtools/cl_ajson=>create_empty( iv_keep_item_order = abap_true ).
lo_json->set( iv_path = '/'
iv_val = is_inst ).

Expand Down